Skip to main content

sign_response

Function sign_response 

Source
pub fn sign_response(
    status: u16,
    content_digest: &str,
    key_id: Option<&str>,
    key: &SigningKey<'_>,
    now: i64,
) -> Result<SignedHeaders, Error>
Expand description

Sign a response over @status and content-digest, as Linzer signs one (Linzer.sign!(response, key:, components: %w(@status content-digest))) and the Fediverse Auxiliary Service Provider protocol has both sides sign theirs.

content_digest is the response’s Content-Digest as it is sent (content_digest of its body). The signature names its key only when given key_id: a response answers a request, and its key may be one both sides already know.

§Errors

Returns an error if the key cannot be parsed or the signature cannot be made.