Skip to content

Commit

Permalink
fixup! Exchange sodiumoxide with maintained alternatives
Browse files Browse the repository at this point in the history
  • Loading branch information
threema-donat committed Feb 5, 2024
1 parent 46120d3 commit 557c02c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions examples/send_e2e_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down
4 changes: 2 additions & 2 deletions examples/send_e2e_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl RecipientKey {
pub fn from_bytes(val: &[u8]) -> Result<Self, CryptoError> {
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.
Expand Down
2 changes: 1 addition & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub enum CryptoError {
#[error("decryption failed")]
DecryptionFailed,

/// Decryption failed
/// Encryption failed
#[error("encryption failed")]
EncryptionFailed,
}
Expand Down

0 comments on commit 557c02c

Please sign in to comment.