Skip to main content

Issue credential

Once a draft is finalized, you can issue it as a verifiable credential (VC). Issuing a VC finalizes it, making it available for verification by other parties.

As mentioned on the Drafts vs credentials page, issuing a draft does the following under the hood:

  • Exports the draft as an unsigned VC
  • Signs the unsigned VC to create a signed VC
  • Imports the signed VC

You can also perform each of the last steps separately, using the Export, Sign, and Import methods for more granular control.

Generate key for signing

Before issuing the VC, you need to ensure that you have a public-private key pair to sign the VC. If you have not generated a public-private key pair as part ot the quick start guide, use the example below to generate the key pair with a P256 curve:

const privateKey = await client.keys.keyGenerate({
data: {
type: 'P256',
},
});
note

The Truvity platform supports different types of cryptographic keys. The Cryptosuites page lists all supported key types and their names.

Issue credential

Call the issue method to issue a VerifiableCredential from an existing draft:

const credential = await updatedDraft.issue(privateKey.id); // VerifiableCredential<ClaimsModelExample>

What happens after issuing?

Once issued, the credential:

  • Is signed cryptographically and becomes tamper-evident.
  • Can no longer be modified.
  • Is ready to be shared with verifiers for validation.

Best practices

  • Finalize all data : Ensure all the necessary data is included before issuing, as credentials cannot be edited once issued.

  • Review thoroughly before issuing : Carefully examine and validate drafts to ensure all fields are accurate and complete, especially in scenarios involving multiple approving parties.

Further reading

After credential issuance, you can do the following: