# `AttestoClient.Wallet.Proof`
[🔗](https://github.com/XukuLLC/attesto_client/blob/v2.26.0/lib/attesto_client/wallet/proof.ex#L1)

Build the OID4VCI holder key proof of possession
(`OpenID4VCI 1.0`, 2025-09-16, §8.2.1.1), the wallet-side mirror of
`Attesto.CredentialProof.verify_jwt/2`.

A proof is a JWT, typed `openid4vci-proof+jwt`, whose header carries the
holder's *public* key (as `jwk`) and whose payload proves the wallet holds
the matching private key at request time:

  * `aud` - the Credential Issuer Identifier (`:credential_issuer`).
  * `iat` - issuance time.
  * `nonce` - the `c_nonce` the issuer previously handed out, when it did.
  * `iss` - the `client_id`, required for the authorization_code flow.

Signing and key-bound `:alg`/`:kid` validation behave as in
`AttestoClient.RequestObject` / `AttestoClient.ClientAssertion` (shared
`AttestoClient.Builder` internals).

# `build_opt`

```elixir
@type build_opt() ::
  {:credential_issuer, String.t()}
  | {:nonce, String.t()}
  | {:client_id, String.t()}
  | {:key_attestation, String.t()}
  | {:alg, String.t()}
  | {:kid, String.t()}
  | {:now, integer()}
```

# `error`

```elixir
@type error() ::
  :invalid_key
  | :invalid_credential_issuer
  | :invalid_nonce
  | :invalid_client_id
  | :invalid_key_attestation
  | :invalid_kid
  | :invalid_time
  | :unsupported_alg
  | :unsupported_key
  | {:signing_failed, String.t()}
```

# `jwk`

```elixir
@type jwk() :: JOSE.JWK.t() | map()
```

# `build`

```elixir
@spec build(jwk(), [build_opt()]) :: {:ok, String.t()} | {:error, error()}
```

Build a signed holder key proof, returning `{:ok, compact_jws}` or
`{:error, reason}`. Fails fast on invalid input (see the error type).

`jwk` is the holder's key (private half required for signing). Required
option: `:credential_issuer` (the proof's `aud`). Pass `:nonce` with the
issuer's `c_nonce` when it supplied one, and `:client_id` for the
authorization_code flow (becomes `iss`); `:alg`, `:kid`, and `:now` behave
as in `AttestoClient.RequestObject.build/2`. Pass `:key_attestation` (a
compact JWT from `AttestoClient.KeyAttestation.build/2`) to carry it in the
proof's `key_attestation` header, vouching that this key is securely stored.

---

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