pub fn encrypt(
plaintext: &[u8],
key: &Key,
options: Option<EncryptOptions>,
) -> Result<EncryptionResult>Expand description
Encrypt data using AEAD encryption.
Uses XChaCha20-Poly1305 by default. AES-256-GCM is available only when explicitly selected; callers choosing it must prevent nonce reuse per key.
§Arguments
plaintext- Data to encryptkey- 256-bit encryption keyoptions- Optional encryption options
§Returns
Encrypted data with algorithm, nonce, and authentication tag.