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 Membership as a supported schema. We use 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 having the user accept it to store on their Affinidi Vault, we can request the issued credential using the Affinidi Iota Framework and define the following Presentation Definition in its configuration.


{
  "id": "membership_vc",
  "input_descriptors": [
    {
      "id": "membership_vc",
      "name": "Membership 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": "^Membership$"
              }
            }
          }
        ]
      }
    }
  ]
}

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