pub fn encrypt_asset_rekey(
amk: &Amk,
file_id: &Uuid,
plaintext: &[u8],
replaces: Option<[u8; 7]>,
) -> Result<(AssetEncryption, Vec<u8>, [u8; 32]), CryptoError>Expand description
Encrypt plaintext as a first or re-rolled asset write under amk scoped to file_id:
draw a fresh nonce_prefix, fold it into the file-key salt, and STREAM-encrypt.
replaces is the nonce_prefix of the version being superseded (a same-epoch
replace), if any; the writer refuses to emit that exact prefix again. Returns the
AssetEncryption metadata, the ciphertext, and the derived file key.