Skip to main content

Module receipts

Module receipts 

Source
Expand description

Receipts and verdicts — SPEC §17.5–§17.6.

Additive primitives that sit on top of verify_bundle:

  • VerificationReceipt: hybrid-signed attestation that a bundle was verified with a specific decision at a specific time. Chains by prev_hash so the chain is tamper-evident.
  • PolicyVerdict: HMAC-bound cached policy decision; lets a commercial policy backend skip live evaluation on subsequent calls.

Wire format unchanged: these wrap output of the verifier rather than adding fields to existing signed objects.

Functions§

bundle_hash
SHA-256 of a fixed-shape canonical form of a ProofBundle (SPEC §17.5).
issue_policy_verdict
Construct and HMAC-bind a PolicyVerdict.
issue_verification_receipt
Construct and hybrid-sign a VerificationReceipt over a (bundle, result, prev) triple. prev_hash is None for genesis (becomes 32 zero bytes).
policy_verdict_sign_bytes_buf
Canonical signable bytes for a PolicyVerdict. Public so tests and alternative issuance backends can recompute the bytes. Keys: agent_id, allow, context_hash, issued_at, scope, valid_until, verdict_id, version.
receipt_hash
SHA-256 of a receipt’s canonical signable bytes. Use as prev_hash for the next receipt in the chain.
verification_receipt_sign_bytes_buf
Canonical signable bytes for a VerificationReceipt. Public so tests (and any AuditProvider that wants to chain its own signatures) can recompute the bytes.
verifier_context_hash
SHA-256 of the canonical-byte representation of the policy-relevant subset of a VerifierContext. Used as context_hash on a PolicyVerdict. invocations_in_window is excluded — closures don’t serialize. Keys in lex order: current_alt_m, current_lat, current_lon, current_speed_mps, has_amount, has_location, has_speed, requested_amount, requested_currency.
verify_policy_verdict
Check a PolicyVerdict’s HMAC and validity. Returns Ok(()) on success (cached allow); returns Err("policy_verdict_denied: ...") on cached deny; any other Err indicates the verdict is unusable.
verify_verification_receipt
Verify the hybrid signature on a VerificationReceipt against the receipt’s declared verifier_pub. Returns Ok(()) iff both component signatures verify.