VC Templates
Plugin for creating new credentials from basic templates
This is a plugin for simplifying useful, meaningful credentials with minimal input. Additionally, this plugin can be used as reference for creating your own plugin to add simple templates for creating new credentials.
Install
bun add @learncard/vc-templates-pluginBasic Credential
The credential of type basic is the most simple credential, following the minimum information required by the Verifiable Credential specification.
// Basic Credential: with default, 'basic' template
learnCard.invoke.newCredential();
learnCard.invoke.newCredential({ type: 'basic' });
/**
{
'@context': [ 'https://www.w3.org/2018/credentials/v1' ],
id: 'http://example.org/credentials/3731',
type: [ 'VerifiableCredential' ],
issuer: 'did:key:z6MkmF9iYcGTRiHFavPPYurDNuDfYMJQR66oGrSGnfnNpPzc',
issuanceDate: '2020-08-19T21:41:50Z',
credentialSubject: { id: 'did:example:d23dd687a7dc6787646f2eb98d0' }
}
**/
// Basic Credential: with did, subject, and issuanceDate overloads
learnCard.invoke.newCredential({
type: 'basic',
did: 'did:example:123',
subject: 'did:example:456',
issuanceDate: '2020-08-19T21:41:50Z',
});
/**
{
'@context': [ 'https://www.w3.org/2018/credentials/v1' ],
id: 'http://example.org/credentials/3731',
type: [ 'VerifiableCredential' ],
issuer: 'did:example:123',
issuanceDate: '2020-08-19T21:41:50Z',
credentialSubject: { id: 'did:example:456' }
}
**/Achievement Credential:
Other Types
Last updated
Was this helpful?