diff --git a/CHANGELOG.md b/CHANGELOG.md index eef50cef2..7dec63c9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ Possible log types: - [added] Re-export `crypto_secretbox::Nonce` - [changed] Replace `sodiumoxide` with `crypto_box` and `crypto_secretbox` - [changed] Replace re-exports of `PublicKey`, `SecretKey` and `Key` -- [changed] Replace `&[u8; 24]` with `crypto_secretbox::Nonce` +- [changed] Use dedicated `Nonce` type instead of `&[u8; 24]` - [changed] Return result in `encrypt_*` functions - [changed] Use `hmac` and `sha2` crates for calculating MAC diff --git a/examples/send_e2e_image.rs b/examples/send_e2e_image.rs index f67dd7366..e939687c2 100644 --- a/examples/send_e2e_image.rs +++ b/examples/send_e2e_image.rs @@ -85,8 +85,8 @@ async fn main() { &encrypted_image.nonce, &recipient_key, ) - .unwrap_or_else(|_| { - println!("Could not encrypt image msg"); + .unwrap_or_else(|e| { + println!("Could not encrypt image msg: {e}"); process::exit(1); }); diff --git a/examples/send_e2e_text.rs b/examples/send_e2e_text.rs index 419eb13e8..d0e9ecc99 100644 --- a/examples/send_e2e_text.rs +++ b/examples/send_e2e_text.rs @@ -39,8 +39,8 @@ async fn main() { // Encrypt and send let encrypted = api .encrypt_text_msg(&text, &public_key.into()) - .unwrap_or_else(|_| { - println!("Could not encrypt text msg"); + .unwrap_or_else(|e| { + println!("Could not encrypt text msg: {e}"); process::exit(1); }); let msg_id = api.send(to, &encrypted, false).await; diff --git a/src/crypto.rs b/src/crypto.rs index 633aa7ef1..e2ede7894 100644 --- a/src/crypto.rs +++ b/src/crypto.rs @@ -72,7 +72,7 @@ impl RecipientKey { pub fn from_bytes(val: &[u8]) -> Result { PublicKey::from_slice(val) .map(RecipientKey::from) - .map_err(|_| CryptoError::BadKey("Invalid libsodium public key".into())) + .map_err(|_| CryptoError::BadKey("Invalid public key".into())) } /// Return a reference to the contained key bytes. diff --git a/src/errors.rs b/src/errors.rs index 1874fc221..39199f1d1 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -84,7 +84,7 @@ pub enum CryptoError { #[error("decryption failed")] DecryptionFailed, - /// Decryption failed + /// Encryption failed #[error("encryption failed")] EncryptionFailed, }