diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2023-12-12 09:17:59 +0100 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2023-12-12 09:17:59 +0100 |
commit | 47e25cd7f710fcd82356377cf48eccf9f65d31cc (patch) | |
tree | b847e1b83b6608047d666acc4856113604fc0dbd /src/login/mod.rs | |
parent | 23f918fd0edb224668fb775c770075eb4f44ce4d (diff) | |
download | aerogramme-47e25cd7f710fcd82356377cf48eccf9f65d31cc.tar.gz aerogramme-47e25cd7f710fcd82356377cf48eccf9f65d31cc.zip |
WIP
Diffstat (limited to 'src/login/mod.rs')
-rw-r--r-- | src/login/mod.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/login/mod.rs b/src/login/mod.rs index a9b9efe..f7a81c2 100644 --- a/src/login/mod.rs +++ b/src/login/mod.rs @@ -169,9 +169,20 @@ impl CryptoKeys { } pub async fn open( - storage: &Builders, password: &str, + root_blob: &str, ) -> Result<Self> { + let kdf_salt = &password_blob[..32]; + let password_openned = try_open_encrypted_keys(kdf_salt, password, &password_blob[32..])?; + + let keys = Self::deserialize(&password_openned)?; + if keys.public != expected_public { + bail!("Password public key doesn't match stored public key"); + } + + Ok(keys) + + /* let k2v = storage.row_store()?; let (ident_salt, expected_public) = Self::load_salt_and_public(&k2v).await?; @@ -208,6 +219,7 @@ impl CryptoKeys { } Ok(keys) + */ } pub async fn open_without_password( |