Updated account and master pass methods
This commit is contained in:
parent
8af4d0ab12
commit
c1e1b9c0c1
@ -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)
|
||||
}
|
||||
|
@ -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, ¶ms, &mut password_hash)?;
|
||||
scrypt(password, salt, ¶ms, &mut password_hash)?;
|
||||
Ok(password_hash)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user