aboutsummaryrefslogtreecommitdiffstats
path: root/src/actions.rs
diff options
context:
space:
mode:
authorBernd Schoolmann <mail@quexten.com>2023-03-15 16:40:49 +0100
committerBernd Schoolmann <mail@quexten.com>2023-03-26 04:28:03 +0200
commit9645a4636f6f4b04f4e6aba84e3c77fa0f2f6961 (patch)
treecfaf219d625c1dc73991e225bafce8949e5d16be /src/actions.rs
parent2f9bd4eb45c57ce8e8d3011d7660223c05b50f98 (diff)
downloadrbw-9645a4636f6f4b04f4e6aba84e3c77fa0f2f6961.tar.gz
rbw-9645a4636f6f4b04f4e6aba84e3c77fa0f2f6961.zip
Implement argon2 kdf
Diffstat (limited to 'src/actions.rs')
-rw-r--r--src/actions.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/actions.rs b/src/actions.rs
index dc78f7e..2c57405 100644
--- a/src/actions.rs
+++ b/src/actions.rs
@@ -18,11 +18,12 @@ pub async fn login(
password: crate::locked::Password,
two_factor_token: Option<&str>,
two_factor_provider: Option<crate::api::TwoFactorProviderType>,
-) -> Result<(String, String, u32, String)> {
+) -> Result<(String, String, u32, u32, Option<u32>, Option<u32>, String)> {
let (client, config) = api_client_async().await?;
- let iterations = client.prelogin(email).await?;
+ let (kdf, iterations, memory, parallelism) = client.prelogin(email).await?;
+
let identity =
- crate::identity::Identity::new(email, &password, iterations)?;
+ crate::identity::Identity::new(email, &password, kdf, iterations, memory, parallelism)?;
let (access_token, refresh_token, protected_key) = client
.login(
email,
@@ -33,13 +34,16 @@ pub async fn login(
)
.await?;
- Ok((access_token, refresh_token, iterations, protected_key))
+ Ok((access_token, refresh_token, kdf, iterations, memory, parallelism, protected_key))
}
pub fn unlock<S: std::hash::BuildHasher>(
email: &str,
password: &crate::locked::Password,
+ kdf: u32,
iterations: u32,
+ memory: Option<u32>,
+ parallelism: Option<u32>,
protected_key: &str,
protected_private_key: &str,
protected_org_keys: &std::collections::HashMap<String, String, S>,
@@ -48,7 +52,7 @@ pub fn unlock<S: std::hash::BuildHasher>(
std::collections::HashMap<String, crate::locked::Keys>,
)> {
let identity =
- crate::identity::Identity::new(email, password, iterations)?;
+ crate::identity::Identity::new(email, password, kdf, iterations, memory, parallelism)?;
let protected_key =
crate::cipherstring::CipherString::new(protected_key)?;