Skip to main content

encrypt_file

Function encrypt_file 

Source
pub fn encrypt_file(
    plaintext: &[u8],
    room_crypto: &mut RoomCrypto,
) -> Result<(Vec<u8>, EncryptedFileMeta)>
Expand description

Encrypt plaintext with a fresh ChaCha20-Poly1305 key, then Megolm- wrap that key via the room’s outbound session. The returned bytes are what gets chunked and sent on the wire; the meta travels in the FileOffer alongside the file_id.