JWS / Proof in createVerifiableCredential #571
-
I want to make a proof that issuer X signs data {name: "Old Nordmann"} for subject Y. I dont see how i should / can connect the VC and JWT? Or how i crate the proof in the agent.createVerifiableCredential() Here is my test https://github.com/BROKLab/auth-bot/blob/veramo/src/network/veramo.service.ts#L95 Could i get some pointers to how i should construct this to get the proof I am after? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
When using You can try something like this: const issuerX = await agent.didManagerGet({ did: 'did:example:issuerX' })
const credential = {
issuer: { id: issuerX.did }, // issuer DID MUST be an identifier managed by this agent ()
credentialSubject: {
id: 'did:example:subjectY',
name: 'Old Nordmann'
},
}
const vc = await agent.createVerifiableCredential({
credential,
proofFormat: 'jwt',
})
console.log(JSON.stringify(vc, null, 2))
/*
{
issuer: { id: 'did:example:issuerX' },
credentialSubject: {
name: 'Old Nordmann',
id: 'did:example:subjectY'
},
type: [ 'VerifiableCredential' ],
issuanceDate: '2021-06-15T07:27:01.000Z',
proof: {
type: 'JwtProof2020',
jwt: 'eyJhbGci.....OCbMK8U1p6B0KzVA'
},
'@context': [ 'https://www.w3.org/2018/credentials/v1' ]
}
*/ Please note that I hope this helps |
Beta Was this translation helpful? Give feedback.
createVerifiableCredential
returns a Verifiable Credential object with a structure mimicking the ones described in the W3C VC data model for convenience.When using
proofFormat: 'jwt'
, veramo creates a syntheticJwtProof2020
proof property on the returned credential.This proof type has a
jwt
field that contains the actual credential in JWT encoding.You can try something like this: