Skip to main content

decode_entry

Function decode_entry 

Source
pub fn decode_entry(
    bytes: &[u8],
    expect_key: &str,
    max_body: usize,
) -> Result<(CacheEntryMeta, Vec<u8>), EntryError>
Expand description

Decode and check an entry.

The key must equal expect_key, the body must have exactly the stated length and SHA-256, and no field may be out of range. Nothing in the entry is believed beyond that: see the module documentation.

ยงErrors

Returns why the entry was refused.