@receiptprotocol/open-receipt
v0.2.1
Published
Canonicalization, historical verification, and issuer trust for Open Receipt
Downloads
435
Readme
Open Receipt verifier
@receiptprotocol/open-receipt canonicalizes, signs, and verifies Open Receipt
events locally. Open Receipt is an open, versioned specification for portable,
verifiable commercial evidence.
Open Receipt 0.2 adds issuer trust resolution, key lifecycle semantics, historical verification, and issuance attestations. Conformance is defined by the published schemas, test vectors, and verifier behavior for each version.
Trust-aware v0.2 verification
import { createHttpsWebPkiResolver, verifyOpenReceiptTrust } from "@receiptprotocol/open-receipt";
const resolver = createHttpsWebPkiResolver({
allowedIssuerOrigins: ["https://receiptprotocol.com"],
});
const result = await verifyOpenReceiptTrust(receipt, {
trustMode: "https_webpki",
resolver,
});result.signature.valid reports mathematical signature validity separately
from result.issuer.trusted. The result also reports the metadata snapshot and
freshness, the key's state at issuance, its current state as known by that
snapshot, and any issuance attestation.
Trust modes:
embedded_onlychecks signature consistency using the embedded public key. It does not establish a trusted issuer identity.pinned_metadatauses an explicitly trusted signed metadata snapshot and hash. It supports controlled and fully offline verification.https_webpkiresolves exact, versioned metadata from an allowlisted issuer HTTPS origin and validates the signed metadata hash chain.
An offline result describes its knowledge boundary. It cannot discover a revocation or compromise published after the cached snapshot:
{
"metadata_as_of": "2026-07-30T12:00:00.000Z",
"metadata_freshness": "stale",
"key_valid_as_of_metadata": true
}Keys rotate; existing signatures do not. Each Receipt keeps its original
signature and signing_key_id. Retired public keys remain available for
historical verification, while retired private keys must not create new
signatures. Revocation and compromise are evaluated against the issuance time
and their effective times. A separate issuance-log signature makes fraudulent
backdating harder after an evidence-key compromise.
v0.1 compatibility
The v0.1 API and vectors remain supported:
import { verifyOpenReceipt } from "@receiptprotocol/open-receipt";
const result = await verifyOpenReceipt(receipt, {
issuerMetadata: cachedV01Metadata,
});
if (!result.valid) throw new Error(result.errors.join(", "));Existing v0.1 Receipts are not rewritten or re-signed. A v0.1 Receipt without an issuance attestation remains cryptographically verifiable with lower trust assurance.
Schemas
schemas/event.schema.json— v0.1 eventschemas/bundle.schema.json— v0.1 bundleschemas/issuer.schema.json— v0.1 issuer metadataschemas/event-v02.schema.json— v0.2 eventschemas/issuer-metadata-v02.schema.json— signed v0.2 issuer metadataschemas/issuance-attestation.schema.json— v0.2 issuance attestation
No private key, provider credential, raw private payload, or buyer PII belongs in an Open Receipt or public issuer document.
