Update dependencies and improve crypto handling

- Updated macOS-specific dependencies in `Cargo.toml` to their latest versions for better compatibility and performance.
- Refactored nonce handling in `crypto.rs` to improve clarity and correctness in the decryption process.
- Modified `gh-release.sh` to streamline asset uploads for snapshot releases and ensure stability for tagged releases by limiting uploaded components.
This commit is contained in:
Kevin Yue committed 2025-10-15 22:49:54 +08:00
1 parent f1a8a3c19a
commit e3c3b6e89e
15 files changed
+2724 -2552

No files matched your search

+3 -3
View File
@@ -1,6 +1,6 @@
use chacha20poly1305::{
aead::{Aead, OsRng},
AeadCore, ChaCha20Poly1305, Key, KeyInit, Nonce,
AeadCore, ChaCha20Poly1305, Key, KeyInit,
};
use serde::{de::DeserializeOwned, Serialize};
@@ -31,10 +31,10 @@ where
{
let cipher = ChaCha20Poly1305::new(key);
let nonce = Nonce::from_slice(&encrypted[..12]);
let nonce = &encrypted[..12];
let cipher_text = &encrypted[12..];
let plaintext = cipher.decrypt(nonce, cipher_text)?;
let plaintext = cipher.decrypt(nonce.into(), cipher_text)?;
let value = serde_json::from_slice(&plaintext)?;