pub trait Codec: TokenMinter + TokenVerifier { }Expand description
A symmetric codec: one key both mints and verifies.
Blanket-impl’d for any type that is both a TokenMinter and a
TokenVerifier, so existing dyn Codec / impl Codec callers keep
working unchanged. The supertrait bound makes the dual capability explicit
in the type: holding a Codec at the edge carries minting power — exactly
the property the asymmetric split designs out. Edge code should name
TokenVerifier, not Codec.
The two built-in symmetric impls (cheers_server’s PasetoV4Codec and
HmacBlobCodec) guarantee that verify(mint(c)) round-trips a non-expired
c, and that any single-bit tamper on the token causes verify to fail.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".