Attesto.CredentialRequest (Attesto v1.14.0)

Copy Markdown View Source

OID4VCI Credential Request (draft-ietf-oauth-openid4vci §8.2).

Parse and validate the decoded JSON object a wallet posts to a credential endpoint. This module is pure and conn-free; proof verification and credential issuance are the caller's concern.

Summary

Functions

Parse an OID4VCI Credential Request.

Types

parsed()

@type parsed() :: %{
  selector: selector(),
  proofs: [proof()],
  response_encryption: map() | nil
}

proof()

@type proof() :: {String.t(), term()}

selector()

@type selector() ::
  {:configuration_id, String.t()} | {:credential_identifier, String.t()}

Functions

parse(request, opts \\ [])

@spec parse(
  map(),
  keyword()
) :: {:ok, parsed()} | {:error, atom()}

Parse an OID4VCI Credential Request.

Credential selectors are required, while proofs are optional at parse time. Single and batch proofs are returned as one flat list for uniform handling by the caller.

:max_proofs (default 50) bounds the total number of proofs; a request exceeding it is rejected with {:error, :too_many_proofs} before the caller verifies any signature.