Skip to main content

encrypt_attachment_bytes

Function encrypt_attachment_bytes 

Source
pub fn encrypt_attachment_bytes(
    plaintext: Vec<u8>,
    key_bytes: Vec<u8>,
) -> Result<Vec<u8>, SoftchatError>
Expand description

Encrypt a bounded released-client-compatible attachment value.

The output is 12-byte nonce || ciphertext || 16-byte tag, matching CryptoKit ChaChaPoly.SealedBox.combined and the released Android writer. Large files must use platform-owned staged-file adapters; this helper is intentionally bounded so callers cannot accidentally buffer arbitrary attachments across FFI.

ยงErrors

Returns a stable key, size, or encryption failure.