@certrev/cert-block 1.2.1 → 2.0.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +230 -0
  2. package/README.md +135 -8
  3. package/dist/builder/card-contract.d.ts +143 -0
  4. package/dist/builder/card-contract.d.ts.map +1 -0
  5. package/dist/builder/card-contract.js +262 -0
  6. package/dist/builder/card-contract.js.map +1 -0
  7. package/dist/builder/card-report.d.ts +37 -0
  8. package/dist/builder/card-report.d.ts.map +1 -0
  9. package/dist/builder/card-report.js +43 -0
  10. package/dist/builder/card-report.js.map +1 -0
  11. package/dist/builder/cert-review-card.d.ts +7 -5
  12. package/dist/builder/cert-review-card.d.ts.map +1 -1
  13. package/dist/builder/cert-review-card.js +227 -18
  14. package/dist/builder/cert-review-card.js.map +1 -1
  15. package/dist/builder/contract-card.d.ts +53 -0
  16. package/dist/builder/contract-card.d.ts.map +1 -0
  17. package/dist/builder/contract-card.js +141 -0
  18. package/dist/builder/contract-card.js.map +1 -0
  19. package/dist/builder/delivered-face.d.ts +83 -0
  20. package/dist/builder/delivered-face.d.ts.map +1 -0
  21. package/dist/builder/delivered-face.js +135 -0
  22. package/dist/builder/delivered-face.js.map +1 -0
  23. package/dist/builder/delivery-runtime.d.ts +15 -1
  24. package/dist/builder/delivery-runtime.d.ts.map +1 -1
  25. package/dist/builder/delivery-runtime.js +26 -1
  26. package/dist/builder/delivery-runtime.js.map +1 -1
  27. package/dist/builder/index.d.ts +7 -1
  28. package/dist/builder/index.d.ts.map +1 -1
  29. package/dist/builder/index.js +8 -1
  30. package/dist/builder/index.js.map +1 -1
  31. package/dist/builder/ssr-seed.d.ts +31 -1
  32. package/dist/builder/ssr-seed.d.ts.map +1 -1
  33. package/dist/builder/ssr-seed.js +38 -4
  34. package/dist/builder/ssr-seed.js.map +1 -1
  35. package/dist/index.d.ts +3 -2
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +3 -1
  38. package/dist/index.js.map +1 -1
  39. package/dist/reader/reader-css.generated.d.ts +1 -1
  40. package/dist/reader/reader-css.generated.d.ts.map +1 -1
  41. package/dist/reader/reader-css.generated.js +1 -1
  42. package/dist/reader/reader-css.generated.js.map +1 -1
  43. package/dist/reader/render.d.ts.map +1 -1
  44. package/dist/reader/render.js +71 -34
  45. package/dist/reader/render.js.map +1 -1
  46. package/dist/reader/tokens.d.ts +2 -0
  47. package/dist/reader/tokens.d.ts.map +1 -1
  48. package/dist/reader/tokens.js +28 -6
  49. package/dist/reader/tokens.js.map +1 -1
  50. package/dist/verify/get-verified-delivery.d.ts +56 -0
  51. package/dist/verify/get-verified-delivery.d.ts.map +1 -1
  52. package/dist/verify/get-verified-delivery.js +49 -4
  53. package/dist/verify/get-verified-delivery.js.map +1 -1
  54. package/dist/verify/key-set.d.ts +67 -0
  55. package/dist/verify/key-set.d.ts.map +1 -0
  56. package/dist/verify/key-set.js +190 -0
  57. package/dist/verify/key-set.js.map +1 -0
  58. package/package.json +115 -112
  59. package/src/builder/card-contract.ts +314 -0
  60. package/src/builder/card-report.ts +61 -0
  61. package/src/builder/cert-review-card.tsx +332 -26
  62. package/src/builder/contract-card.tsx +159 -0
  63. package/src/builder/delivered-face.ts +156 -0
  64. package/src/builder/delivery-runtime.ts +32 -1
  65. package/src/builder/index.tsx +16 -1
  66. package/src/builder/ssr-seed.ts +56 -4
  67. package/src/index.ts +12 -0
  68. package/src/reader/reader-css.generated.ts +1 -1
  69. package/src/reader/reader.css +297 -2
  70. package/src/reader/render.ts +87 -38
  71. package/src/reader/tokens.ts +29 -6
  72. package/src/verify/get-verified-delivery.ts +85 -4
  73. package/src/verify/key-set.ts +225 -0
