je_load_density.utils.auth.jwt_signer

JWT signer (HS256, HS384, HS512, RS256, RS384, RS512).

No third-party JWT library; uses the stdlib hmac and hashlib for HS, and cryptography (soft-dep) for RS.

Functions

decode_jwt(token)

Decode the three JWT segments without verifying the signature.

sign_jwt(payload, secret[, algorithm, ...])

Build and sign a JSON Web Token.

je_load_density.utils.auth.jwt_signer.decode_jwt(token: str) Tuple[Dict[str, Any], Dict[str, Any], bytes]

Decode the three JWT segments without verifying the signature. Returns (header_dict, payload_dict, signature_bytes).

je_load_density.utils.auth.jwt_signer.sign_jwt(payload: Dict[str, Any], secret: str | bytes, algorithm: str = 'HS256', headers: Dict[str, Any] | None = None, expires_in_seconds: int | None = None) str

Build and sign a JSON Web Token. Mutates a copy of payload — if expires_in_seconds is set, exp is added.