Update src/crypto_wrapper.rs
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Pierre HUBERT 2025-03-10 18:28:03 +00:00
parent 0cfae95d7e
commit a82310dbc4

View File

@ -26,7 +26,7 @@ impl CryptoWrapper {
}
/// Encrypt some data, returning the result as a base64-encoded string
pub fn encrypt<Context, T: Encode + Decode<Context>>(&self, data: &T) -> Result<String, Box<dyn Error>> {
pub fn encrypt<T: Encode + Decode<()>>(&self, data: &T) -> Result<String, Box<dyn Error>> {
let aes_key = Aes256Gcm::new(&self.key);
let nonce_bytes = rand::rng().random::<[u8; NONCE_LEN]>();
@ -41,7 +41,7 @@ impl CryptoWrapper {
}
/// Decrypt some data previously encrypted using the [`CryptoWrapper::encrypt`] method
pub fn decrypt<Context, T: Decode<Context>>(&self, input: &str) -> Result<T, Box<dyn Error>> {
pub fn decrypt<T: Decode<()>>(&self, input: &str) -> Result<T, Box<dyn Error>> {
let bytes = BASE64_STANDARD.decode(input)?;
if bytes.len() < NONCE_LEN {