Skip to main content

sign_object_integrity_proof

Function sign_object_integrity_proof 

Source
pub fn sign_object_integrity_proof(
    document: &Value,
    verification_method: &str,
    signing_key: &[u8; 32],
    now: i64,
) -> Result<Value, Error>
Expand description

Attach an eddsa-jcs-2022 integrity proof to document.

The inverse of verify_object_integrity_proof, and deliberately written to be verified by it: the proof configuration is hashed, then the document without its proof, and the Ed25519 signature covers both hashes in that order.

A proof authenticates the activity rather than the transport that carried it, which is what lets a relayed or forwarded activity still be attributed. Mastodon 4.7 verifies these but does not produce them.

§Arguments

  • document – the activity to sign; must be a JSON object
  • verification_method – the id of the key, as published in the actor’s assertionMethod
  • signing_key – the raw 32-byte Ed25519 seed
  • now – the time, in seconds since the Unix epoch, which becomes the proof’s created

§Errors

Returns an error if the document is not an object or cannot be canonicalized.