Attempt to fix breaking change of bincode 2.0.0
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing

This commit is contained in:
Pierre HUBERT 2025-03-10 18:23:07 +00:00
parent 77f9691e13
commit 0cfae95d7e

View File

@ -26,7 +26,7 @@ impl CryptoWrapper {
}
/// Encrypt some data, returning the result as a base64-encoded string
pub fn encrypt<T: Encode + Decode>(&self, data: &T) -> Result<String, Box<dyn Error>> {
pub fn encrypt<Context, T: Encode + Decode<Context>>(&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<T: Decode>(&self, input: &str) -> Result<T, Box<dyn Error>> {
pub fn decrypt<Context, T: Decode<Context>>(&self, input: &str) -> Result<T, Box<dyn Error>> {
let bytes = BASE64_STANDARD.decode(input)?;
if bytes.len() < NONCE_LEN {