authbox 0.1.5

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
13
14
15
16
17
18
use super::auth_user::AuthUser;
use async_trait::async_trait;

#[async_trait]
pub trait UserStore {
    type Error;
    type User: AuthUser;

    async fn find_by_id(&self, user_id: &str) -> Option<Self::User>;
    async fn find_by_email(&self, email: &str) -> Option<Self::User>;
    async fn create_user(
        &self,
        email: String,
        pass_hash: String,
    ) -> Result<Self::User, Self::Error>;
    async fn update_user(&self, user: Self::User) -> Result<Self::User, Self::Error>;
    async fn delete_user(&self, user_id: &str) -> Result<(), Self::Error>;
}