Struct EncryptorDecryptor
pub struct EncryptorDecryptor { /* private fields */ }
Expand description
High-level struct for handling Encryption/Decryption
Implementations§
§impl EncryptorDecryptor
impl EncryptorDecryptor
pub fn create_key() -> Result<String, JwCryptoError>
pub fn create_key() -> Result<String, JwCryptoError>
Create a key that can be used to construct an EncryptorDecryptor
pub fn new(key: &str) -> Result<EncryptorDecryptor, JwCryptoError>
pub fn new_with_random_key() -> Result<EncryptorDecryptor, JwCryptoError>
pub fn encrypt(&self, cleartext: &str) -> Result<String, JwCryptoError>
pub fn encrypt(&self, cleartext: &str) -> Result<String, JwCryptoError>
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) -> Result<String, JwCryptoError>where
T: Serialize,
pub fn encrypt_struct<T>(&self, fields: &T) -> Result<String, JwCryptoError>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) -> Result<String, JwCryptoError>
pub fn decrypt(&self, ciphertext: &str) -> Result<String, JwCryptoError>
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) -> Result<T, JwCryptoError>where
T: DeserializeOwned,
pub fn decrypt_struct<T>(&self, ciphertext: &str) -> Result<T, JwCryptoError>where
T: DeserializeOwned,
Decrypt a struct
description
is a developer-friendly description of the operation that gets reported to Sentry
on crypto errors.
pub fn create_canary(&self, text: &str) -> Result<String, JwCryptoError>
pub fn check_canary( &self, canary: &str, text: &str, ) -> Result<bool, JwCryptoError>
Auto Trait Implementations§
impl Freeze for EncryptorDecryptor
impl RefUnwindSafe for EncryptorDecryptor
impl Send for EncryptorDecryptor
impl Sync for EncryptorDecryptor
impl Unpin for EncryptorDecryptor
impl UnwindSafe for EncryptorDecryptor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<>
Read more