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!() }