Expand description
JWT token implementation with Ed25519 (EdDSA) signatures.
Implements a minimal JWT encoder/decoder for API authentication. Uses Ed25519 signatures for stateless token validation.
§Token Format
Standard RFC 7519 JWT:
- Header:
{"alg":"EdDSA","typ":"JWT"} - Payload: Claims (sub, exp, iat)
- Signature: Ed25519 over
base64url(header).base64url(payload)
Structs§
- Composite
JwtDispatch - Parser-produced dispatch for a composite JWT. Its fields are private so callers cannot supply metadata that disagrees with the signed header.
- Protected
Header - Duplicate-detecting, closed protected JOSE header used for security dispatch.
Enums§
- JwkThumbprint
Input - Input for RFC 7638 JWK Thumbprint computation.
- JwtError
- Errors from JWT operations
Constants§
- RFC9068_
ACCESS_ TOKEN_ TYPES - The two exact access-token type forms resource servers must accept under RFC 9068 section 4. Matching is intentionally case- and whitespace-sensitive.
Functions§
- composite_
kid - Compute the RFC 7638 thumbprint for one exact composite public-key pair.
- decode
- Decode and verify a JWT token issued by the local node.
- decode_
composite - Decode and verify a composite ML-DSA-65-Ed25519 JWT.
- decode_
ml_ dsa_ 65 - Decode and verify a JWT signed with ML-DSA-65 (
alg: "ML-DSA-65"). - decode_
unverified - Decode a JWT without verifying the signature.
- decode_
with_ any_ key - Try every supplied Ed25519 key for a JWT that has no
kid. - decode_
with_ any_ key_ lenient - Lenient-audience twin of
decode_with_any_key. This remains restricted to kid-less JWTs; only the absent-audience behavior differs. - decode_
with_ federation_ candidates - Verify a federation JWT without losing its JWKS
kidbinding. - decode_
with_ key - Decode a JWT using a caller-supplied verifying key (for multi-issuer support).
- encode
- Encode a user/client OAuth 2.0 access token (
typ: "at+jwt", RFC 9068). Includeskidin the JOSE header for key rotation support. Automatically assigns ajtiif the claims don’t already have one. - encode_
id_ token - Encode and sign an OIDC ID Token (EdDSA with
kidin header). - encode_
service_ jwt - Encode a WIMSE Workload Identity Token (
typ: "wit+jwt") for service JWTs. Includeskidin the JOSE header for key rotation support. Automatically assigns ajtiif the claims don’t already have one. - encode_
service_ jwt_ hybrid - Encode a composite ML-DSA-65-Ed25519 service WIT (
typ: "wit+jwt"). - header_
alg - Extract the
algfrom a JWT’s JOSE header without verifying the signature. - header_
kid - Extract the
kidfrom a JWT’s JOSE header without verifying the signature. - is_
rfc9068_ access_ token_ type - Return whether
typis exactly one of the RFC 9068 access-token forms. - jwk_
thumbprint - Compute the RFC 7638 JWK Thumbprint for any supported key type.
- kid_
for_ key - Compute the JWT
kidfor an Ed25519 signing key using RFC 7638 JWK Thumbprint. - parse_
composite_ dispatch - Parse composite dispatch exactly once and enforce the caller’s allowed types.
- parse_
protected_ header - Parse a JWT protected header exactly once for security dispatch.