Verify Credentials with OpenID4VP
Verifiers, also known as Relying Parties (RP), validate the authenticity of the credentials that holders present to them. Using the OpenID for Verifiable Presentations (OpenID4VP) protocol, verifiers can request, receive and assess verifiable credentials in a secure and standardised manner. This guide outlines the process for verifiers to follow:
- Define the specific credentials or claims they require through a presentation definition.
- Initiate a verification request to holders, often facilitated via QR codes or direct links.
- Receive and validate the verifiable presentation returned by the holder's wallet, ensuring the data's integrity and authenticity.
By following the steps below, verifiers can request digital credentials and verify them, fostering trust in digital interactions.
Step 1: Get the API Key
To obtain your API key, sign in to the dashboard and go to Account > Developer APIs > Create API Key (see Get API Keys). Once you have your API key, enter it in the field below and click the Set API Key button to save it for future use.
x509 key of your organisation: a key with a certificate chain. After you set the API key, the page fills in such a key. To choose another key, click the key label next to a signing key field in a request, for example cryptographicKeyIdentifier. To create a key, attach a certificate or see your keys, follow the key management guide. To add your certificate to the NXD trust list, see trust list registration.Step 2: Create Presentation Definition (Verifier Admin)
To create a presentation definition for requesting proof, you can run the code block below using the Run button. Alternatively, you can manually copy the code block and use it in the body of the API request provided here.
Request
Response
presentationDefinitionId can be reused to verify multiple credentials (Step 3). The label must be unique in your organisation: a second run with the same label gets 400 with the description Presentation definition with usage purpose: <label> exists for organisation. Change the label, or reuse the presentationDefinitionId of the first run.Step 3: Create Verification Request (Verifier/Relying Party)
When you run Step 2 on this page, the presentationDefinitionId field below is autofilled automatically (and updated whenever Step 2 is re-run). If you are executing the APIs yourself, replace <presentationDefinitionId> with the ID obtained in Step 2. To create the verification request, execute the code block below using the Run button. Alternatively, you can manually copy the code block and use it in the body of the API request available here. In that case, generate the QR code from verificationHistory.requestUrl in the response (the Authorization Request URL) with a QR code generator tool, or paste the response into our tool here.
After receiving the response, toggle the button provided to dynamically generate a QR code. The EUDI Wallet/Holder can then answer the verification request using the Data Wallet (or any other EU Digital Identity Wallet) by either scanning the QR code or directly accessing the verification request on their mobile device, such as via a browser.
Request
Response
The presentation definition holds a Digital Credentials Query Language (DCQL) query (OpenID4VP 1.0), and the request is signed with an X.509 key: cryptographicKeyFormat is x509, and the server uses x509_hash as the client ID scheme when the body has no clientIdScheme.
Start with the DCQL overview, then work through a runnable, step-by-step tutorial for your scenario:
- Trusted Authorities - restrict a credential to trusted issuers
- Claim Sets (Selective Disclosure) - age verification with minimal disclosure
- Credential Sets (Alternatives) - accept any one of several identity credentials
- Combined Credential Sets - KYC with Photo ID plus address proof
- Mandatory and Optional Sets - student transport pass with optional extras
- Multiple Credential Instances - request several recent bank statements
- Values Constraint - accept a credential only for allowed postal codes
Step 4: Send and Receive Verifiable Presentation (Holder)
The holder wallet consents to send the requested credentials.
Step 5: Send and Receive Verifiable Presentation (Verifier/Relying Party)
- The verifier (relying party) receives the requested credentials. Read them with the Read Verification API. In the response,
verificationHistory.isVerifiedholds the result,verificationHistory.presentationholds the disclosed claims of each credential, andverificationHistory.presentationValidityholds the result of each check. verificationHistory.vpTokenis an array with one text: the JSON of the VP Token,{"<credential query id>": ["<presentation>"]}. From an SD-JWT VC or an mdoc, the verifier keeps only the claims that the query asks for. Parse the text, then decode each SD-JWT or JWT presentation with the JWT Decoder.
The holder wallet checks whether the verifier can be matched against a recognised trust list. If the verifier cannot be matched, the Data Wallet shows a "Service provider not verified" warning.
Your verifier checks the issuer of each presented credential. In your verification record, presentationValidity[].<credential query id>.credentialSignerTrustedListCheck holds the trust result for the issuer (for a query with "multiple": true, each credential in credentials[] has its own). For its members, see Trust Check Results. This check runs only when you switch on requiresTrustedCredentialSigner in credentialQueryOptions.<credential query id> of the presentation definition, and it then uses only the trust anchors that you list in acceptedCredentialSigners (see Trust When Verifying). An issuer that is not trusted gives the error PRES_CREDENTIAL_SIGNER_NOT_TRUSTED. With the switch off, no check runs: result is not_applicable and reason.code is not_required. See The "Service provider not verified" notice and Trust in the Wallet Ecosystem.
Try It Yourself (With Demo Video)
Watch the below demo to learn verify credential API and try it out yourselves:
OpenID4VP Verification Demo: Learn how to send and verify credentials using OpenID4VP protocol with iGrant.io Digital Wallets.