factoriauth/src/auth.rs

30 lines
580 B
Rust
Raw Normal View History

use secrecy::SecretString;
2024-02-10 11:20:35 +01:00
use tracing::instrument;
2024-02-10 11:20:35 +01:00
#[derive(Debug, Clone)]
pub struct Password(pub SecretString);
2024-02-10 11:20:35 +01:00
#[derive(Debug, Clone)]
pub struct UserToken(pub SecretString);
2024-02-10 11:20:35 +01:00
#[derive(Debug)]
2024-02-10 10:51:56 +01:00
pub struct Authenticator {
// TODO
}
impl Authenticator {
pub fn new(/* database credentials ? */) -> Self {
Self {}
}
2024-02-10 11:20:35 +01:00
#[instrument]
pub fn create_user_token(&mut self, username: &str, password: &Password) -> UserToken {
2024-02-10 11:11:46 +01:00
todo!()
}
2024-02-10 11:20:35 +01:00
#[instrument]
2024-02-10 11:11:46 +01:00
pub fn verify_user_token(&self, token: &UserToken) -> bool {
2024-02-10 10:51:56 +01:00
todo!()
}
}