authbox 0.1.2

A lightweight, modular authentication framework for Rust built around traits, async support, and pluggable component
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use async_trait::async_trait;

#[async_trait]
pub trait TokenManager {
    type Token;
    type Claims;
    type Error;

    async fn generate(&self, user_id: &str) -> Result<Self::Token, Self::Error>;
    async fn verify(&self, token: &str) -> Result<Self::Claims, Self::Error>;
    async fn refresh(&self, refresh_token: &str) -> Result<Self::Token, Self::Error>;
}