# `Attesto.CredentialRequest`
[🔗](https://github.com/XukuLLC/attesto/blob/v2.1.0/lib/attesto/credential_request.ex#L1)

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.

# `parsed`

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

# `proof`

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

# `selector`

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

# `parse`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
