Updated account and master pass methods

This commit is contained in:
StNicolay 2023-05-06 19:35:11 +03:00
parent 8af4d0ab12
commit c1e1b9c0c1
Signed by: StNicolay
GPG Key ID: 9693D04DCD962B0D
2 changed files with 2 additions and 2 deletions

View File

@ -42,7 +42,7 @@ impl Cipher {
pub fn encrypt(&self, value: &[u8]) -> crate::Result<Vec<u8>> {
let nonce = ChaCha20Poly1305::generate_nonce(&mut OsRng);
let mut result = self.chacha.encrypt(&nonce, value).unwrap();
let mut result = self.chacha.encrypt(&nonce, value)?;
result.extend(nonce);
Ok(result)
}

View File

@ -24,7 +24,7 @@ impl ActiveModelBehavior for ActiveModel {}
fn hash_password(password: &[u8], salt: &[u8]) -> crate::Result<Vec<u8>> {
let params = Params::new(14, Params::RECOMMENDED_R, Params::RECOMMENDED_P, 64)?;
let mut password_hash = vec![0; 64];
scrypt(password.as_ref(), &salt, &params, &mut password_hash)?;
scrypt(password, salt, &params, &mut password_hash)?;
Ok(password_hash)
}