add token framing, crypto and errors

This commit is contained in:
juancwu 2026-04-29 01:28:05 +00:00
commit a6aad1a1d6
5 changed files with 448 additions and 0 deletions

15
errors.go Normal file
View file

@ -0,0 +1,15 @@
package ficha
import "errors"
var (
// ErrInvalidToken means the token is malformed, has an unsupported
// version, fails descryption, or has been tampered with.
ErrInvalidToken = errors.New("ficha: invalid token")
// ErrExpiredToken means the token's expiry time has passed.
ErrExpiredToken = errors.New("ficha: token expired")
// ErrRevokedToken means the token's ID is in the revocation store.
ErrRevokedToken = errors.New("ficha: token revoked")
// ErrUnknownKey means the token references a key ID not in the keyring.
ErrUnknownKey = errors.New("ficha: unknown key id")
)