Build DPoP proof JWTs (RFC 9449 §4), the client-side mirror of
Attesto.DPoP.verify_proof/2.
A proof is a JWT, typed dpop+jwt, whose header carries the client's public
key (as jwk) and whose payload binds the proof to a single HTTP request:
htm- the request method ("POST","GET", ...), uppercased.htu- the request URI with any query and fragment stripped (§4.2).iat- issuance time.jti- a unique identifier the server tracks against replay.ath-base64url(SHA-256(access_token)), present only when the proof accompanies an access token (the resource-request leg, §4.2); it binds the proof to that token so a leaked proof cannot be paired with another.nonce- a server-supplied DPoP nonce, echoed when the server has demanded one (ause_dpop_nonceerror carrying aDPoP-Nonceheader).
Signing and key-bound :alg/:kid validation behave as in
AttestoClient.Wallet.Proof (shared AttestoClient.Builder internals): the
proof's public jwk is this key, and the server pins the token to its
jkt thumbprint.
Summary
Functions
Build a signed DPoP proof for a request to htu with method htm, returning
{:ok, compact_jws} or {:error, reason}. Fails fast on invalid input.
Types
@type error() :: :invalid_key | :invalid_htm | :invalid_htu | :invalid_time | :unsupported_alg | :unsupported_key | {:signing_failed, String.t()}
@type jwk() :: JOSE.JWK.t() | map()
Functions
Build a signed DPoP proof for a request to htu with method htm, returning
{:ok, compact_jws} or {:error, reason}. Fails fast on invalid input.
jwk is the DPoP key (private half required for signing). htm is the HTTP
method and htu the target URI; the URI's query and fragment are stripped to
form the htu claim. Pass :access_token on a resource request so the proof
carries the ath binding, and :nonce to echo a server-demanded DPoP nonce.
:alg, :kid, and :now behave as in AttestoClient.Wallet.Proof.build/2.