Skip to main content

verify_content_digest_header

Function verify_content_digest_header 

Source
pub fn verify_content_digest_header(
    header: &str,
    body: &[u8],
) -> Result<(), Error>
Expand description

Verifies that the Content-Digest: header carries a sha-256 entry matching body.

This is the strict Mastodon-compatible verifier: it requires SHA-256 specifically. To accept any of several algorithms, use verify_any_content_digest_header.

ยงErrors

Returns Error::UnsupportedDigestAlgorithm if no sha-256 entry is present, Error::InvalidHeader on structured-field parse failure, and Error::DigestMismatch if the hash does not match.