OpenId4VciClient
Client service to retrieve credentials using OID4VCI
Implemented from OpenID for Verifiable Credential Issuance 1.0 from 2025-09-16.
Constructors
Types
What JwtProofCreator and AttestationProofCreator pass to their loadKeyAttestation, to load a key attestation (OpenID4VCI 1.0, Appendix D) that the credential issuer accepts for the requested credential.
Prepared credential request from prepareCredentialRequests, to be put one-by-one into createCredential after fetching the client nonce
Functions
Build authorization details for use in OAuth2Client.createAuthRequest.
Creates the credential request for exactly one credential, to be sent to the credential issuer. Send it with OpenId4VciProtocolClient.credentialRequest, which adds the access token and, for DPoP-bound tokens, the DPoP proof, and parses the response.
Creates the credential request for request, prepared with prepareCredentialRequests, with a proof for its PreparedCredentialRequest.credentialFormat (see ProofCreator) and, if the credential issuer supports it, the encryption of request and response (OpenID4VCI 1.0, 10). Create it right before sending it with OpenId4VciProtocolClient.credentialRequest, each with a fresh clientNonce, as the credential issuer decides how long a c_nonce can be used (13.8), and may accept each one only once.
Creates the credential request to be sent to the credential issuer. Send each request with OpenId4VciProtocolClient.credentialRequest, which adds the access token from tokenResponse and, for DPoP-bound tokens, the DPoP proof, and parses the response.
Decodes response received from the credential issuer for request into one ReceivedCredential per credential, encoded in representation, also for one that can not be decoded, so that no member of a batch goes unnoticed. Validates nothing: prepare the storage of each one with ReceivedCredential.prepareCredentialStorage, which validates it with the holder's key and validator.
Decodes response received from the credential issuer like decodeCredentialResponse, reading it as a compact JWE if isEncrypted, i.e. if its media type is application/jwt.
Parses input as either a JSON-encoded CredentialOffer or a credential offer URL.
Parses response received from the credential issuer, mapping to Holder.StoreCredentialInput, rejecting encrypted responses because they require the originating CredentialRequest.
Parses a response and binds its encryption to the exact request that caused it.
Prepares one credential request per entry of credentialConfigurationIds, each with its configuration from IssuerMetadata.supportedCredentialConfigurations of metadata, still without proofs and encryption, see createCredential.
Prepares the credential requests the access token of tokenResponse grants for all its credentials, each with the configuration its proof and response depend on, still without proofs and encryption. Create each request with its own c_nonce right before sending it with OpenId4VciProtocolClient.credentialRequest, which adds the access token from tokenResponse and, for DPoP-bound tokens, the DPoP proof, and parses the response.
Prepares the credential requests the access token of tokenResponse grants for the credentials of credentialFormats, each with the configuration its proof and response depend on, still without proofs and encryption. Create each request with its own c_nonce right before sending it with OpenId4VciProtocolClient.credentialRequest, which adds the access token from tokenResponse and, for DPoP-bound tokens, the DPoP proof, and parses the response.
Extract SupportedCredentialFormat from metadata by filtering according to requestOptions.