encrypt_to_base64

Function encrypt_to_base64 

Source
pub fn encrypt_to_base64<T: Serialize>(
    data: &T,
    key: &[u8; 32],
    iv: &[u8; 16],
) -> Result<String, Box<dyn Error>>
Expand description

Encrypt data to base64-encoded string

§Arguments

  • data - The data to encrypt (will be serialized to JSON)
  • key - A 32-byte encryption key
  • iv - A 16-byte initialization vector

§Returns

Returns a Result containing the base64-encoded encrypted data