aboutsummaryrefslogtreecommitdiffstats
path: root/src/locked.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-10-27 22:16:46 -0400
committerJesse Luehrs <doy@tozt.net>2021-10-27 22:16:46 -0400
commit5d0e308c1c57bea30d2ad9008b6dbc7936d58645 (patch)
tree3c3798d5fb826aeaca62e11d9e56e1e3b610ca2b /src/locked.rs
parent7b95f7b9d84c44ca273c1a1ce7ab62925d4a5def (diff)
downloadrbw-5d0e308c1c57bea30d2ad9008b6dbc7936d58645.tar.gz
rbw-5d0e308c1c57bea30d2ad9008b6dbc7936d58645.zip
add a separate "register" command to log in with api keys
Diffstat (limited to 'src/locked.rs')
-rw-r--r--src/locked.rs44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/locked.rs b/src/locked.rs
index 4008912..4ddf021 100644
--- a/src/locked.rs
+++ b/src/locked.rs
@@ -1,5 +1,3 @@
-use crate::prelude::*;
-
use zeroize::Zeroize;
const LEN: usize = 4096;
@@ -147,45 +145,3 @@ impl ApiKey {
self.client_secret.password()
}
}
-
-#[derive(Clone)]
-pub enum LoginCredentials {
- Password { password: Password },
- ApiKey { apikey: ApiKey },
-}
-
-impl LoginCredentials {
- pub fn from_password(password: Password) -> Self {
- Self::Password { password }
- }
-
- pub fn from_apikey(apikey: ApiKey) -> Self {
- Self::ApiKey { apikey }
- }
-
- pub fn to_hashed(
- self,
- email: &str,
- iterations: u32,
- ) -> Result<HashedLoginCredentials> {
- match self {
- Self::Password { password } => {
- let identity = crate::identity::Identity::new(
- email, &password, iterations,
- )?;
- Ok(HashedLoginCredentials::Password {
- password_hash: identity.master_password_hash,
- })
- }
- Self::ApiKey { apikey } => {
- Ok(HashedLoginCredentials::ApiKey { apikey })
- }
- }
- }
-}
-
-#[derive(Clone)]
-pub enum HashedLoginCredentials {
- Password { password_hash: PasswordHash },
- ApiKey { apikey: ApiKey },
-}