Skip to main content

verify_request

Function verify_request 

Source
pub fn verify_request(
    method: &str,
    path_and_query: &str,
    headers: &[(&str, &str)],
    body: &[u8],
    public_key_pem: &str,
) -> Result<(), Error>
Expand description

Verify the HTTP Signature on an incoming POST request.

This checks the signature and, when there is a Digest header, the body against it, and nothing more: not which headers were signed, nor when, nor for which host. verification holds a request to that policy before it calls this.

§Arguments

  • method – HTTP method in any case
  • path – Request path (e.g., /inbox)
  • headers – All request headers as (lowercase-name, value) pairs
  • body – Raw request body bytes
  • public_key_pem – SPKI PEM-encoded RSA public key of the signing actor

§Errors

When the signature cannot be read, the body does not match its digest, a covered header was not sent, or the signature does not verify.