Skip to main content

verify_digest_header

Function verify_digest_header 

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

Verifies that the Digest: header value matches the computed digest of body.

Accepts only the SHA-256 algorithm; other algorithms result in Error::UnsupportedDigestAlgorithm, matching Fediverse practice.

ยงErrors

Returns Error::UnsupportedDigestAlgorithm if the header prefix is not SHA-256=, Error::InvalidBase64 if the base64 body is malformed, and Error::DigestMismatch if the hash does not match.