Issue Store Verify Sample flow

This flow refers to Postman, but the general steps are the same however you use the API. The Issue Store Verify collection includes the scripts that automatically propagate results into the next request bodies when you follow the below steps.

Download the sample collection here.

To issue a credential and or a presentation on the holder's behalf, the following steps are required:

1. Create a DID

To create a new DID to issue with, go to Create DID and click Send. The id property denotes a job ID in the system that you can use to query for blockchain transaction status.

The Dock API supports did:dock, did:polygonid and did:key method creation.

Body
{
"type": "dock"
}
200 Response
{
    "did": "did:dock:5CvswSAkWbyn6iQdRtMiD8tUAQmpXBghPVs9JqK5cJTiAhJk",
    "controller": "did:dock:5CvswSAkWbyn6iQdRtMiD8tUAQmpXBghPVs9JqK5cJTiAhJk",
    "id": "23677",
    "data": {
        "did": "did:dock:5CvswSAkWbyn6iQdRtMiD8tUAQmpXBghPVs9JqK5cJTiAhJk",
        "controller": "did:dock:5CvswSAkWbyn6iQdRtMiD8tUAQmpXBghPVs9JqK5cJTiAhJk"
    }
}

Creating a Dock DID submits a transaction to the blockchain, this could take some time to process. Please hit the `/jobs` endpoint to check the status of the job to see if it's finalized or not.

When creating a Polygon ID DID, be sure to set the `keyType` field to `bjj`.

2. Update the DID

To add information about your Organization to the DID, e.g. name and logo, you will need to update the DID profile.

Body
{
    "did":"did:dock:5CfsgqHioKCHNddVK9Y2Lu8fHQpvXh3nc9xVjLZNDqk1ZJ9z",
    "name": "Postman Test",
    "logo":""
}
200 Response
{
    "did": "did:dock:5CfsgqHioKCHNddVK9Y2Lu8fHQpvXh3nc9xVjLZNDqk1ZJ9z",
    "name": "Postman Test",
    "logo": ""
}

You only need to create a DID once and then you can issue many credentials with it. A subject/holder DID should not be the same as the issuer DID in a real world credential.

3. Create a Schema

To issue a credential you will need to set a schema that will define which attributes need to be included in the credential.

Body
{
      "$schema": "http://json-schema.org/schema",
      "name": "Postman test schema",
      "description": "describing Postman test schema",
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "emailAddress": {
          "type": "string",
          "format": "email"
        },
        "alumniOf": {
          "type": "string"
        }
      },
      "required": [
        "emailAddress",
        "alumniOf"
      ],
      "additionalProperties": false
    }
200 Response
{
    "id": "0",
    "data": {
        "schema": {
            "$schema": "http://json-schema.org/schema",
            "name": "Postman test schema",
            "description": "describing VPI test schema",
            "type": "object",
            "properties": {
                "id": {
                    "type": "string"
                },
                "emailAddress": {
                    "type": "string",
                    "format": "email"
                },
                "alumniOf": {
                    "type": "string"
                }
            },
            "required": [
                "emailAddress",
                "alumniOf"
            ],
            "additionalProperties": false,
            "$metadata": {
                "version": 1,
                "uris": {
                    "jsonSchema": "https://schema.dock.io/PostmanTestSchema-V1-1723810163796.json",
                    "jsonLdContext": "https://schema.dock.io/PostmanTestSchema-V1723810163796.json-ld"
                }
            },
            "$id": "https://schema.dock.io/PostmanTestSchema-V1-1723810163796.json"
        },
        "id": "https://schema.dock.io/PostmanTestSchema-V1-1723810163796.json",
        "uri": "https://schema.dock.io/PostmanTestSchema-V1-1723810163796.json",
        "created": "2024-08-16T12:09:23.911Z",
        "isOwner": true,
        "ownerName": "",
        "ownerLogo": ""
    }
}

4. Issue a verifiable credential

To create a Verifiable Credential using the the new issuer DID, update Issuer with the DID you have created in the first step and add the required information to the attributes. It will return a Verifiable Credential that conforms to the W3C spec.

Body
{
  "persist": true,
  "password": "1234",
  "anchor": false,
  "recipientEmail":"agne@dock.io",
  "distribute": true,
  "format": "jsonld",
  "credential": {
    "name": "VPI test credential",
    "description": "describing vpi test credential",
    "schema": "https://schema.dock.io/VPITestSchema-V1-1723546475527.json",
    "type": [
      "VPITestSchema"
    ],
    "subject": {
        "id":"agne@dock.io",
        "emailAddress":"agne@dock.io",
        "alumniOf":"University of Vilnius"
    },
    "issuer": "did:dock:5DciJXakYFsCfpFzQzrHCdoRvRwi1gu2uUGJnys5Aj4cvWUx",
    "issuanceDate": "2024-08-13T11:03:35.610Z"
   }
}
200 Response
{
    "@context": [
        "https://www.w3.org/2018/credentials/v1",
        {
            "VPITestSchema": "dk:VPITestSchema",
            "alumniOf": "dk:alumniOf",
            "description": "http://schema.org/description",
            "dk": "https://ld.dock.io/credentials#",
            "emailAddress": "dk:emailAddress",
            "name": "dk:name"
        }
    ],
    "id": "https://creds-testnet.dock.io/43800063042edf33e7092653e487aeb795e528d24664be5ea641b62f279dc69d",
    "type": [
        "VerifiableCredential",
        "VPITestSchema"
    ],
    "credentialSubject": {
        "id": "agelzinyte@gmail.com",
        "emailAddress": "agelzinyte@gmail.com",
        "alumniOf": "University of Vilnius"
    },
    "issuanceDate": "2024-08-13T11:03:35.610Z",
    "issuer": {
        "name": "VPI test issuer",
        "id": "did:dock:5DciJXakYFsCfpFzQzrHCdoRvRwi1gu2uUGJnys5Aj4cvWUx"
    },
    "credentialSchema": {
        "id": "https://schema.dock.io/VPITestSchema-V1-1723546475527.json",
        "type": "JsonSchemaValidator2018"
    },
    "name": "VPI test credential",
    "description": "describing vpi test credential",
    "proof": {
        "type": "Ed25519Signature2018",
        "created": "2024-08-16T12:14:55Z",
        "verificationMethod": "did:dock:5DciJXakYFsCfpFzQzrHCdoRvRwi1gu2uUGJnys5Aj4cvWUx#keys-1",
        "proofPurpose": "assertionMethod",
        "jws": "eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..IbZADG6nhKe7lSHUuQ4OyEAToeGybN7nYl2Pp8rsUzc-oVAKYzBzZX2gMM8Bj4Np1cNK9WvpjlyRWjgVviz_Bg"
    }
}