@@ -36,10 +36,33 @@
36
36
  * card paints its options face instead of nothing. A definitive answer (404/410, a key or signature that does not
37
37
  * verify, a revoked, expired or mismatched artifact) is never `unreachable`. `readVerifiedDelivery` is the
38
38
  * synchronous read that also serves a stale entry while refreshing it.
39
+ *
40
+ * 1.3.0: the response may also carry a server-rendered face as a second UNSIGNED sibling, `face: { html, css }`. It is
41
+ * read the way `renderDef` is (shape-checked, malformed is dropped, never read unless the artifact verified) and cached
42
+ * beside it, and `settleDelivery` hands it out only on a `render` verdict. NOTHING HERE VOUCHES FOR IT: the signature
43
+ * does not cover it. What binds it is the signed `payload.content.faceDigest` (cert-contract 0.6.0), and a caller
44
+ * paints it only after hashing it against that digest, as the Builder card does (`src/builder/delivered-face.ts`).
45
+ *
46
+ * 2.0.0: the response may also carry the contract-1 CARD DOCUMENT as a third UNSIGNED sibling, `card` (CertREV's portal
47
+ * serves it only for a brand on contract 1). It is kept exactly as served when it is a JSON object (any other value,
48
+ * `null` included, is no card), cached beside the payload, and handed out only on a `render` verdict. Like `face`,
49
+ * NOTHING HERE VOUCHES FOR IT: the signed `payload.content.faceDigest` binds it (`contract: 1`, `doc`), and the Builder
50
+ * card prints it only after its shape check and digest check pass (`src/builder/card-contract.ts`). A read with no
51
+ * card is the 1.3.1 object exactly. The read is made with `credentials: 'omit'`: it never sends a cookie.
39
52
  */
40
53
  import type { CertChromeRenderDef } from '../builder/cert-chrome-data.js';
54
+ import { type DeliveredFaceHashes } from '../builder/delivered-face.js';
41
55
  import type { CertPayload, CertSignature, CertSuppressReason, CertVerdict, RenderContext, ResolvePublicKeyByKid } from '../contract/kernel.js';
42
56
  import { TtlCache } from './cache.js';
57
+ /**
58
+ * 1.3.0: the server-rendered face the Delivery API may serve beside the artifact. UNSIGNED and UNVERIFIED as carried
59
+ * here: paint it only when sha256 of each half's UTF-8 bytes equals the signed `payload.content.faceDigest`, and the
60
+ * digest's `defVersion` is the def served with it.
61
+ */
62
+ export interface DeliveredFace {
63
+ readonly html: string;
64
+ readonly css: string;
65
+ }
43
66
  /**
44
67
  * What one Delivery read settles to, as cached: a verified payload + its def (and, from 1.2.0, the signature it
45
68
  * verified with, so a server render can hand the signed envelope to the browser), or the reason not.
@@ -50,6 +73,18 @@ export type CachedDelivery = {
50
73
  readonly renderDef: CertChromeRenderDef | null;
51
74
  /** Absent only in a cache filled by hand (a test, a custom cache); a read always keeps it. */
52
75
  readonly signature?: CertSignature;
