Skip to content

Commit

Permalink
fixup! Add wrapper for Key that implements zeroize
Browse files Browse the repository at this point in the history
Remove redundant type annotations
  • Loading branch information
dbrgn committed Feb 28, 2024
1 parent 95d372b commit 2f9c245
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pub fn decrypt_file_data(
data: &EncryptedFileData,
encryption_key: &Key,
) -> Result<FileData, CryptoError> {
let secretbox: XSalsa20Poly1305 = XSalsa20Poly1305::new(encryption_key.as_ref());
let secretbox = XSalsa20Poly1305::new(encryption_key.as_ref());

let file = secretbox
.decrypt(get_file_nonce(), Payload::from(data.file.as_ref()))
Expand Down Expand Up @@ -454,7 +454,7 @@ mod test {
let (encrypted, key) = encrypt_file_data(&data).unwrap();
let encrypted_thumb = encrypted.thumbnail.expect("Thumbnail missing");

let secretbox: XSalsa20Poly1305 = XSalsa20Poly1305::new(key.as_ref());
let secretbox = XSalsa20Poly1305::new(key.as_ref());

// Ensure that encrypted data is different from plaintext data
assert_ne!(encrypted.file, file_data);
Expand Down

0 comments on commit 2f9c245

Please sign in to comment.