# README
FastWebToken
Small, Fast and simple JWT alternative that uses CBOR for serialization and EdDSA, HMAC, blake2b and blake3 for signing.
Structure
Header | Payload | Signature |
---|---|---|
1 (SignatureType) + 8 (Payload size) byte | Varies based on the Payload size | 32 bytes for HMACSha256, Blake2b256, blake3 or 64 bytes for Ed25519, HMACSha512, Blake2b512 or 114 bytes for Ed448 |
- Header: This begins with a single byte that determines the SignatureType. The next eight bytes are the size of the payload encoded in big endian.
- Payload: Payload that encoded in CBOR format. The size of the payload is specified in the header.
- Signature: This is either 32, 64 or 114 bytes depending on the SignatureType specified in the header.
Signature Types
- Ed25519: RFC-8032 Ed25519 signature.
- Ed448: RFC-8032 Ed448 signature.
- HMACSha256: HMAC with SHA-256.
- HMACSha512: HMAC with SHA-512.
- Blake2b256: Blake2b with 256-bit output.
- Blake2b512: Blake2b with 512-bit output.
- Blake3: Blake3 with 256-bit output.
# Functions
NewAESCBCDecrypter creates a new decrypter using AES-CBC.
NewAESCBCEncryptor creates a new encryptor using AES-CBC.
NewAESCTRDecrypter creates a new decrypter using AES-CTR.
NewAESCTREncryptor creates a new encryptor using AES-CTR.
NewAESECBDecrypter creates a new decrypter using AES-ECB.
NewAESECBEncryptor creates a new encryptor using AES-ECB.
NewAESGCMDecrypter creates a new decrypter using AES-GCM.
NewAESGCMEncryptor creates a new encryptor using AES-GCM.
NewBlake2b256Signer creates a new signer using blake2b-256 with a key.
NewBlake2b256Verifier creates a new verifier using blake2b-256 with a key.
NewBlake2b512Signer creates a new signer using blake2b-512 with a key.
NewBlake2b512Verifier creates a new verifier using blake2b-512 with a key.
NewBlake3Signer creates a new signer using blake3 with a key.
NewBlake3Verifier creates a new verifier using blake3 with a key.
NewEd25519Signer creates a new signer using Ed25519 with ed25519.PrivateKey.
NewEd25519Verifier creates a new verifier using Ed25519 with ed25519.PublicKey.
NewEd448Signer creates a new signer using Ed448 with ed448.PrivateKey.
NewEd448Verifier creates a new verifier using Ed448 with ed448.PublicKey.
NewHMACSha256Signer creates a new signer using HMAC-SHA256 with a key.
NewHMACSha256Verifier creates a new verifier using HMAC-SHA256 with a key.
NewHMACSha512Signer creates a new signer using HMAC-SHA512 with a key.
NewHMACSha512Verifier creates a new verifier using HMAC-SHA512 with a key.
NewHPKEDecrypter creates a new decrypter using HPKE.
NewHPKEEncryptor creates a new encryptor using HPKE.
NewSigner creates a new signer.
NewVerifier creates a new verifier.
NewXChaCha20PolyDecrypter creates a new decrypter using XChaCha20-Poly1305.
NewXChaCha20PolyEncryptor creates a new encryptor using XChaCha20-Poly1305.
SetDecoder set custom cbor decoder.
SetEncoder set custom cbor encoder.
# Constants
SignatureTypeBlake2b256 is the signature type of blake2b-256.
SignatureTypeBlake2b512 is the signature type of blake2b-512.
SignatureTypeBlake3 is the signature type of blake3.
SignatureTypeEd25519 is the signature type of Ed25519.
SignatureTypeEd448 is the signature type of Ed448.
SignatureTypeHMACSha256 is the signature type of HMAC-SHA256.
SignatureTypeHMACSha512 is the signature type of HMAC-SHA512.
# Type aliases
SignatureType is the type of signature.