Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'creator': publicKeys.carol.id,
'jws':
'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19' +
'..' +
'ANcNI6x6KDA_hHux2RLM8_i9aoZY34GwcZevOjkSh22WoNB4FcP6dNgf2nKzX' +
'XJIr-IqUnEwMYeD36fc8jv1AA',
'proofPurpose': NOOP_PROOF_PURPOSE_URI
}
};
mock.parameters = {};
mock.parameters.sign = {
creator: publicKeys.carol.id,
date: '2018-02-13T21:26:08Z',
key: new Ed25519KeyPair({
privateKeyBase58: privateKeys.carol.privateKeyBase58,
...publicKeys.carol
})
};
mock.parameters.verify = {
creator: publicKeys.carol.id,
date: '2018-02-13T21:26:08Z'
};
mock.parameters.verifyWithPassedKey = mock.parameters.sign;
mock.parameters.authenticationController = {
'@context': constants.SECURITY_CONTEXT_URL,
id: controllers.carol.id,
authentication: publicKeys.carol.id
const verificationMethod = signedData.proof.verificationMethod
? signedData.proof.verificationMethod
: signedData.proof.creator;
const doc = await resolver.resolve(verificationMethod);
const didPublicKey = doc.publicKey.find(k => {
return k.id == verificationMethod;
});
if (didPublicKey.type === "Ed25519VerificationKey2018") {
const result = await jsigs.verify(signedData, {
documentLoader: wrappedDocumentLoader({
//args that are needed in the wrapper.. such as zcaps
}),
suite: new Ed25519Signature2018({
key: new Ed25519KeyPair(didPublicKey)
}),
purpose: new AssertionProofPurpose({ controller: doc })
});
return result.verified;
}
return OpenPgpSignature2019.verify({
data: signedData,
signatureAttribute: "proof",
publicKey: getPublicKeyFromDIDDoc(doc, verificationMethod)
});
};