Update src/crypto_wrapper.rs
This commit is contained in:
		| @@ -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 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user