jam.paseto.utils¶
utils
¶
Functions:
| Name | Description |
|---|---|
__b64url_nopad__ |
Return B64 nopad. |
__gen_hash__ |
Generate hash. |
__pae__ |
Pre-Authentication Encoding (PAE) as per PASETO spec. |
base64url_decode |
Base64 URL-safe decoding with padding. |
base64url_encode |
Base64 URL-safe encoding without padding. |
payload_maker |
Generate PASETO payload. |
__pae__
¶
__pae__(pieces: list[bytes]) -> bytes
Pre-Authentication Encoding (PAE) as per PASETO spec.
base64url_encode
¶
base64url_encode(data: bytes | str) -> bytes
Base64 URL-safe encoding without padding.
payload_maker
¶
payload_maker(
expire: int | None, data: dict[str, Any]
) -> dict[str, Any]
Generate PASETO payload.
{
'iat': 1761326685.45693,
'exp': 1761328485.45693,
'pit': '52aeaf12-0825-4bc1-aa45-5ded41df2463',
# custom data
'user': 1,
'role': 'admin'
}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expire
|
int | None
|
Token lifetime |
required |
data
|
dict[str, Any]
|
Custom data |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict[str, Any]
|
Payload |