pub type EncryptorDecryptor = EncryptorDecryptor<Error>;
Aliased Type§
struct EncryptorDecryptor { /* private fields */ }
Implementations
§impl<E> EncryptorDecryptor<E>where
E: From<EncryptorDecryptorError>,
impl<E> EncryptorDecryptor<E>where
E: From<EncryptorDecryptorError>,
pub fn create_key() -> Result<String, E>
pub fn create_key() -> Result<String, E>
Create a key that can be used to construct an EncryptorDecryptor
pub fn new(key: &str) -> Result<EncryptorDecryptor<E>, E>
pub fn new_with_random_key() -> Result<EncryptorDecryptor<E>, E>
pub fn encrypt(&self, cleartext: &str, description: &str) -> Result<String, E>
pub fn encrypt(&self, cleartext: &str, description: &str) -> Result<String, E>
Encrypt a string
description
is a developer-friendly description of the operation that gets reported to Sentry
on crypto errors.
pub fn encrypt_struct<T>(
&self,
fields: &T,
description: &str,
) -> Result<String, E>where
T: Serialize,
pub fn encrypt_struct<T>(
&self,
fields: &T,
description: &str,
) -> Result<String, E>where
T: Serialize,
Encrypt a struct
description
is a developer-friendly description of the operation that gets reported to Sentry
on crypto errors.
pub fn decrypt(&self, ciphertext: &str, description: &str) -> Result<String, E>
pub fn decrypt(&self, ciphertext: &str, description: &str) -> Result<String, E>
Decrypt a string
description
is a developer-friendly description of the operation that gets reported to Sentry
on crypto errors.
pub fn decrypt_struct<T>(
&self,
ciphertext: &str,
description: &str,
) -> Result<T, E>where
T: DeserializeOwned,
pub fn decrypt_struct<T>(
&self,
ciphertext: &str,
description: &str,
) -> Result<T, E>where
T: DeserializeOwned,
Decrypt a struct
description
is a developer-friendly description of the operation that gets reported to Sentry
on crypto errors.