Trying to validate a signed credential, using the code below,
const emailAddressSignedCredential = '{"@context":[{"id":"@id","type":"@type","cred":"https://w3id.org/credentials#","schema":"http://schema.org/","dc":"http://purl.org/dc/terms/","xsd":"http://www.w3.org/2001/XMLSchema#","sec":"https://w3id.org/security#","Credential":"cred:Credential","issuer":{"@id":"cred:issuer","@type":"@id"},"issued":{"@id":"cred:issued","@type":"xsd:dateTime"},"claim":{"@id":"cred:claim","@type":"@id"},"credential":{"@id":"cred:credential","@type":"@id"},"expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"proof":{"@id":"sec:proof","@type":"@id"},"EcdsaKoblitzSignature2016":"sec:EcdsaKoblitzSignature2016","created":{"@id":"dc:created","@type":"xsd:dateTime"},"creator":{"@id":"dc:creator","@type":"@id"},"domain":"sec:domain","nonce":"sec:nonce","signatureValue":"sec:signatureValue"},{"ProofOfEmailCredential":"https://identity.jolocom.com/terms/ProofOfEmailCredential","schema":"http://schema.org/","email":"schema:email"}],"id":"claimId:3ddfa760e8c02745","issuer":"did:jolo:0e2abe7919a330e13e8c9cac2ef31a52a307880d6fd22e3878de4a6fc7c38f41","issued":"2020-08-03T17:54:44.752Z","type":["Credential","ProofOfEmailCredential"],"expires":"2021-08-03T17:54:44.749Z","proof":{"created":"2020-08-03T17:54:44.751Z","type":"EcdsaKoblitzSignature2016","nonce":"754a9373838c0a6e","signatureValue":"08ba912396a60e51f092a09e91fc0d89e07bc3c99140ca9e5c72b4258ec200e34bcaa8d4c0c0313916fe6481f259b73f8ae6eef49aac946c272a30ced451f991","creator":"did:jolo:0e2abe7919a330e13e8c9cac2ef31a52a307880d6fd22e3878de4a6fc7c38f41#keys-1"},"claim":{"email":"cpatel@keyko.io","id":"did:jolo:0e2abe7919a330e13e8c9cac2ef31a52a307880d6fd22e3878de4a6fc7c38f41"},"name":"Email address"}';
const receivedCredential = JolocomLib.parse.signedCredential(emailAddressSignedCredential);
... and It's giving me the error below.
TypeError: Cannot read property 'did' of undefined
at Object.exports.validateDigestable (/Users/chinmay/coding/keyko/ssi/server-identity/node_modules/jolocom-lib/ts/utils/validation.ts:21:62)
at _callee2$ (/Users/chinmay/coding/keyko/ssi/server-identity/index.js:87:41)
at tryCatch (/Users/chinmay/coding/keyko/ssi/server-identity/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:65:40)
at Generator.invoke [as _invoke] (/Users/chinmay/coding/keyko/ssi/server-identity/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:303:22)
at Generator.prototype.(anonymous function) [as next] (/Users/chinmay/coding/keyko/ssi/server-identity/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/Users/chinmay/coding/keyko/ssi/server-identity/index.js:158:191)
at /Users/chinmay/coding/keyko/ssi/server-identity/index.js:158:361
I've also attempted, fromJSON function by passing the object directly but it still didn't work. This approach gave me an error _jolocomLib.JolocomLib.parse.signedCredential.fromJSON is not a function.
Also, if you are wondering, emailAddressSignedCredential is created using the code below,
emailAddressSignedCredential = await userWallet.create.signedCredential({
metadata: claimsMetadata.emailAddress,
claim: { email: process.env.user_email },
subject: userWallet.did // Our own DID, referred to as a self-issued credential
}, process.env.user_secret)
Is this the library error or am I not using the library correctly?
Trying to validate a signed credential, using the code below,
... and It's giving me the error below.
I've also attempted,
fromJSONfunction by passing the object directly but it still didn't work. This approach gave me an error_jolocomLib.JolocomLib.parse.signedCredential.fromJSON is not a function.Also, if you are wondering,
emailAddressSignedCredentialis created using the code below,Is this the library error or am I not using the library correctly?