diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2023-05-15 18:23:23 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2023-05-15 18:23:23 +0200 |
commit | 9d6aef34add7a1bf32e754951a3d500721a2e626 (patch) | |
tree | ce7fffb46b9071b73a35620980cd25c060a7c908 /src/login | |
parent | 024d8df847ce720f0ec76b288c7a0142672d21f2 (diff) | |
download | aerogramme-9d6aef34add7a1bf32e754951a3d500721a2e626.tar.gz aerogramme-9d6aef34add7a1bf32e754951a3d500721a2e626.zip |
clippy lint fix
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/mod.rs | 16 | ||||
-rw-r--r-- | src/login/static_provider.rs | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/login/mod.rs b/src/login/mod.rs index 0605d4e..6d2ec71 100644 --- a/src/login/mod.rs +++ b/src/login/mod.rs @@ -190,8 +190,8 @@ impl CryptoKeys { // Write values to storage k2v.insert_batch(&[ - k2v_insert_single_key("keys", "salt", salt_ct, &ident_salt), - k2v_insert_single_key("keys", "public", public_ct, &keys.public), + k2v_insert_single_key("keys", "salt", salt_ct, ident_salt), + k2v_insert_single_key("keys", "public", public_ct, keys.public), k2v_insert_single_key("keys", &password_sortkey, None, &password_blob), ]) .await @@ -223,8 +223,8 @@ impl CryptoKeys { // Write values to storage k2v.insert_batch(&[ - k2v_insert_single_key("keys", "salt", salt_ct, &ident_salt), - k2v_insert_single_key("keys", "public", public_ct, &keys.public), + k2v_insert_single_key("keys", "salt", salt_ct, ident_salt), + k2v_insert_single_key("keys", "public", public_ct, keys.public), ]) .await .context("InsertBatch for salt and public")?; @@ -265,7 +265,7 @@ impl CryptoKeys { // Try to open blob let kdf_salt = &password_blob[..32]; let password_openned = - user_secrets.try_open_encrypted_keys(&kdf_salt, password, &password_blob[32..])?; + user_secrets.try_open_encrypted_keys(kdf_salt, password, &password_blob[32..])?; let keys = Self::deserialize(&password_openned)?; if keys.public != expected_public { @@ -332,7 +332,7 @@ impl CryptoKeys { if entry.value.iter().any(|x| matches!(x, K2vValue::Value(_))) { bail!("password already exists"); } - Some(entry.causality.clone()) + Some(entry.causality) } }; @@ -523,7 +523,7 @@ impl CryptoKeys { impl UserSecrets { fn derive_password_key_with(user_secret: &str, kdf_salt: &[u8], password: &str) -> Result<Key> { let tmp = format!("{}\n\n{}", user_secret, password); - Ok(Key::from_slice(&argon2_kdf(&kdf_salt, tmp.as_bytes(), 32)?).unwrap()) + Ok(Key::from_slice(&argon2_kdf(kdf_salt, tmp.as_bytes(), 32)?).unwrap()) } fn derive_password_key(&self, kdf_salt: &[u8], password: &str) -> Result<Key> { @@ -579,7 +579,7 @@ pub fn k2v_read_single_key<'a>( tombstones: bool, ) -> BatchReadOp<'a> { BatchReadOp { - partition_key: partition_key, + partition_key, filter: Filter { start: Some(sort_key), end: None, diff --git a/src/login/static_provider.rs b/src/login/static_provider.rs index 5ea765f..b9be5a6 100644 --- a/src/login/static_provider.rs +++ b/src/login/static_provider.rs @@ -151,7 +151,7 @@ pub fn verify_password(password: &str, hash: &str) -> Result<bool> { Argon2, }; let parsed_hash = - PasswordHash::new(&hash).map_err(|e| anyhow!("Invalid hashed password: {}", e))?; + PasswordHash::new(hash).map_err(|e| anyhow!("Invalid hashed password: {}", e))?; Ok(Argon2::default() .verify_password(password.as_bytes(), &parsed_hash) .is_ok()) |