Skip to main content

open_stream

Function open_stream 

Source
pub fn open_stream(
    ring: &Keyring,
    envelope: &mut impl Read,
    out: &mut impl Write,
) -> Result<u64, StreamError>
Expand description

Open a stream: read an envelope (v1 or v2) from envelope and write its plaintext to out. A v2 envelope is opened one block at a time (one chunk in memory); each block is verified before it is written, and a cut, reordered or extended envelope fails at the block where it shows — after the blocks before it were written (see StreamError::Open). A v1 envelope is read whole (it was sealed whole). Returns the plaintext bytes written.