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.

http
Copy to clipboard.
1POST https://YOUR_TENANT_SUBDOMAIN.vii.mattr.global/core/v1/credentials

Request

json
Copy to clipboard.
1{
2    "issuer": {
3        "id": "did:key:z6MkndAHigYrXNpape7jgaC7jHiWwxzB3chuKUGXJg2b5RSj",
4        "name": "YOUR_TENANT_SUBDOMAIN.vii.mattr.global"
5    },
6    "@context": [
7        "https://www.w3.org/2018/credentials/v1",
8        "https://schema.org"
9    ],
10    "subjectId": "did:key:z6MkfxQU7dy8eKxyHpG267FV23agZQu9zmokd8BprepfHALi",
11    "type": [
12        "VerifiableCredential",
13        "CourseCredential"
14    ],
15    "claims": {
16        "givenName": "Chris",
17        "familyName": "Shin",
18        "educationalCredentialAwarded": "Certificate Name"
19    },
20    "tag": "external-identifier",
21    "persist": true
22}

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

json
Copy to clipboard.
1{
2  "id": "e6c9b6a2-d87b-4be1-8b3a-f3dc13b44b5c",
3  "tag": "external-identifier",
4  "credential": {
5    {
6      "@context": [
7        "https://www.w3.org/2018/credentials/v1",
8        "https://schema.org",
9        "https://w3id.org/vc-revocation-list-2020/v1"
10      ],
11      "type": [
12        "VerifiableCredential",
13        "CourseCredential"
14      ],
15      "issuer": {
16        "id": "did:key:z6MkndAHigYrXNpape7jgaC7jHiWwxzB3chuKUGXJg2b5RSj",
17        "name": "YOUR_TENANT_SUBDOMAIN.vii.mattr.global"
18      },
19      "credentialSubject": {
20        "id": "did:key:z6MkfxQU7dy8eKxyHpG267FV23agZQu9zmokd8BprepfHALi",
21        "givenName": "Chris",
22        "familyName": "Shin",
23        "educationalCredentialAwarded": "Certificate Name"
24      },
25      "issuanceDate": "2020-10-08T03:00:12.478Z",
26      "proof": {
27        "jws": "eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..PFXv7Kgc8tqxBELiLvPLgeksfo0hlE4adV3_zt6MRcyYY26FGxiB4ctAVez25JW86Z1o6EAbuGKVctMYB_psCw",
28        "type": "Ed25519Signature2018",
29        "created": "2020-10-08T03:00:12Z",
30        "proofPurpose": "assertionMethod",
31        "verificationMethod": "did:key:z6MkfxQU7dy8eKxyHpG267FV23agZQu9zmokd8BprepfHALi#z6MkfxQU7dy8eKxyHpG267FV23agZQu9zmokd8BprepfHALi"
32      }
33    }
34  },
35  "issuanceDate": "2020-10-08T03:00:12.478Z"
36}

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