5. Verify the Signed Credential

To verify if the credential's cryptographic proof, revocation status and more go to Verify Signed Credential and click Send.

CREDENTIAL VERIFIED - 200 Response
{
    "verified": true,
    "results": [ ... ]
}

6. Import the credential into the wallet

Download Dock wallet and click on the email link that was sent when issuing the credential. If not using the email distribution download the json of the credential an import it to the wallet using the json import option.

5. Create a verification/proof template

To verify a credential you will need a verification template, that will indicate which attributes need to be fullfilled for successfull verification. Verification templates can be reused.

Body
{
  "name": "Postman proof request",
  "nonce": "1234567890",
  "request": {
    "name": "test request",
    "purpose": "my purpose",
    "input_descriptors": [
      {
        "id": "Credential 1",
        "name": "test request",
        "purpose": "my purpose",
        "constraints": {
          "fields": [
            {
                "path": [
                    "$.credentialSubject.alumniOf"
                ]
            },
            {
            "path": [
                "$.credentialSubject.dateIssued"
                ],
                "optional": true
            },
            {
                "path": [
                        "$.credentialSchema.id"
                ],
                "filter": {
                    "const": "https://schema.dock.io/PostmanTestSchemaJune18-V1-1718711073065.json"
              }
            }
          ]
        }
      }
    ]
  }
}
200 Response
{
    "id": "acbff85d-a556-4832-b118-2194c51d3401",
    "did": "",
    "name": "Postman proof request",
    "created": "2024-08-16T12:28:00.638Z",
    "updated": "2024-08-16T12:28:00.638Z",
    "request": {
        "name": "test request",
        "purpose": "my purpose",
        "input_descriptors": [
            {
                "id": "Credential 1",
                "name": "test request",
                "purpose": "my purpose",
                "constraints": {
                    "fields": [
                        {
                            "path": [
                                "$.credentialSubject.alumniOf"
                            ]
                        },
                        {
                            "path": [
                                "$.credentialSubject.dateIssued"
                            ],
                            "optional": true
                        },
                        {
                            "path": [
                                "$.credentialSchema.id"
                            ],
                            "filter": {
                                "const": "https://schema.dock.io/PostmanTestSchemaJune18-V1-1718711073065.json"
                            }
                        }
                    ]
                }
            }
        ]
    },
    "totalRequests": 0
}

6. Create a verification/proof presentation

Using the verification template created in the previous step in the endpoint POST/proof-templates/{id}/ request a single use verification or proof presentation will be created.

200 Response
{
    "id": "806be681-494c-4483-bf49-e1aee96473d9",
    "name": "Postman proof request",
    "nonce": "f3db4810cd8bf8df17bb04ace82dee36",
    "did": "",
    "verified": false,
    "created": "2024-08-16T12:33:32.867Z",
    "updated": "2024-08-16T12:33:32.867Z",
    "signature": null,
    "presentation": {},
    "response_url": "https://api-testnet.dock.io/proof-requests/806be681-494c-4483-bf49-e1aee96473d9/send-presentation",
    "type": "proof-request",
    "qr": "https://creds-testnet.dock.io/proof/806be681-494c-4483-bf49-e1aee96473d9",
    "request": {
        "name": "test request",
        "purpose": "my purpose",
        "input_descriptors": [
            {
                "id": "Credential 1",
                "name": "test request",
                "purpose": "my purpose",
                "constraints": {
                    "fields": [
                        {
                            "path": [
                                "$.credentialSubject.alumniOf"
                            ]
                        },
                        {
                            "path": [
                                "$.credentialSubject.dateIssued"
                            ],
                            "optional": true
                        },
                        {
                            "path": [
                                "$.credentialSchema.id"
                            ],
                            "filter": {
                                "const": "https://schema.dock.io/PostmanTestSchemaJune18-V1-1718711073065.json"
                            }
                        }
                    ]
                }
            }
        ],
        "id": "806be681-494c-4483-bf49-e1aee96473d9"
    }
}

The proof request is one time use so that the information from the credential can be associated to a specific transaction event. However, the proof template can be used as many times as needed.

If there is a need to have a static QR code for multiple verification, a small service can be created to make proof requests from the verification template as and when needed.

6. Verify the Presentation

Scan the QR code from the proof presentation using your wallet to verify the credential.

Last updated