barrel_mcp_jwt (barrel_mcp v3.0.1)
View SourceThe little JOSE the OAuth client needs: signing a JWT with ES256, RS256 or HS256, a P-256 key as a JWK, and its RFC 7638 thumbprint. Used for private_key_jwt client assertions (RFC 7523) and DPoP proofs (RFC 9449).
Summary
Functions
The private key in a PEM, PKCS#8 (PRIVATE KEY) or the type-specific encodings.
A fresh P-256 key, for DPoP.
The public half of a P-256 key as a JWK (RFC 7518 6.2.1).
A signed JWT for Claims (binary-keyed map) with the header {"alg": Alg, "typ": "JWT"}.
As sign/3 with extra header members (typ, jwk, ...).
RFC 7638: SHA-256 of the required members, lexically ordered, serialised without whitespace.
Types
-type alg() :: binary().
-type key() :: public_key:ecdsa_private_key() | public_key:rsa_private_key() | {hmac, binary()}.
Functions
The private key in a PEM, PKCS#8 (PRIVATE KEY) or the type-specific encodings.
-spec generate_key() -> public_key:ecdsa_private_key().
A fresh P-256 key, for DPoP.
-spec jwk(public_key:ecdsa_private_key()) -> map().
The public half of a P-256 key as a JWK (RFC 7518 6.2.1).
A signed JWT for Claims (binary-keyed map) with the header {"alg": Alg, "typ": "JWT"}.
As sign/3 with extra header members (typ, jwk, ...).
RFC 7638: SHA-256 of the required members, lexically ordered, serialised without whitespace.