Request Credentials Issued to Affinidi Vault Users

Request the credentials issued from your application and claimed by the user on their Affinidi Vault.

To request the credentials you just issued to the Affinidi Vault user, we will also use the Presentation Definition to query and ask for the user’s consent to share data.

Let’s take the Credential Issuance Configuration we configured previously to do this.

In the Credential Issuance configuration, we have added the UniversityDegree2024 as a supported schema. We are using this schema to create a Credential Offer that is accepted and stored in the user’s Affinidi Vault.

Create Credential Issuance

After creating the Credential Offer and the Affinidi Vault user accepting the credential, we can request the issued credential using the following Presentation Definition.


{
  "id": "university_degree",
  "input_descriptors": [
    {
      "id": "university_degree",
      "name": "UniversityDegree VC",
      "purpose": "Check if Vault contains the required VC.",
      "constraints": {
        "fields": [
          {
            "path": [
              "$.type"
            ],
            "purpose": "Check if VC type is correct",
            "filter": {
              "type": "array",
              "contains": {
                "type": "string",
                "pattern": "^UniversityDegree2024$"
              }
            }
          }
        ]
      }
    }
  ]
}

In the above Presentation Definition, we are querying the credentials issued to the user with the type UniversityDegree2024, the same Credential Type ID we configured in the Credential Issuance Configuration.