Skip to main content

Module token

Module token 

Source

Structs§

TokenPayload
Token payload - the claims inside a signed token.

Enums§

TokenError
TokenScope
Token scopes - browser sessions get short-lived tokens, CLI gets longer-lived ones.

Functions§

generate_secret
Generate a cryptographically secure random secret (32 bytes).
secret_from_hex
Decode a hex string back to secret bytes.
secret_to_hex
Encode a secret as hex string for storage.
sign_token
Sign a token payload with HMAC-SHA256.
verify_token
Verify and decode a token string.
verify_token_with_scope
Verify a token and enforce a specific scope.