Skip to main content

signing_message

Function signing_message 

Source
pub fn signing_message(
    receipt_version: u32,
    canonical_body: &str,
) -> Result<Vec<u8>, ReceiptError>
Expand description

Build the exact byte message the receipt signature covers for a given receipt_version, from the JCS canonical form of the body.

  • version 1: the bare canonical bytes (legacy wire format);
  • version 2: RECEIPT_DOMAIN_TAG_V2 || len(canonical) as u64 BE || canonical — domain-separated and length-framed, mirroring journal.rs;
  • any other version: refused with ReceiptError::SemanticInvariant (there is no defined framing, so neither signing nor verifying may proceed).

Public so external tooling and tests can reproduce the signing message byte-for-byte.