Skip to Content
oxcrypto

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())
SelectorKeyConstruction
V4_LOCAL32-byte bytesKeyed 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_PUBLICEd25519PrivateKey / Ed25519PublicKeyEd25519 over the PAE of header, message, footer and implicit assertion

V4_PUBLIC accepts only Ed25519 keys; Ed448 keys raise TypeError.