PASETO v4
PASETO v4.local (XChaCha20 and keyed BLAKE2b) and v4.public (Ed25519).
from oxcrypto.paseto import PASETO
from oxcrypto.signature.ed25519 import ED25519
key = ED25519.ED25519.generate()
token = PASETO.V4_PUBLIC.encode(b"message", key)
assert PASETO.V4_PUBLIC.verify(token, key.public_key())| Selector | Key | Construction |
|---|---|---|
V4_LOCAL | 32-byte bytes | Keyed BLAKE2b splits the key with a random 32-byte nonce into an XChaCha20 key and nonce and a BLAKE2b-256 MAC key; encrypt-then-MAC over the PAE of header, nonce, ciphertext, footer and implicit assertion |
V4_PUBLIC | Ed25519PrivateKey / Ed25519PublicKey | Ed25519 over the PAE of header, message, footer and implicit assertion |
V4_PUBLIC accepts only Ed25519 keys; Ed448 keys raise TypeError.