Issuance with OpenID4VCI
We’ve implemented issuance with OpenID4VCI 1.0 following the High Assurance Interoperability Profile (HAIP), with attestation preview as a custom addition. OpenID4VCI defines two grant flows and we use both across our two issuance implementations.
We currently have two issuance implementations: the pid_issuer, a specialized
issuer specifically for Dutch PIDs, which this page is about, and
issuance_server, a disclosure-based-issuance service that can issue all kinds
of things (which you can read about here). The pid_issuer uses the
authorization code flow described below; the issuance_server uses the
pre-authorized code flow.
PID issuance
The NL Wallet requires at least the SD JWT format for PID attestations. The MSO
mDoc format can be issued as well. The attestation type and paths to the login
claim and the recovery_code are dynamically configured. See the
pid_attributes field in the wallet-config.json for details.
In the pid_issuer, the Authorization Server and Credential Issuer roles are
combined: the wallet talks to a single PID Issuer, which hosts its own /par,
/authorize, /token, /nonce and /credential endpoints.
The PID Issuer is a simple OAuth 2.0 Authorization Code Flow issuer that
follows the HAIP exchange described above.
Timeouts and expiry
Issuance spans several hops — an out-of-band offer, one or two OAuth round-trips, and a multi-step issuance phase — and each hop is bounded by its own, independent clock. Where a timeout becomes visible, and whether it can be surfaced to the wallet at all, depends on which clock expired and which flow is in play.
The clocks
Clock |
Flow |
Default |
Where set |
Bounds |
|---|---|---|---|---|
PAR entry TTL |
auth-code |
60 s |
|
time between |
State-bridge entry TTL |
auth-code |
30 min |
|
the whole user-agent round-trip for the login or consent page |
State-bridge delete leeway |
auth-code |
24 h |
|
extra grace after the TTL in which an expired entry stays recoverable |
Issuance session inactivity |
both |
30 min |
|
inactivity between |
The issuance session also has deletion timeouts (successful_deletion, 5 min;
failed_deletion, 4 h) that govern cleanup after the session is done or
expired, mirroring the state bridge’s split between expiration and deletion.
Where an expiry surfaces
The decisive question is whether the expiry is hit on a wallet→issuer API
call (which can carry a structured error back to the wallet) or during a
front-channel browser redirect (where the only way back to the wallet is the
redirect_uri, which may no longer be recoverable).
Failure mode |
Hit on |
Wire signal |
Wallet result |
|---|---|---|---|
Pre-authorized code reused / session gone |
|
|
“QR code no longer valid” screen |
Issuance session expired mid-issuance |
|
|
“session expired” screen |
State-bridge entry expired, within leeway |
browser |
OAuth |
redirect-uri error |
State-bridge entry deleted (after leeway) |
browser |
plain-text 400 |
dead-end — nothing reaches wallet |
Pre-authorized code, reused or expired (
issuance_server). The wallet POSTs the code to/tokenbut the session is gone or alreadyDone. This maps to the spec’sinvalid_grant; the wallet recognises a pre-authorizedinvalid_grantand shows a “QR code no longer valid” screen. It is a plain API call, so the error reaches the wallet cleanly.Issuance session expired mid-issuance (both flows). The holder dwells on a preview or the PIN screen past the inactivity timeout and the session is cleaned up. The next
/credentialcall presents an access token whose session no longer exists, which maps toinvalid_token; the wallet shows a “session expired” screen. Also an API call, so it surfaces cleanly.Auth-code browser dead-end (both
pid_issuerandacf_demo_issuer). During the front-channel round-trip — login page for the PID issuer, the local consent page for the acf-demo issuer — the state-bridge entry expires. The callback then arrives carrying only the opaquestate(the bridge key); the wallet’sredirect_urilived solely inside that entry. Two sub-cases:Within the delete leeway, the entry is expired-but-still-present, so the callback recovers the
redirect_uriand redirects the browser back to the wallet with an OAuth error (invalid_request). The wallet surfaces this as a redirect-uri error rather than a dead-end. This is exactly what the leeway buys.After the leeway, the entry has been deleted, nothing links back to the wallet, and the callback dead-ends as a plain-text
400in the browser.
Relating the clocks
The delete leeway is deliberately far longer than the TTL (24 h vs 30 min), so a user who steps away mid-flow and returns much later still gets a graceful error redirect instead of a dead-end. The bridge entry holds no personal data (only the wallet’s
redirect_uri,stateand PKCE challenge), so retaining it that long is cheap.
Key generation and usage during issuance
Wallet App
The wallet uses the Wallet Backend to generate attestation private keys and sign
the issuer’s nonce with them. It does this by sending a PerformIssuance
instruction, which returns one Proof of
Possession (PoP) per generated key by signing the c_nonce from the issuer.
For PID issuance, a WIA is additionally required. The wallet sends an
IssueWia instruction, which returns a
fresh WIA (signed with the WB’s certificate chain) together with a disclosure
PoP that binds the WIA to the current request.
The following sequence diagram depicts how this happens.
sequenceDiagram
%% Force ordering by explicitly setting up participants
participant wallet as Wallet Core (App)
participant wallet_provider as Wallet Backend
participant hsm as WB HSM
participant db as WB Database
wallet->>+wallet_provider: instruction: perform_issuance(c_nonce, key_count)
wallet_provider ->>+ hsm: generateECDSAPrivateKeys(key_count)
hsm ->> hsm: generate ECDSA private keys<br/>encrypt each private key with attestationWrappingKey
hsm -->>- wallet_provider: encryptedECDSAPrivateKeys, ECDSAPublicKeys
wallet_provider ->>+ db : storeAttestationKeys(encryptedAttestationPrivateKeys, attestationPublicKeys)
db -->>- wallet_provider: OK
loop for every encryptedAttestationPrivateKey
wallet_provider ->>+ hsm: sign(encryptedAttestationPrivateKey, c_nonce)
hsm ->> hsm: Decrypt encryptedAttestationPrivateKey with attestationWrappingKey<br/>sign c_nonce with decrypted key
hsm -->>- wallet_provider: PoP
end
wallet_provider-->>-wallet: instruction response: keyIdentifiers, PoPs
opt WIA required (PID issuance)
wallet->>+wallet_provider: instruction: issue_wia(nonce, aud)
wallet_provider ->>+ hsm: generateECDSAPrivateKey()
hsm ->> hsm: generate WIA signing key<br/>encrypt with attestationWrappingKey
hsm -->>- wallet_provider: encryptedWIAPrivateKey, WIAPublicKey
wallet_provider ->> wallet_provider: buildWIAContent(walletMetadata, statusClaim)
wallet_provider ->>+ hsm: sign WIA content with wiaSigningKey (x5c)
hsm -->>- wallet_provider: WIA JWT
wallet_provider ->>+ hsm: sign disclosure PoP with wiaSigningKey
hsm -->>- wallet_provider: disclosure PoP
wallet_provider ->>+ db: storeWIAKey(encryptedWIAPrivateKey)
db -->>- wallet_provider: OK
wallet_provider-->>-wallet: instruction response: WiaDisclosure (WIA JWT + disclosure PoP)
end