token-claims
A Rust library for ergonomic handling of JWT claims with strong typing and builder support.
Features
- Generic
TokenClaims<T>struct for custom or primitive claim types. - Builder pattern for easy construction of claims.
- Support for both JSON and optional MessagePack serialization (via
msgpackfeature). - Helper types for subject (
Subject<T>), timestamp (TimeStamp), and JWT ID (JWTID). - Custom error handling for token operations.
- Thoroughly tested with custom and primitive claim types.
Example
use ;
let claims = default
.sub
.exp
.iat
.typ
.iss
.aud
.jti
.build
.unwrap;