Oid4vpClient class

OpenID4VP holder client: fetch a request, match it against held credentials, build the vp_token, and submit it.

Constructors

Oid4vpClient(Oid4vcHttp _http, {Clock now = systemClock})

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

buildVpToken({required SdJwtVc credential, required Iterable<String> revealClaims, required PresentationRequest req, required Es256Signer signer}) Future<String>
Builds the vp_token: discloses revealClaims, computes sd_hash, and signs the KB-JWT bound to the request's client_id/nonce.
buildVpTokenMap({required List<CredentialMatch> matches, required PresentationRequest req, required Es256Signer signer}) Future<Map<String, List<String>>>
Builds the vp_token in the OpenID4VP 1.0-final DCQL shape: a map from each matched query id to a one-element array holding that credential's presentation (SD-JWT …~<kb-jwt>). This is the shape both direct_post and direct_post.jwt carry in 1.0-final; hand it to submitResponse.
buildVpTokenObject({required List<CredentialMatch> matches, required PresentationRequest req, required Es256Signer signer}) Future<String>
Builds a multi-credential vp_token: a JSON object mapping each matched DCQL query id to its presentation. Use this instead of buildVpToken when the request asks for more than one credential; the result is a string ready to hand to submit.
fetchRequest(String authzRequestUriOrJar) Future<PresentationRequest>
Resolves an authorization request from a deep link, an inline request, or a request_uri reference (handling request_uri_method=post), and parses it into a PresentationRequest.
match(PresentationRequest req, List<SdJwtVc> held) CredentialMatch?
Picks the first held credential that satisfies a query in req, or null if none do. Matches on vct and on whether the requested claims are available; an empty claim set means "reveal the whole credential". For a request that asks for several credentials at once, use matchAll.
matchAll(PresentationRequest req, List<SdJwtVc> held) List<CredentialMatch>
One CredentialMatch per credential query in req that some held credential satisfies — the multi-credential counterpart of match. Pair it with satisfiesRequest to honour the request's credential_sets, then buildVpTokenObject to present them all.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseRequest(String requestObjectJwt) PresentationRequest
Parses an already-obtained Request Object JWT (JAR) without fetching. The signature is not verified here, but it is captured on PresentationRequest.signature so the wallet can authenticate the verifier.
present({required PresentationRequest req, required CredentialMatch match, required Es256Signer signer}) Future<String?>
One-call presentation of a single match: build its KB-JWT-bound presentation, assemble the 1.0-final vp_token, and submit it in whatever response_mode the request asked for (encrypting for direct_post.jwt). Returns the verifier's redirect_uri, if any.
satisfiesRequest(PresentationRequest req, List<CredentialMatch> matches) bool
Whether matches satisfy req: every required credential_sets entry has at least one fully-matched option, or — when the request states no sets — every listed credential is matched.
submit({required PresentationRequest req, required String vpToken}) Future<String?>
Submits the vp_token to the verifier's response_uri (direct_post). Returns the redirect_uri the verifier sends back, if any.
submitResponse({required PresentationRequest req, required Map<String, List<String>> vpToken}) Future<String?>
Submits a 1.0-final vpToken to the verifier's response_uri, honouring response_mode:
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited