Helpers for DPoP signing keys.
Production clients should persist their DPoP key when they need stable sender binding across process restarts.
inspect/1 shows only the algorithm, never key material.
Summary
Functions
Exports the private JWK as a map.
Generates a private signing key for :es256 or :rs256.
Returns the underlying JOSE.JWK.
Loads a ReqDPoP.Key from a key struct, JOSE.JWK, or JWK map.
Returns the public JWK placed in the proof jwk header.
Exports the public JWK as a map.
Returns the RFC 7638 SHA-256 JWK thumbprint, base64url unpadded.
Types
@type alg() :: :es256 | :rs256
@type t() :: %ReqDPoP.Key{alg: alg(), jwk: JOSE.JWK.t()}
Functions
Exports the private JWK as a map.
Generates a private signing key for :es256 or :rs256.
@spec jose_jwk(t()) :: JOSE.JWK.t()
Returns the underlying JOSE.JWK.
@spec load!(t() | JOSE.JWK.t() | map()) :: t()
Loads a ReqDPoP.Key from a key struct, JOSE.JWK, or JWK map.
The key must be a complete private signing key: a P-256 EC key with 32-byte
x, y, and d, or an RSA key of at least 2048 bits with n, e, and
d. A JWK that carries use or key_ops (RFC 7517 sections 4.2 and 4.3)
must allow signing: use must be "sig", and key_ops must be a list of
strings that contains "sign". A key with neither member is accepted.
Anything else raises ReqDPoP.Error with reason :invalid_key or
:unsupported_key. Error messages never include key material.
Returns the public JWK placed in the proof jwk header.
Only the RFC 7638 thumbprint members are included: crv, kty, x, and
y for EC keys; e, kty, and n for RSA keys. Any other member of a
loaded JWK map stays out of the proof, so application-specific fields never
travel with it.
Exports the public JWK as a map.
The map keeps every public member of the loaded JWK, such as kid, except
key_ops: the private key's operations (sign) do not describe what its
public half may do. The proof header uses proof_jwk/1 instead.
@spec thumbprint(t() | JOSE.JWK.t() | map()) :: binary()
Returns the RFC 7638 SHA-256 JWK thumbprint, base64url unpadded.
Accepts public keys as well as private ones.