# `AttestoPhoenix.DPoP.Adapter`
[🔗](https://github.com/XukuLLC/attesto_phoenix/blob/v5.0.0/lib/attesto_phoenix/dpop_adapter.ex#L1)

Resolve the callback and option boundary between `AttestoPhoenix.Config` and
`Attesto.DPoP`.

The adapter deliberately stops at option construction. It never verifies a
proof and never records a replay identity. Callers choose whether
`:replay_check` is included because token-endpoint sender constraints must
defer that check until the grant has validated, while PAR and device
authorization verify their proof inline.

# `verification_mode`

```elixir
@type verification_mode() :: :inline | :deferred
```

# `cert_der`

```elixir
@spec cert_der(AttestoPhoenix.Config.t()) :: (Plug.Conn.t() -&gt; binary() | nil) | nil
```

Adapt the configured mTLS certificate extractor to the verifier's 1-arity
callback form.

# `htu`

```elixir
@spec htu(AttestoPhoenix.Config.t()) :: (Plug.Conn.t() -&gt; String.t() | nil) | nil
```

Resolve the protected-resource DPoP `htu` callback, or `nil` when no target
origin or callback is configured.

See `AttestoPhoenix.RequestContext.protected_resource_url/2`: a configured
`:htu` callback or `:resource_origin` decides. Without either, `nil` is
returned so protected resources that accept DPoP must pin `:origin` or
`:htu` explicitly instead of trusting the request `Host` header.

# `nonce_check`

```elixir
@spec nonce_check(AttestoPhoenix.Config.t()) ::
  (String.t() | nil -&gt; :ok | {:error, :use_dpop_nonce}) | nil
```

Resolve the server-issued nonce validator, or `nil` when unused.

# `nonce_issue`

```elixir
@spec nonce_issue(AttestoPhoenix.Config.t()) :: (-&gt; String.t()) | nil
```

Resolve the fresh-nonce issuer, or `nil` when nonce checks are unused.

# `protected_resource_opts`

```elixir
@spec protected_resource_opts(AttestoPhoenix.Config.t()) :: keyword()
```

Build the DPoP/mTLS options consumed by `Attesto.Plug.Authenticate`.

This is the protected-resource path: replay checking is disabled when DPoP
is disabled, while `htu`, nonce, nonce issuance, and certificate extraction
are resolved from the same Phoenix config used by the endpoint. When neither
`:htu` nor `:resource_origin` is set on `config`, `:htu` is omitted so
`Attesto.Plug.Authenticate.init/1` requires an explicit per-route `:origin`
or `:htu` whenever DPoP is accepted.

# `replay_check`

```elixir
@spec replay_check(AttestoPhoenix.Config.t()) :: (String.t(), pos_integer() -&gt; any())
```

Adapt the configured replay callback to the verifier's 2-arity form.

# `verification_opts`

```elixir
@spec verification_opts(AttestoPhoenix.Config.t(), map(), keyword()) :: keyword()
```

Build the conn-free options for `Attesto.DPoP.verify_proof/2`.

`:replay_check` defaults to `:inline`, which preserves the behavior of proof
binding at PAR and device authorization. Pass `replay_check: :deferred` for
the token endpoint; that mode omits the callback and leaves the returned
replay identity for the caller to commit after grant validation.

`nonce_check: true` adds the configured nonce callback. It is opt-in because
not every DPoP proof path currently requires server-issued nonces.
`http_method_default` preserves the device-authorization default for direct
callers that do not populate the request method.

# `verify_proof`

```elixir
@spec verify_proof(AttestoPhoenix.Config.t(), binary(), map(), keyword()) ::
  {:ok, map()} | {:error, term()}
```

Verify a DPoP `proof` with options built from `config` and `input`.

When `Canonical` / `:htu` resolves to `nil` (or any non-string), returns
`{:error, :invalid_http_uri}` instead of calling `Attesto.DPoP.verify_proof/2`
and raising `ArgumentError`.

---

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