factoriauth/src/auth.rs

30 lines
630 B
Rust

use secrecy::SecretString;
use serde::Deserialize;
use tracing::instrument;
#[derive(Debug, Clone, Deserialize)]
pub struct Password(pub SecretString);
#[derive(Debug, Clone, Deserialize)]
pub struct UserToken(pub SecretString);
#[derive(Debug)]
pub struct Authenticator {
// TODO
}
impl Authenticator {
pub fn new(/* database credentials ? */) -> Self {
Self {}
}
#[instrument]
pub fn create_user_token(&mut self, username: &str, password: &Password) -> UserToken {
todo!()
}
#[instrument]
pub fn verify_user_token(&self, token: &UserToken) -> bool {
todo!()
}
}