Skip to main content

TokenVerifier

Trait TokenVerifier 

Source
pub trait TokenVerifier {
    // Required method
    fn verify_at(&self, token: &str, now: i64) -> Result<Claims, CodecError>;

    // Provided method
    fn verify(&self, token: &str) -> Result<Claims, CodecError> { ... }
}
Expand description

Verify session tokens into Claims.

The capability the edge depends on. An asymmetric public verifier (cheers_verify::PasetoV4PublicVerifier) satisfies this while being physically unable to mint; a symmetric codec (cheers_server’s PasetoV4Codec / HmacBlobCodec) satisfies it too, but only because it also holds minting power — see Codec.

Required Methods§

Source

fn verify_at(&self, token: &str, now: i64) -> Result<Claims, CodecError>

Verify a token against now (unix seconds). Reject if expires_at <= now.

Provided Methods§

Source

fn verify(&self, token: &str) -> Result<Claims, CodecError>

Convenience wrapper using the system clock.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§