AttestoClient.Wallet.PresentationRequest (AttestoClient v2.3.1)

Copy Markdown View Source

Parse and verify an OID4VP Authorization Request the wallet receives (draft-ietf-oauth-openid4vp §5) - the holder-side mirror of Attesto.PresentationRequest.build/1.

The verifier's request arrives as a signed request object (JAR, RFC 9101): by value, in the deep link's request parameter, or by reference, in its request_uri parameter. Both forms are signed; only the transport differs

  • verify/3 handles the former, fetch/3 GETs the JWT (through AttestoClient.OAuthHTTP.get_text/2, so it is mockable the same way as the rest of this library) and then calls verify/3. Signature verification delegates entirely to Attesto.RequestObject.verify_with_claims/3, so trusted and opts behave exactly as there (e.g. :audience, :accepted_algs, :accepted_typ).

Only response_type=vp_token and response_mode=direct_post / direct_post.jwt are recognised (OID4VP §5, §8.2). direct_post.jwt parses successfully - the request is reported faithfully - but AttestoClient.Wallet.Presentation does not build a response for it yet (encrypted responses are a follow-up).

Summary

Functions

Fetch a by-reference request object from request_uri and verify it.

Verify a signed OID4VP Authorization Request object (a by-value request JWT) and return its parsed parameters.

Types

error()

@type error() ::
  :invalid_response_type
  | :invalid_response_mode
  | :invalid_client_id
  | :invalid_nonce
  | :invalid_response_uri
  | :invalid_dcql_query
  | :invalid_state
  | Attesto.RequestObject.verify_error()

t()

@type t() :: %AttestoClient.Wallet.PresentationRequest{
  client_id: String.t(),
  dcql_query: map(),
  nonce: String.t(),
  response_mode: String.t(),
  response_uri: String.t(),
  state: String.t() | nil
}

Functions

fetch(request_uri, trusted, opts \\ [])

@spec fetch(String.t(), map() | [map()], Attesto.RequestObject.verify_opts()) ::
  {:ok, t()} | {:error, term()}

Fetch a by-reference request object from request_uri and verify it.

Options are shared between the fetch (AttestoClient.OAuthHTTP.get_text/2

  • :req_options, :timeout) and the verification (verify/3 - trusted, RequestObject.verify_opts); each side reads only the options it recognises.

verify(jwt, trusted, opts \\ [])

@spec verify(String.t(), map() | [map()], Attesto.RequestObject.verify_opts()) ::
  {:ok, t()} | {:error, error()}

Verify a signed OID4VP Authorization Request object (a by-value request JWT) and return its parsed parameters.