From e56c7525e231e7dbe4b14affafc0ad2e1583e615 Mon Sep 17 00:00:00 2001 From: Xiretza Date: Sat, 10 Feb 2024 12:35:05 +0000 Subject: [PATCH] Rename Authenticator to UserAuthenticator --- src/auth.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/auth.rs b/src/auth.rs index 25f06b2..7e18575 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -31,12 +31,12 @@ pub enum AuthenticationError { } #[derive(Debug)] -pub struct Authenticator { +pub struct UserAuthenticator { db: Arc>, } -impl Authenticator { - const USER_TOKEN_LEN: usize = 30; +impl UserAuthenticator { + const TOKEN_LEN: usize = 30; pub fn new(db: Arc>) -> Self { Self { db } @@ -45,7 +45,7 @@ impl Authenticator { #[instrument] pub async fn create_user_token(&mut self, username: &str, password: &Password) -> UserToken { let new_token = - UserToken::from(Alphanumeric.sample_string(&mut thread_rng(), Self::USER_TOKEN_LEN)); + UserToken::from(Alphanumeric.sample_string(&mut thread_rng(), Self::TOKEN_LEN)); let mut db = self.db.lock().await; if let Err(err) = db.save_token(username, &new_token).await { @@ -85,12 +85,12 @@ impl ServerPadlockGenerator { } pub struct UserServerKeyGenerator { - user_authenticator: Arc, + user_authenticator: Arc, padlock_generator: Arc, } impl UserServerKeyGenerator { - pub fn new(/* Authenticator, ServerPadlockGenerator? */) -> Self { + pub fn new(/* UserAuthenticator, ServerPadlockGenerator? */) -> Self { todo!() }