@postcept/receipt 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SPEC.md CHANGED
@@ -154,6 +154,9 @@ The v3 signing body is the v2 body with `version: "3"` plus:
154
154
  {
155
155
  // ...all v2 fields...
156
156
  "version": "3",
157
+ "algorithm": "ed25519", // the signature scheme, now signed
158
+ "signing_key_id": "ed25519:...", // the key that signed, now signed
159
+ "canonicalization": "postcept-canonical-json-v1", // the scheme in §2, now signed
157
160
  "supersedes": "<receipt_id | null>",
158
161
  "contract_digest": "sha256:... | null",
159
162
  "lifecycle": "finalized | pending_finality | ... | null",
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { asciiJson, base64ToBytes, canonicalize, TIMESTAMP_SPELLINGS } from "./canonical.js";
2
- export { type Observation, type Postcondition, type Receipt, receiptSigningBody, verifyObservation, verifyReceipt, } from "./receipt.js";
2
+ export { CANONICALIZATION_SCHEME, type Observation, type Postcondition, type Receipt, receiptSigningBody, verifyObservation, verifyReceipt, } from "./receipt.js";
3
3
  export { type AuditBadge, badgeSigningBody, verifyBadge } from "./badge.js";
4
4
  export { type ConsistencyProof, type InclusionProof, type SignedTreeHead, receiptLeafHash, verifyConsistency, verifyInclusion, verifyReceiptInLog, verifySignedTreeHead, } from "./transparency.js";
5
5
  export { type EvidenceExportLike, type EvidenceManifest, evidenceContentDigest, verifyEvidenceExport, verifyEvidenceManifest, } from "./evidence.js";
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // and VCR-audit badges. Works in the browser, Node, Deno, and edge runtimes. See
3
3
  // SPEC.md for the format and signing scheme.
4
4
  export { asciiJson, base64ToBytes, canonicalize, TIMESTAMP_SPELLINGS } from "./canonical.js";
5
- export { receiptSigningBody, verifyObservation, verifyReceipt, } from "./receipt.js";
5
+ export { CANONICALIZATION_SCHEME, receiptSigningBody, verifyObservation, verifyReceipt, } from "./receipt.js";
6
6
  export { badgeSigningBody, verifyBadge } from "./badge.js";
7
7
  export { receiptLeafHash, verifyConsistency, verifyInclusion, verifyReceiptInLog, verifySignedTreeHead, } from "./transparency.js";
8
8
  export { evidenceContentDigest, verifyEvidenceExport, verifyEvidenceManifest, } from "./evidence.js";
package/dist/receipt.d.ts CHANGED
@@ -38,6 +38,7 @@ export interface Observation {
38
38
  digest: string | null;
39
39
  signature: string | null;
40
40
  }
41
+ export declare const CANONICALIZATION_SCHEME = "postcept-canonical-json-v1";
41
42
  export declare function receiptSigningBody(r: Receipt, ts: (s: string) => string): Record<string, unknown>;
42
43
  /**
43
44
  * Verify a receipt's Ed25519 signature against a published public key (base64 raw
package/dist/receipt.js CHANGED
@@ -2,6 +2,11 @@
2
2
  // open standard in SPEC.md.
3
3
  import * as ed from "@noble/ed25519";
4
4
  import { base64ToBytes, canonicalize, sha256Hex, TIMESTAMP_SPELLINGS } from "./canonical.js";
5
+ // Stable identifier for the canonical-JSON scheme (sorted keys, no whitespace,
6
+ // non-ASCII and control characters escaped). Bound into the v3 signing body so the
7
+ // signature covers which scheme produced the bytes. Matches CANONICALIZATION_SCHEME
8
+ // in the control plane. Bump both together if the scheme ever changes.
9
+ export const CANONICALIZATION_SCHEME = "postcept-canonical-json-v1";
5
10
  /**
6
11
  * The exact subset of a receipt the signature covers, by version. `ts` applies a
7
12
  * timestamp spelling so the caller can retry "Z" vs "+00:00" (see verifyReceipt).
@@ -36,6 +41,10 @@ export function receiptSigningBody(r, ts) {
36
41
  return {
37
42
  ...v2,
38
43
  version: "3",
44
+ // Bind the signature metadata into the protected content (see CANONICALIZATION_SCHEME).
45
+ algorithm: r.algorithm ?? "ed25519",
46
+ signing_key_id: r.signing_key_id ?? null,
47
+ canonicalization: CANONICALIZATION_SCHEME,
39
48
  supersedes: r.supersedes ?? null,
40
49
  contract_digest: r.contract_digest ?? null,
41
50
  lifecycle: r.lifecycle ?? null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postcept/receipt",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "Independently verify a Postcept Receipt, the signed proof that an AI agent's high-risk action actually happened in the system of record. Runs anywhere, needs only the public key.",
5
5
  "license": "MIT",
6
6
  "author": "Postcept",