Skip to main content

verify_signed_document

Function verify_signed_document 

Source
pub fn verify_signed_document(
    document: &SignedDocument,
    trusted: &[TrustedKey],
) -> Result<VerifiedPayload>
Expand description

Verifies a signed document against a set of trusted keys and returns its payload.

The payload is checksummed first — cheap, and it catches truncation — and is parsed only once a signature has verified, so no attacker-controlled JSON ever reaches a typed deserialiser on the strength of the envelope alone.

§Errors

When the payload does not match its checksum, when no signature verifies against a trusted key, or when the verified bytes are not a JSON object.