76
+ /** 1.3.0: the unsigned face sibling, when the response carried a well-formed one; else absent. */
77
+ readonly face?: DeliveredFace;
78
+ /** 2.0.0: the unsigned card-document sibling as served, when it was a JSON object; else absent. */
79
+ readonly card?: Readonly<Record<string, unknown>>;
80
+ /**
81
+ * 2.0.0: the digest of `card` (lowercase hex sha256 of its RFC 8785 bytes; null when it cannot be computed),
82
+ * computed once by the read that cached it; present whenever `card` is. UNVERIFIED like the card: the caller
83
+ * compares it with the signed binding.
84
+ */
85
+ readonly cardDigest?: string | null;
86
+ /** 2.0.0: the two hashes of `face`, computed once by the read; present whenever `face` is (null: no WebCrypto). */
87
+ readonly faceHashes?: DeliveredFaceHashes | null;
53
88
  } | {
54
89
  readonly kind: 'suppressed';
55
90
  readonly reason: CertSuppressReason;
@@ -65,6 +100,21 @@ export interface VerifiedDelivery {
65
100
  readonly signature?: CertSignature;
66
101
  /** 1.2.0: on a suppress verdict, true when CertREV was not reached; else undefined. */
67
102
  readonly unreachable?: true;
103
+ /**
104
+ * 1.3.0: on a `render` verdict, the server-rendered face served beside the artifact, when the response carried a
105
+ * well-formed one; else undefined (never on a suppress verdict). UNVERIFIED: see `DeliveredFace`.
106
+ */
107
+ readonly face?: DeliveredFace;
108
+ /**
109
+ * 2.0.0: on a `render` verdict, the card document served beside the artifact (a JSON object, exactly as served);
110
+ * else undefined. UNVERIFIED: print it only after `parseCardDocument` and the digest check of
111
+ * `src/builder/card-contract.ts`, against the verified payload's `faceDigest`.
112
+ */
113
+ readonly card?: Readonly<Record<string, unknown>>;
114
+ /** 2.0.0: `card`'s digest as the read computed it, beside `card`; see `CachedDelivery`. */
115
+ readonly cardDigest?: string | null;
116
+ /** 2.0.0: `face`'s hashes as the read computed them, beside `face`; see `CachedDelivery`. */
117
+ readonly faceHashes?: DeliveredFaceHashes | null;
68
118
  }
69
119
  export interface GetVerifiedDeliveryOptions {
70
120
  /** Base URL of the CertREV app that serves the Delivery API, e.g. 'https://portal.certrev.com'. */
@@ -128,6 +178,12 @@ export declare function designPinFromUrl(url: string | URL): {
128
178
  * `resolveBlockTheme` re-validates each at paint time and drops what is not a safe value.
129
179
  */
130
180
  export declare function parseRenderDef(value: unknown): CertChromeRenderDef | null;
181
+ /**
182
+ * 1.3.0: the face sibling, shape-checked: an object whose `html` and `css` are both strings, copied to exactly those
183
+ * two keys. Anything else is null, and the card paints exactly what it paints with no face. The markup is NOT judged
184
+ * here; the signed digest judges it at paint time.
185
+ */
186
+ export declare function parseDeliveredFace(value: unknown): DeliveredFace | null;
131
187
  /** Apply the render-time policy to a cached read: lifecycle + subject at THIS render's clock. */
132
188
  export declare function settleDelivery(cached: CachedDelivery, context: RenderContext): VerifiedDelivery;
133
189
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"get-verified-delivery.d.ts","sourceRoot":"","sources":["../../src/verify/get-verified-delivery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AACzE,OAAO,KAAK,EAEX,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAGrC;;;GAGG;AACH,MAAM,MAAM,cAAc,GACvB;IACA,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;IAC7B,QAAQ,CAAC,SAAS,EAAE,mBAAmB,GAAG,IAAI,CAAA;IAC9C,8FAA8F;IAC9F,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAA;CACjC,GACD;IACA,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;IAC3B,QAAQ,CAA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kB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,GAAG,IAAI,CAKvE;AAyDD,iGAAiG;AACjG,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,GAAG,gBAAgB,CAmB/F;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAUrG;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,0BAA0B,GAAG,gBAAgB,GAAG,SAAS,CAUnG;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,IAAI,CAAC,0BAA0B,EAAE,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC,GAC5G,gBAAgB,GAAG,SAAS,CAG9B;AAED,gHAAgH;AAChH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,IAAI,CAAC,0BAA0B,EAAE,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,QAAQ,CAAC,EACpG,KAAK,GAAE,QAAQ,CAAC,cAAc,CAAuB,GACnD,IAAI,CAEN;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
@@ -36,7 +36,22 @@
36
36
  * card paints its options face instead of nothing. A definitive answer (404/410, a key or signature that does not
37
37
  * verify, a revoked, expired or mismatched artifact) is never `unreachable`. `readVerifiedDelivery` is the
38
38
  * synchronous read that also serves a stale entry while refreshing it.
39
+ *
40
+ * 1.3.0: the response may also carry a server-rendered face as a second UNSIGNED sibling, `face: { html, css }`. It is
41
+ * read the way `renderDef` is (shape-checked, malformed is dropped, never read unless the artifact verified) and cached
42
+ * beside it, and `settleDelivery` hands it out only on a `render` verdict. NOTHING HERE VOUCHES FOR IT: the signature
43
+ * does not cover it. What binds it is the signed `payload.content.faceDigest` (cert-contract 0.6.0), and a caller
44
+ * paints it only after hashing it against that digest, as the Builder card does (`src/builder/delivered-face.ts`).
45
+ *
46
+ * 2.0.0: the response may also carry the contract-1 CARD DOCUMENT as a third UNSIGNED sibling, `card` (CertREV's portal
47
+ * serves it only for a brand on contract 1). It is kept exactly as served when it is a JSON object (any other value,
48
+ * `null` included, is no card), cached beside the payload, and handed out only on a `render` verdict. Like `face`,
49
+ * NOTHING HERE VOUCHES FOR IT: the signed `payload.content.faceDigest` binds it (`contract: 1`, `doc`), and the Builder
50
+ * card prints it only after its shape check and digest check pass (`src/builder/card-contract.ts`). A read with no
51
+ * card is the 1.3.1 object exactly. The read is made with `credentials: 'omit'`: it never sends a cookie.
39
52
  */
53
+ import { cardDocumentDigest } from '../builder/card-contract.js';
54
+ import { hashDeliveredFace } from '../builder/delivered-face.js';
40
55
  import { renderVerdict, verifyArtifact } from '../contract/kernel.js';
41
56
  import { TtlCache } from './cache.js';
42
57
  import { DEFAULT_FETCH_TIMEOUT_MS, fetchWithDeadline } from './fetch-with-deadline.js';
@@ -154,12 +169,25 @@ export function parseRenderDef(value) {
154
169
  ...(face ? { customFace: face } : {}),
155
170
  };
156
171
  }
172
+ /**
173
+ * 1.3.0: the face sibling, shape-checked: an object whose `html` and `css` are both strings, copied to exactly those
174
+ * two keys. Anything else is null, and the card paints exactly what it paints with no face. The markup is NOT judged
175
+ * here; the signed digest judges it at paint time.
176
+ */
177
+ export function parseDeliveredFace(value) {
178
+ if (!isRecord(value))
179
+ return null;
180
+ const { html, css } = value;
181
+ if (!isString(html) || !isString(css))
182
+ return null;
183
+ return { html, css };
184
+ }
157
185
  /** Fetch, parse and cryptographically verify one Delivery response. Never throws. */
158
186
  async function loadDelivery(opts) {
159
187
  const fetchImpl = opts.fetchImpl ?? globalThis.fetch;
160
188
  let res;
161
189
  try {
162
- res = await fetchWithDeadline(fetchImpl, deliveryUrl(opts.baseUrl, opts.platform, opts.externalId, opts.design), { headers: { accept: 'application/json' } }, opts.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS);
190
+ res = await fetchWithDeadline(fetchImpl, deliveryUrl(opts.baseUrl, opts.platform, opts.externalId, opts.design), { headers: { accept: 'application/json' }, credentials: 'omit' }, opts.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS);
163
191
  }
164
192
  catch {
165
193
  // Unreachable, DNS/TLS, or the deadline. Same least-wrong member as getVerifiedEnvelope.
@@ -183,8 +211,8 @@ async function loadDelivery(opts) {
183
211
  let verdict;
184
212
  try {
185
213
  // `verifyArtifact`, so a tombstone verifies as itself and reports 'revoked'. The kernel reads
186
- // `payload` + `signature` (or the tombstone's own fields); the `renderDef` sibling is not
187
- // part of what is verified, and is never read unless the artifact verified.
214
+ // `payload` + `signature` (or the tombstone's own fields); the `renderDef` and (1.3.0) `face`
215
+ // siblings are not part of what is verified, and are never read unless the artifact verified.
188
216
  verdict = await verifyArtifact(body, opts.resolveKid, { ...opts.context });
189
217
  }
190
218
  catch {
@@ -194,11 +222,20 @@ async function loadDelivery(opts) {
194
222
  return suppressed(verdict.reason);
195
223
  // A `render` verdict came from an envelope (a tombstone never renders), so `signature` is the one just verified.
196
224
  const signature = isRecord(body.signature) ? body.signature : undefined;
225
+ const face = parseDeliveredFace(body.face);
226
+ const card = isRecord(body.card) ? body.card : undefined;
227
+ // 2.0.0: the digests a render compares with the signed binding, computed here, once per read, so a render that waited
228
+ // for this read never waits a second time. Under React 19, `use` matches promises by their order in a render: a
229
+ // second suspension (on a digest) after the first (on this read) was handed this read's result, and the card failed.
230
+ const cardDigest = card ? await cardDocumentDigest(card) : undefined;
231
+ const faceHashes = face ? await hashDeliveredFace(face) : undefined;
197
232
  return {
198
233
  kind: 'verified',
199
234
  payload: verdict.payload,
200
235
  renderDef: parseRenderDef(body.renderDef),
201
236
  ...(signature ? { signature } : {}),
237
+ ...(face ? { face, faceHashes } : {}),
238
+ ...(card ? { card, cardDigest } : {}),
202
239
  };
203
240
  }
204
241
  /** Apply the render-time policy to a cached read: lifecycle + subject at THIS render's clock. */
@@ -213,7 +250,15 @@ export function settleDelivery(cached, context) {
213
250
  const verdict = renderVerdict(cached.payload, context);
214
251
  if (verdict.decision !== 'render')
215
252
  return { verdict, renderDef: null };
216
- return { verdict, renderDef: cached.renderDef, ...(cached.signature ? { signature: cached.signature } : {}) };
253
+ return {
254
+ verdict,
255
+ renderDef: cached.renderDef,
256
+ ...(cached.signature ? { signature: cached.signature } : {}),
257
+ ...(cached.face ? { face: cached.face } : {}),
258
+ ...(cached.faceHashes !== undefined ? { faceHashes: cached.faceHashes } : {}),
259
+ ...(cached.card ? { card: cached.card } : {}),
260
+ ...(cached.cardDigest !== undefined ? { cardDigest: cached.cardDigest } : {}),
261
+ };
217
262
  }
218
263
  /**
219
264
  * Fetch (if needed), verify, cache, and settle one Delivery read for one placement. FAIL-CLOSED:
@@ -1 +1 @@
1
- {"version":3,"file":"get-verified-delivery.js","sourceRoot":"","sources":["../../src/verify/get-verified-delivery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAYH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAiEtF,kFAAkF;AAClF,MAAM,mBAAmB,GAAG,IAAI,QAAQ,CAAiB,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAA;AAEjG,SAAS,UAAU,CAAC,MAA0B;IAC7C,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,CAAA;AACtC,CAAC;AAED,4GAA4G;AAC5G,SAAS,WAAW;IACnB,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,8BAA8B,EAAE,WAAW,EAAE,IAAI,EAAE,CAAA;AACzF,CAAC;AAED,MAAM,aAAa,GAAG,CAAC,CAAiB,EAAW,E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AAI,KAAK,YAAY,EAC9B,IAAI,CAAC,KAAK,EACV,aAAa,CACb,CAAA;IACD,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;AAC/E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CACnC,IAA8G;IAE9G,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,mBAAmB,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAA;IAC/E,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;AAC/E,CAAC;AAED,gHAAgH;AAChH,MAAM,UAAU,kBAAkB,CACjC,IAAoG,EACpG,QAAkC,mBAAmB;IAErD,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAA;AACrC,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * ─────────────────────────────────────────────────────────────────────────────
3
+ * The issuer key SET a card trusts (2.0.0): baked keys first, then CertREV's signed published set
4
+ * ─────────────────────────────────────────────────────────────────────────────
5
+ *
6
+ * Through 1.3.x the Builder card trusted exactly one baked key (`cert-issuer-1`), so a key rotation would have needed
7
+ * every brand to install a new package. 2.0 trusts a SET without adding a trust root:
8
+ *
9
+ * 1. A kid the package bakes resolves to the baked key, always (a published set never overrides a baked key).
10
+ * 2. Any other kid makes ONE read of the delivery origin's published key set, `GET <origin>/api/cert/v1/keys`
11
+ * (`credentials: 'omit'`, the card's deadline): a browser reads it at most once per page and origin, a server at
12
+ * most once per origin per hour (single-flight, a failure remembered for ten minutes).
13
+ * 3. The set is accepted only when it is signed by a BAKED kid, over the RFC 8785 bytes of exactly this object:
14
+ *
15
+ * { kind: 'certrev.keyset', v: 1, issuedAt, keys: [{ kid, crv: 'Ed25519', x }] } (x: base64url, 32 bytes)
16
+ *
17
+ * answered as `{ keyset, signature: { alg: 'ed25519', kid, sig, signedAt? } }`. Refused: another `kind` or `v`
18
+ * (an envelope, a tombstone or a release record can never verify as a key set: their signed bytes are other
19
+ * objects), a set whose `issuedAt` is older than the one already accepted from that origin (no rollback), a set
20
+ * whose keys do not hold its signer's kid with the same key (it may not drop or replace the key that vouches for
21
+ * it), a malformed key, a signature that does not verify.
22
+ * 4. Anything else (no route, a network error, a refused set) leaves the kid unknown: the kernel suppresses the
23
+ * envelope with `unknown_key`, so the card renders nothing and reports, exactly as for an unknown kid in 1.3.x.
24
+ *
25
+ * The route is the portal's (ADR 0001 section 3 addendum). Today every envelope is signed by the baked
26
+ * `cert-issuer-1`, so step 2 never runs and nothing is fetched.
27
+ */
28
+ import { type Ed25519PublicKeyInput, type ResolvePublicKeyByKid } from '../contract/kernel.js';
29
+ /** Where an origin publishes its key set. */
30
+ export declare const KEY_SET_PATH = "/api/cert/v1/keys";
31
+ /** The signed object, exactly as the portal canonicalizes and signs it. */
32
+ export interface PublishedKeySet {
33
+ readonly kind: 'certrev.keyset';
34
+ readonly v: 1;
35
+ readonly issuedAt: string;
36
+ readonly keys: ReadonlyArray<{
37
+ readonly kid: string;
38
+ readonly crv: 'Ed25519';
39
+ readonly x: string;
40
+ }>;
41
+ }
42
+ /** An accepted set: the keys it publishes, and when it was issued (for the no-rollback rule). */
43
+ export interface AcceptedKeySet {
44
+ readonly issuedAt: number;
45
+ readonly keys: ReadonlyMap<string, Ed25519PublicKeyInput>;
46
+ }
47
+ /**
48
+ * Judge one key-set response body against the baked keys (and the set already accepted from the same origin, for
49
+ * the no-rollback rule). Returns the accepted set, or null. Never throws.
50
+ */
51
+ export declare function verifyKeySet(body: unknown, bakedResolveKid: ResolvePublicKeyByKid, previous?: AcceptedKeySet): Promise<AcceptedKeySet | null>;
52
+ export interface KeySetResolverOptions {
53
+ /** The delivery origin the card reads (the marker's `baseUrl`). */
54
+ readonly baseUrl: string;
55
+ /** The baked kids (the package's own trust root). */
56
+ readonly bakedResolveKid: ResolvePublicKeyByKid;
57
+ readonly fetchImpl: typeof fetch;
58
+ readonly timeoutMs?: number;
59
+ }
60
+ /**
61
+ * The resolver a card verifies with: the baked kids, then (for any other kid) the origin's published, signed set.
62
+ * Never throws; an unresolved kid is null (`unknown_key`).
63
+ */
64
+ export declare function keySetResolver(opts: KeySetResolverOptions): ResolvePublicKeyByKid;
65
+ /** Test seam: forget every published set (a new page and process). */
66
+ export declare function forgetKeySetsForTests(): void;
67
+ //# sourceMappingURL=key-set.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key-set.d.ts","sourceRoot":"","sources":["../../src/verify/key-set.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAGN,KAAK,qBAAqB,EAE1B,KAAK,qBAAqB,EAC1B,MAAM,uBAAuB,CAAA;AAI9B,6CAA6C;AAC7C,eAAO,MAAM,YAAY,sBAAsB,CAAA;AAE/C,2EAA2E;AAC3E,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAA;IAC/B,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAA;IACb,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;QAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACnG;AAED,iGAAiG;AACjG,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;CACzD;AA4BD;;;GAGG;AACH,wBAAsB,YAAY,CACjC,IAAI,EAAE,OAAO,EACb,eAAe,EAAE,qBAAqB,EACtC,QAAQ,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA2ChC;AAED,MAAM,WAAW,qBAAqB;IACrC,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,qDAAqD;IACrD,QAAQ,CAAC,eAAe,EAAE,qBAAqB,CAAA;IAC/C,QAAQ,CAAC,SAAS,EAAE,OAAO,KAAK,CAAA;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC3B;AA+DD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,qBAAqB,GAAG,qBAAqB,CASjF;AAED,sEAAsE;AACtE,wBAAgB,qBAAqB,IAAI,IAAI,CAI5C"}
@@ -0,0 +1,190 @@
1
+ /**
2
+ * ─────────────────────────────────────────────────────────────────────────────
3
+ * The issuer key SET a card trusts (2.0.0): baked keys first, then CertREV's signed published set
4
+ * ─────────────────────────────────────────────────────────────────────────────
5
+ *
6
+ * Through 1.3.x the Builder card trusted exactly one baked key (`cert-issuer-1`), so a key rotation would have needed
7
+ * every brand to install a new package. 2.0 trusts a SET without adding a trust root:
8
+ *
9
+ * 1. A kid the package bakes resolves to the baked key, always (a published set never overrides a baked key).
10
+ * 2. Any other kid makes ONE read of the delivery origin's published key set, `GET <origin>/api/cert/v1/keys`
11
+ * (`credentials: 'omit'`, the card's deadline): a browser reads it at most once per page and origin, a server at
12
+ * most once per origin per hour (single-flight, a failure remembered for ten minutes).
13
+ * 3. The set is accepted only when it is signed by a BAKED kid, over the RFC 8785 bytes of exactly this object:
14
+ *
15
+ * { kind: 'certrev.keyset', v: 1, issuedAt, keys: [{ kid, crv: 'Ed25519', x }] } (x: base64url, 32 bytes)
16
+ *
17
+ * answered as `{ keyset, signature: { alg: 'ed25519', kid, sig, signedAt? } }`. Refused: another `kind` or `v`
18
+ * (an envelope, a tombstone or a release record can never verify as a key set: their signed bytes are other
19
+ * objects), a set whose `issuedAt` is older than the one already accepted from that origin (no rollback), a set
20
+ * whose keys do not hold its signer's kid with the same key (it may not drop or replace the key that vouches for
21
+ * it), a malformed key, a signature that does not verify.
22
+ * 4. Anything else (no route, a network error, a refused set) leaves the kid unknown: the kernel suppresses the
23
+ * envelope with `unknown_key`, so the card renders nothing and reports, exactly as for an unknown kid in 1.3.x.
24
+ *
25
+ * The route is the portal's (ADR 0001 section 3 addendum). Today every envelope is signed by the baked
26
+ * `cert-issuer-1`, so step 2 never runs and nothing is fetched.
27
+ */
28
+ import { base64urlDecode, canonicalBytes, importEd25519PublicKey, } from '../contract/kernel.js';
29
+ import { TtlCache } from './cache.js';
30
+ import { DEFAULT_FETCH_TIMEOUT_MS, fetchWithDeadline } from './fetch-with-deadline.js';
31
+ /** Where an origin publishes its key set. */
32
+ export const KEY_SET_PATH = '/api/cert/v1/keys';
33
+ const ED25519 = { name: 'Ed25519' };
34
+ const isRecord = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
35
+ const isString = (v) => typeof v === 'string';
36
+ function rawKey(x) {
37
+ if (!isString(x) || !/^[A-Za-z0-9_-]+$/.test(x))
38
+ return null;
39
+ try {
40
+ const bytes = base64urlDecode(x);
41
+ return bytes.length === 32 ? bytes : null;
42
+ }
43
+ catch {
44
+ return null;
45
+ }
46
+ }
47
+ /** Ed25519 verify under a declared key or an imported one; any failure (a bad key, no WebCrypto Ed25519) is false. */
48
+ async function verifies(key, sig, bytes) {
49
+ try {
50
+ const imported = 'format' in key ? await importEd25519PublicKey(key) : key;
51
+ // Fresh ArrayBuffer-backed copies: WebCrypto's BufferSource excludes a SharedArrayBuffer view.
52
+ return await crypto.subtle.verify(ED25519, imported, new Uint8Array(sig), new Uint8Array(bytes));
53
+ }
54
+ catch {
55
+ return false;
56
+ }
57
+ }
58
+ /**
59
+ * Judge one key-set response body against the baked keys (and the set already accepted from the same origin, for
60
+ * the no-rollback rule). Returns the accepted set, or null. Never throws.
61
+ */
62
+ export async function verifyKeySet(body, bakedResolveKid, previous) {
63
+ if (!isRecord(body) || !isRecord(body.keyset) || !isRecord(body.signature))
64
+ return null;
65
+ const { keyset, signature } = body;
66
+ if (keyset.kind !== 'certrev.keyset' || keyset.v !== 1)
67
+ return null;
68
+ if (!isString(keyset.issuedAt))
69
+ return null;
70
+ const issuedAt = Date.parse(keyset.issuedAt);
71
+ if (!Number.isFinite(issuedAt))
72
+ return null;
73
+ if (previous && issuedAt < previous.issuedAt)
74
+ return null;
75
+ if (!Array.isArray(keyset.keys) || keyset.keys.length === 0)
76
+ return null;
77
+ if (signature.alg !== 'ed25519' || !isString(signature.kid) || !isString(signature.sig))
78
+ return null;
79
+ // The signer must be a kid this package bakes.
80
+ let baked;
81
+ try {
82
+ baked = await bakedResolveKid(signature.kid);
83
+ }
84
+ catch {
85
+ return null;
86
+ }
87
+ if (!baked)
88
+ return null;
89
+ const keys = new Map();
90
+ for (const entry of keyset.keys) {
91
+ if (!isRecord(entry) || !isString(entry.kid) || entry.kid === '' || entry.crv !== 'Ed25519')
92
+ return null;
93
+ const bytes = rawKey(entry.x);
94
+ if (!bytes || keys.has(entry.kid))
95
+ return null;
96
+ keys.set(entry.kid, { format: 'raw', bytes });
97
+ }
98
+ // The set must keep the key that signed it.
99
+ const signerEntry = keys.get(signature.kid);
100
+ if (!signerEntry)
101
+ return null;
102
+ let sig;
103
+ let bytes;
104
+ try {
105
+ sig = base64urlDecode(signature.sig);
106
+ bytes = canonicalBytes(keyset);
107
+ }
108
+ catch {
109
+ return null;
110
+ }
111
+ if (!(await verifies(baked, sig, bytes)))
112
+ return null;
113
+ // ... and publish it as the same key: the signature must verify under the published entry too.
114
+ if (!(await verifies(signerEntry, sig, bytes)))
115
+ return null;
116
+ return { issuedAt, keys };
117
+ }
118
+ /** Server: one read per origin per hour, a failure remembered for ten minutes (single-flight across renders). */
119
+ const serverSets = new TtlCache({ ttlMs: 3_600_000, negativeTtlMs: 600_000, maxEntries: 50 });
120
+ /** Browser: one read per origin for the page's lifetime, whatever it settled to. */
121
+ const pageSets = new Map();
122
+ /** The newest set accepted per origin (both runtimes), for the no-rollback rule. */
123
+ const acceptedSets = new Map();
124
+ function originOf(baseUrl) {
125
+ try {
126
+ return new URL(baseUrl).origin;
127
+ }
128
+ catch {
129
+ return null;
130
+ }
131
+ }
132
+ async function loadKeySet(origin, opts) {
133
+ let res;
134
+ try {
135
+ res = await fetchWithDeadline(opts.fetchImpl, `${origin}${KEY_SET_PATH}`, { headers: { accept: 'application/json' }, credentials: 'omit' }, opts.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS);
136
+ }
137
+ catch {
138
+ return acceptedSets.get(origin) ?? null;
139
+ }
140
+ if (!res.ok)
141
+ return acceptedSets.get(origin) ?? null;
142
+ let body;
143
+ try {
144
+ body = await res.json();
145
+ }
146
+ catch {
147
+ return acceptedSets.get(origin) ?? null;
148
+ }
149
+ const previous = acceptedSets.get(origin);
150
+ const accepted = await verifyKeySet(body, opts.bakedResolveKid, previous);
151
+ // A refused set (older, unsigned, malformed) never replaces one this origin already proved.
152
+ if (!accepted)
153
+ return previous ?? null;
154
+ acceptedSets.set(origin, accepted);
155
+ return accepted;
156
+ }
157
+ function publishedSet(origin, opts) {
158
+ if (typeof document !== 'undefined') {
159
+ let pending = pageSets.get(origin);
160
+ if (!pending) {
161
+ pending = loadKeySet(origin, opts);
162
+ pageSets.set(origin, pending);
163
+ }
164
+ return pending;
165
+ }
166
+ return serverSets.getOrLoad(origin, () => loadKeySet(origin, opts), (v) => v === null);
167
+ }
168
+ /**
169
+ * The resolver a card verifies with: the baked kids, then (for any other kid) the origin's published, signed set.
170
+ * Never throws; an unresolved kid is null (`unknown_key`).
171
+ */
172
+ export function keySetResolver(opts) {
173
+ return async (kid) => {
174
+ const baked = await opts.bakedResolveKid(kid);
175
+ if (baked)
176
+ return baked;
177
+ const origin = originOf(opts.baseUrl);
178
+ if (!origin)
179
+ return null;
180
+ const set = await publishedSet(origin, opts);
181
+ return set?.keys.get(kid) ?? null;
182
+ };
183
+ }
184
+ /** Test seam: forget every published set (a new page and process). */
185
+ export function forgetKeySetsForTests() {
186
+ serverSets.clear();
187
+ pageSets.clear();
188
+ acceptedSets.clear();
189
+ }
190
+ //# sourceMappingURL=key-set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key-set.js","sourceRoot":"","sources":["../../src/verify/key-set.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACN,eAAe,EACf,cAAc,EAEd,sBAAsB,GAEtB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAEtF,6CAA6C;AAC7C,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAAA;AAgB/C,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,SAAS,EAAW,CAAA;AAE5C,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAgC,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AACvH,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAA;AAEnE,SAAS,MAAM,CAAC,CAAU;IACzB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAA;IAC5D,IAAI,CAAC;QACJ,MAAM,KAAK,GAAG,eAAe,CAAC,CAAC,CAAC,CAAA;QAChC,OAAO,KAAK,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,C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