Attempt to fix breaking change of bincode 2.0.0
This commit is contained in:
parent
77f9691e13
commit
0cfae95d7e
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user