Building an OpenID4VP verifier for EUDI wallets
An OpenID4VP verifier for EUDI wallets sends a signed request that names the claims it needs, receives an encrypted response, and checks each credential’s issuer signature, device binding and revocation status before trusting it. HAIP 1.0 fixes the choices: x509_hash client identification, JAR, direct_post.jwt or the Digital Credentials API, and SD-JWT VC or mdoc. This tutorial walks through each step.
The presentation flow
OpenID4VP 1.0 is the OpenID Foundation protocol a verifier uses to request credentials from a wallet. On its own it allows many options. HAIP 1.0, the high assurance profile that the EU implementing regulations select for EUDI wallets, narrows those options to one set every conformant wallet and verifier shares. This tutorial follows HAIP 1.0 and names the OpenID4VP sections each step depends on.
HAIP defines two transports. Section 5.1 covers presentation through redirects: the user scans a QR code or follows a link, the wallet fetches your request and posts its response to your server. Section 5.2 covers the W3C Digital Credentials API, where the browser passes the request to the wallet and returns the response to your page. The redirect flow is described first because it shows every moving part.
- Your backend
- Nexiel Verify
- User’s browser
- Wallet
- Your backend→Nexiel VerifyCreate a sessionPOST /v1/verify/sessions with checkType and an Idempotency-Key
- Nexiel Verify→Your backendSession id and authorization request URIopenid4vp://?client_id=x509_hash:...&request_uri=...
- User’s browser→WalletQR code or link opens the wallet
- Wallet→Nexiel VerifyFetch the signed request objectJAR, typ oauth-authz-req+jwt, x5c chain, DCQL query, verifier_info
- Wallet→Nexiel VerifyPost the encrypted responseresponse_mode direct_post.jwt: a JWE carrying the vp_token
- Nexiel Verify→WalletReply with a redirect_uriSame-device flows return the user to your page
- Nexiel Verify→Your backendDecisionverify.session.completed webhook, or GET /v1/verify/sessions/{id}
- Your backend decides which claims it needs and creates a session with a fresh
nonceandstate. - It shows the user an invocation link, as a QR code across devices or as a link on the same device.
- The wallet fetches the signed request object from
request_uri, validates your certificate chain and shows the user who is asking and for what. - The user approves. The wallet encrypts its response to the key in your request and posts it to
response_uri. - Your verifier decrypts the response, validates every credential and records the result.
Asking for claims with DCQL
A HAIP verifier asks for credentials with the Digital Credentials Query Language (DCQL), defined in OpenID4VP section 6. A DCQL query lists credential queries, each with an id, a format, format-specific meta and the claims it needs, addressed by path. Optional credential_sets say which combinations of credential queries satisfy the request.
The query below is the one Nexiel uses for an over-18 check. It offers three alternatives and the wallet answers exactly one. The EU age verification attestation in mdoc format discloses a single age_over_18 boolean. The two PID alternatives, in SD-JWT VC and mdoc form, disclose only the birth date, which is turned into a boolean and discarded.
{
"credentials": [
{
"id": "av_age_over_18",
"format": "mso_mdoc",
"meta": { "doctype_value": "eu.europa.ec.av.1" },
"claims": [{ "path": ["eu.europa.ec.av.1", "age_over_18"] }]
},
{
"id": "pid_birthdate",
"format": "dc+sd-jwt",
"meta": { "vct_values": ["urn:eudi:pid:1"] },
"claims": [{ "path": ["birthdate"] }]
},
{
"id": "pid_birthdate_mdoc",
"format": "mso_mdoc",
"meta": { "doctype_value": "eu.europa.ec.eudi.pid.1" },
"claims": [{ "path": ["eu.europa.ec.eudi.pid.1", "birth_date"] }]
}
],
"credential_sets": [
{
"options": [["av_age_over_18"], ["pid_birthdate"], ["pid_birthdate_mdoc"]],
"required": true
}
]
}Three details in this query are easy to get wrong. The SD-JWT VC PID type is urn:eudi:pid:1, and Member States may publish national types that extend it. Claim names differ by format: the SD-JWT VC claim birthdate is birth_date in the mdoc namespace eu.europa.ec.eudi.pid.1, and nationalities is nationality. And DCQL has no range or comparison operator, so a verifier cannot ask a PID for “over 18” directly.
Ask only for what you registered. eIDAS Article 5b(3) forbids a relying party from requesting data beyond what it registered for the intended use, and wallets compare your request with your registration certificate. Every claim you add is a claim the user sees and the wallet checks. See selective disclosure.
Identifying your verifier with x509_hash
OpenID4VP section 5.9.3 defines several client identifier prefixes. HAIP 1.0 requires the x509_hash prefix and states that the X.509 certificate signing the request must not be self-signed. The client identifier is x509_hash: followed by the base64url-encoded SHA-256 hash of the DER-encoded leaf certificate, and the request object carries that certificate in its x5c header.
In the EU wallet ecosystem that leaf certificate is your wallet-relying party access certificate (WRPAC), issued by an access certificate authority your Member State authorizes. The amended implementing regulations also require one element of the verifier_info request parameter to carry your registration certificate (WRPRC), which states the intended use and the attributes registered for it. Wallets must validate registration certificates from 11 August 2028, and verifiers must send them now.
openid4vp://?client_id=x509_hash%3A<base64url SHA-256 of your access certificate>
&request_uri=https%3A%2F%2Fcompliance.nexiel.io%2F...%2Frequest
&request_uri_method=postThe certificates come out of registration, not out of code. The relying party registration guide explains how to obtain them, in your own name or through an intermediary.
Signed request objects with JAR
HAIP section 5.1 requires signed authorization requests using JWT-Secured Authorization Requests (JAR, RFC 9101). The invocation link carries only client_id and request_uri. The wallet fetches the request object from request_uri, and with request_uri_method=post it may post its own metadata and a wallet_nonce that the request object then echoes.
// JOSE header
{
"alg": "ES256",
"typ": "oauth-authz-req+jwt",
"x5c": ["<access certificate>", "<intermediate CA certificate>"]
}
// Payload (shortened)
{
"client_id": "x509_hash:<base64url SHA-256 of the access certificate>",
"response_type": "vp_token",
"response_mode": "direct_post.jwt",
"response_uri": "https://compliance.nexiel.io/v1/verify/sessions/<id>/responses",
"nonce": "<fresh random value>",
"state": "<fresh random value>",
"dcql_query": { "credentials": ["..."] },
"client_metadata": {
"jwks": { "keys": [{ "kty": "EC", "crv": "P-256", "use": "enc", "alg": "ECDH-ES", "kid": "<one-time key id>", "x": "...", "y": "..." }] },
"encrypted_response_enc_values_supported": ["A128GCM", "A256GCM"],
"vp_formats_supported": { "dc+sd-jwt": { "...": "..." }, "mso_mdoc": { "...": "..." } }
},
"verifier_info": [{ "format": "registration_cert", "data": "<registration certificate JWT>" }]
}- Set the JOSE header
typtooauth-authz-req+jwtand sign with ES256, the algorithm HAIP requires everyone to support. - Put the leaf certificate and any intermediates in
x5c, and leave out the trust anchor. - Generate a fresh
nonceandstatefor every session, store them server side and bind them to the session. - Serve each request object a limited number of times and for a short period, so a leaked
request_uricannot be reused indefinitely.
Encrypted responses with direct_post.jwt
HAIP section 5.1 also requires response encryption with the direct_post.jwt response mode, defined in OpenID4VP section 8.3.1. Instead of posting the vp_token in clear, the wallet posts a single response parameter holding a JWE encrypted to a key you placed in client_metadata.jwks. HAIP requires verifiers to support the content encryption algorithms A128GCM and A256GCM and to list both in encrypted_response_enc_values_supported, with ECDH-ES key agreement on P-256.
Use a fresh key pair for each request and delete the private key once the response is decrypted. A verifier that also accepts a plain vp_token on the same endpoint can be downgraded by an attacker, so refuse unencrypted responses for HAIP sessions. Once decrypted, the payload carries the vp_token, keyed by the credential query id from your DCQL query, and the state you sent.
{
"vp_token": {
"pid_birthdate": ["<issuer-signed JWT>~<disclosure>~<KB-JWT>"]
},
"state": "<the state you sent>"
}Check the state against the session, and treat any response that arrives after the session has completed, failed or expired as an error. OpenID4VP section 14.1 explains how the nonce and audience binding prevent a presentation from being replayed to a different verifier.
Validating an SD-JWT VC presentation
An SD-JWT VC presentation is an issuer-signed JWT, the disclosures the holder chose to reveal, and a key binding JWT (KB-JWT), joined with tildes. Selective disclosure is defined in RFC 9901, and the SD-JWT VC type, including vct, in the IETF SD-JWT VC draft. HAIP section 6.1 adds that a KB-JWT must always be present when the credential has holder binding, and that the status claim, when present, must contain status_list.
- Resolve the issuer key from the
x5cchain in the issuer-signed JWT header and validate the chain to a trust anchor from the relevant EU list. A PID chains to the PID provider list of trusted entities (LoTE). - Verify the issuer signature, the
vctyou asked for, and thenbfandexpvalidity window. - Hash each disclosure and confirm the digest appears in the
_sdarray of the signed payload, so no claim was added or altered. - Verify the KB-JWT with the key in the credential’s
cnfclaim. Itsaudmust equal your full client identifier including thex509_hash:prefix, itsnoncemust equal your request nonce, itsiatmust be recent and not in the future, and itssd_hashmust match the presentation it is attached to. - Check revocation through the status list the credential points to.
- Confirm the disclosed claims match your DCQL query and that nothing you did not request is relied on.
Validating an mdoc presentation
An mdoc presentation follows ISO/IEC 18013-5, with the OpenID4VP binding in Appendix B.2. The wallet returns a CBOR DeviceResponse. Each document carries issuer-signed data, protected by the Mobile Security Object (MSO), and device-signed data that proves possession of the device key.
- Validate the issuer certificate in the MSO signature against the trust anchor for that document type, and verify the signature.
- Hash each returned data element with its random salt and compare it with the digest in the MSO, so a disclosed value cannot be swapped.
- Check the MSO validity period and the document type, such as
eu.europa.ec.eudi.pid.1for the PID oreu.europa.ec.av.1for the age verification attestation. - Rebuild the session transcript with the OpenID4VP handover structure from Appendix B.2. It binds the device signature to your client identifier, the nonce, the response URI and, for an encrypted response, the thumbprint of your encryption key. Verify the device signature over it with the device key in the MSO.
- Check revocation through the status mechanism the MSO references.
The amended implementing regulations prohibit ISO/IEC 18013-5 server retrieval for every party, so a verifier never fetches mdoc data from the issuer directly.
Trust anchors, status lists and revocation
Signature checks need trust anchors. ARF 3.0.0 asks relying parties to support both trusted lists under ETSI TS 119 612 and lists of trusted entities under ETSI TS 119 602, to download the latest version of each applicable list regularly, and to remove anchors that are no longer valid. Qualified attestations (QEAA) are validated against national trusted lists, and PIDs against the PID provider LoTE.
Revocation uses the IETF Token Status List, an Internet-Draft that the implementing regulations pin at a specific version. A status list is a compressed bit string, signed by its issuer, where each credential owns one index. ARF requirement VCR_15 recommends downloading status lists out of band and caching them rather than fetching one during each presentation, because a per-presentation fetch tells the issuer when and where a credential was used.
- Cache each list for no longer than its stated lifetime and refresh it in the background.
- Decide in advance what happens when a list cannot be fetched. For identity and AML checks, failing closed is the safer choice.
- Record the list version and trust anchor each decision used, so the decision can be explained later.
Same-device returns and the Digital Credentials API
When the wallet runs on the same phone as your web page, HAIP section 5.1 requires the verifier to include a redirect_uri in its HTTP response to the wallet’s post, and to reject the presentation if the wallet does not follow the redirect back. The redirect carries a one-time response_code. Your page sends that code back to your backend, and only then is the decision released. This stops a response posted from one device from completing a session someone else started.
The Digital Credentials API is a W3C Working Draft. A page calls navigator.credentials.get() with a digital member that lists one or more requests, each tagged with a protocol identifier such as openid4vp-v1-signed or org-iso-mdoc. The browser and operating system find a wallet, on the same device or on a nearby phone, and return the response to the page. HAIP section 5.2 requires the dc_api.jwt response mode for this transport, and ISO/IEC 18013-7 Annex C defines the mdoc equivalent. OpenID4VP Appendix A covers the binding.
The implementing rules say wallets should not support redirect-based flows across devices, because those flows are open to attacks such as session fixation, and ARF OIA_08d requires a relying party that still uses them to apply adequate mitigations. For a user on a desktop browser, plan for the Digital Credentials API from the start. The Nexiel widget prefers it and offers the QR code as a labelled fallback.
Testing your verifier
The OpenID Foundation publishes conformance test plans for OpenID4VP with HAIP, and verifiers can run them before applying for certification. The plans cover the redirect flow with SD-JWT VC and mdoc credentials. There is no verifier test plan for the Digital Credentials API yet, so that path needs testing against real browsers and wallets.
- Run the OpenID Foundation verifier test plans for every credential format you accept.
- Test against the EU reference wallet and any national wallets your users hold, and record the date and version of each test.
- Test the failure paths: a wrong nonce, an expired KB-JWT, a revoked credential, a plain response where an encrypted one is required, and a same-device response with no redirect return.
Or use Nexiel Verify
Nexiel Verify implements every step above as a hosted service built to HAIP 1.0, for the redirect flow and the Digital Credentials API, with SD-JWT VC and mdoc credentials. It builds and signs the request under your access certificate, serves the request object, holds the one-time decryption key, validates signatures, device binding and status against the EU lists, and returns a decision. Nexiel publishes the OpenID Foundation suite results it ran itself on its interop page. It is not certified by the OpenID Foundation.
Test keys need no account and take about 30 seconds, and the hosted sandbox wallet answers test sessions with synthetic credentials. Start with the quickstart. Live wallet checks require your registered relying party identity and the EU trusted lists for the credentials you accept, and fail closed until each exists. Install the TypeScript or Python SDK:
npm install @nexiel/sdkimport { Nexiel } from '@nexiel/sdk';
const nexiel = new Nexiel({
verify: {
clientId: process.env.NEXIEL_CLIENT_ID!,
clientSecret: process.env.NEXIEL_CLIENT_SECRET!,
},
});
// Nexiel builds and signs the request, serves it at request_uri,
// decrypts the response and checks every signature and status.
const session = await nexiel.verify.initiateSession({
clientId: 'my-app',
checkType: 'age-verification',
});
// Show session.authorizationRequestUri as a QR code, then:
const done = await nexiel.verify.waitForSessionCompletion(session.sessionId);
if (done.status === 'completed') console.log(done.decision);For a Digital Credentials API session, create it from your backend with the dc_api flow and your page origin, then complete it from the page with the session token. The browser never holds your API key.
import { NexielVerifyClient } from '@nexiel/sdk';
// Your backend created the session with flow: 'dc_api' and the page origin,
// and passed session.sessionId, session.sessionToken and
// session.dcApi.requests to this page.
const credential = await navigator.credentials.get({
digital: { requests: dcApiRequests },
});
// The browser client holds no API key: the session token authorizes
// this one call for this one session.
const browserVerify = new NexielVerifyClient();
await browserVerify.completeDcApiResponse(
sessionId,
{ protocol: credential.protocol, data: credential.data },
{ sessionToken },
);pip install nexiel-sdkimport os
from nexiel_sdk import Nexiel
nexiel = Nexiel(
verify={
"client_id": os.environ["NEXIEL_CLIENT_ID"],
"client_secret": os.environ["NEXIEL_CLIENT_SECRET"],
},
)
session = nexiel.verify.initiate_session(client_id="my-app", check_type="aml-identity")
# Show session.authorization_request_uri as a QR code, then:
done = nexiel.verify.wait_for_session_completion(session.session_id)
if str(done.status) == "completed":
print(done.decision)In production, prefer the verify.session.completed webhook to polling. The verification sessions docs describe every flow and status, and credentials, signatures and revocation lists the formats and algorithms Nexiel accepts.
Frequently asked questions
- Which client identifier prefix must an EUDI wallet verifier use?
- HAIP 1.0 requires the
x509_hashprefix, and the certificate signing the request must not be self-signed. In the EU ecosystem the leaf certificate is your access certificate from an authorized access certificate authority. - Can a verifier accept unencrypted responses?
- Not under HAIP 1.0. The redirect flow requires the
direct_post.jwtresponse mode, and the Digital Credentials API flow requiresdc_api.jwt. Plaindirect_postis valid OpenID4VP 1.0, but it does not meet the profile EUDI wallets use. - Does DCQL let me ask whether someone is over 18?
- DCQL selects credentials and claims. It has no range or comparison operators. To learn whether a person is over 18 you request the age verification attestation’s
age_over_18claim, or the PID birth date and compute the answer yourself. - Do I need to check revocation?
- The EU texts make revocation checking optional for relying parties, and ARF requirement VCR_13 asks a relying party that does not check to carry out a risk analysis. For identity, AML and payment checks, checking status is the expected practice.
- Is the Digital Credentials API required?
- The ARF requires wallets to support both the Digital Credentials API and redirect-based presentation, and the implementing rules say wallets should not support redirect flows across devices. A verifier that serves desktop users should offer the Digital Credentials API path.
- Is Nexiel Verify certified by the OpenID Foundation?
- No. Nexiel Verify is built to HAIP 1.0, and Nexiel publishes the OpenID Foundation suite results it ran itself on the interop page. The foundation has no verifier test plan for the Digital Credentials API yet.
Sources
- OpenID Foundation, OpenID for Verifiable Presentations 1.0 (Final, 9 July 2025)
- OpenID Foundation, OpenID4VC High Assurance Interoperability Profile 1.0 (Final, 24 December 2025)
- RFC 9101, JWT-Secured Authorization Request (JAR)
- RFC 9901, Selective Disclosure for JSON Web Tokens
- IETF, SD-JWT-based Verifiable Credentials (Internet-Draft)
- IETF, Token Status List (Internet-Draft)
- W3C, Digital Credentials (Working Draft)
- Commission Implementing Regulation (EU) 2026/1731, amending the wallet implementing regulations
- EUDI Wallet Architecture and Reference Framework 3.0.0, Annex 2.02 high-level requirements
- EU reference implementation, verifier endpoint
- OpenID Foundation, OpenID4VP and OpenID4VCI conformance tests open for self-certification
Related
Run the flow in test mode
Test keys take about 30 seconds and need no account. The sandbox wallet answers test sessions with synthetic credentials.