Hold a Credential in a Registry

Overview

This tutorial explains how to create a Credential that will be held in the Registry.

Create a Credential in the Registry

To create a Credential that will be stored in the Registry, set the persist attribute in the body to true.

POST https://tenant.platform.mattr.global/v1/credentials

Request

{
"issuer": {
"id": "did:key:z6MkndAHigYrXNpape7jgaC7jHiWwxzB3chuKUGXJg2b5RSj",
"name": "tenant.platform.mattr.global"
},
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://schema.org"
],
"subjectId": "did:key:z6MkfxQU7dy8eKxyHpG267FV23agZQu9zmokd8BprepfHALi",
"type": [
"VerifiableCredential",
"Course"
],
"claims": {
"givenName": "Chris",
"familyName": "Shin",
"educationalCredentialAwarded": "Certificate Name"
},
"tag": "external-identifier",
"persist": true
}

When persist is set to true, both the Credential and the Credential meta-data will be held in the Registry.

When persist is set to false, only the following meta-data will be stored:

  • id
  • tag
  • credentialStatus (in the case of Revocation)
  • issuanceDate

For credentials issued using the OIDC flow, the persist attribute will be false.

The optional tag attribute can be used to reference the issued credential using a value of any string up to 1024 characters. By setting the tag to an external identifier, it gets stored in the Credential meta-data and it can be used to Search for a Credential in the Registry.

Response

{
"id": "e6c9b6a2-d87b-4be1-8b3a-f3dc13b44b5c",
"tag": "external-identifier",
"credential": {
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://schema.org",
"https://w3id.org/vc-revocation-list-2020/v1"
],
"type": [
"VerifiableCredential",
"Course"
],
"issuer": {
"id": "did:key:z6MkndAHigYrXNpape7jgaC7jHiWwxzB3chuKUGXJg2b5RSj",
"name": "tenant.platform.mattr.global"
},
"credentialSubject": {
"id": "did:key:z6MkfxQU7dy8eKxyHpG267FV23agZQu9zmokd8BprepfHALi",
"givenName": "Chris",
"familyName": "Shin",
"educationalCredentialAwarded": "Certificate Name"
},
"issuanceDate": "2020-10-08T03:00:12.478Z",
"proof": {
"jws": "eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..PFXv7Kgc8tqxBELiLvPLgeksfo0hlE4adV3_zt6MRcyYY26FGxiB4ctAVez25JW86Z1o6EAbuGKVctMYB_psCw",
"type": "Ed25519Signature2018",
"created": "2020-10-08T03:00:12Z",
"proofPurpose": "assertionMethod",
"verificationMethod": "did:key:z6MkfxQU7dy8eKxyHpG267FV23agZQu9zmokd8BprepfHALi#z6MkfxQU7dy8eKxyHpG267FV23agZQu9zmokd8BprepfHALi"
}
}
},
"issuanceDate": "2020-10-08T03:00:12.478Z"
}

The Credential that will be held in the Registry, including the tag as meta-data.