verify_receipt
Free utility: offline-verify a portable v5/v6 trust receipt — the "after you pay"
half of the loop.
Recomputes the Keccak256 leaf from the receipt's preimage (tamper-evidence) AND
verifies the Ed25519 signature against the published TWZRD receipt-signing key
(authenticity). Returns valid/leaf_valid/signature_valid plus the recomputed
leaf and any errors. Pure and offline — no DB, no network, no payment.
Pass the entire PaidReceipt object you were issued. Trust is anchored on the
published key (or expected_pubkey), NOT on whatever pubkey the receipt carries.
max_age_seconds: optional freshness gate (replay protection). Same semantics
as the Python library verify_paid_receipt(..., max_age_seconds=...) and the
standalone CLI --max-age.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| receipt | Yes | The full v6 PaidReceipt object (leaf + preimage + signature + signing_pubkey) returned by the paid /v1/intel/trust surface. | |
| expected_pubkey | No | Override the trusted signing pubkey to verify against (default: the published TWZRD receipt key). | |
| max_age_seconds | No | If > 0, reject the receipt if its preimage.timestamp_unix is older than this many seconds (replay/freshness protection, same as CLI --max-age and library). | |
| require_signature | No | Require and verify the Ed25519 signature (default true). Set false only to inspect an unsigned preview. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| valid | No | True iff the leaf recomputes AND the signature verifies against the trusted key. | |
| domain | No | The V5 domain detected in the preimage. | |
| errors | No | Issues found; empty on success. | |
| leaf_valid | No | True iff the Keccak256 leaf recomputes from the preimage. | |
| provided_leaf | No | The normalized leaf supplied in the receipt. | |
| signing_pubkey | No | The pubkey carried by the receipt. | |
| trusted_pubkey | No | The published key authenticity was checked against. | |
| recomputed_leaf | No | The leaf recomputed from the preimage (0x...). | |
| signature_valid | No | True iff the Ed25519 signature verifies; None if the signature check was skipped. | |
| signature_checked | No | Whether the signature was checked (require_signature). |