@certrev/cert-block 1.3.0 → 2.0.1
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/CHANGELOG.md +235 -0
- package/README.md +162 -9
- package/dist/builder/card-beacon.d.ts +73 -0
- package/dist/builder/card-beacon.d.ts.map +1 -0
- package/dist/builder/card-beacon.js +178 -0
- package/dist/builder/card-beacon.js.map +1 -0
- package/dist/builder/card-contract.d.ts +151 -0
- package/dist/builder/card-contract.d.ts.map +1 -0
- package/dist/builder/card-contract.js +286 -0
- package/dist/builder/card-contract.js.map +1 -0
- package/dist/builder/card-placement.d.ts +45 -0
- package/dist/builder/card-placement.d.ts.map +1 -0
- package/dist/builder/card-placement.js +193 -0
- package/dist/builder/card-placement.js.map +1 -0
- package/dist/builder/card-report.d.ts +49 -0
- package/dist/builder/card-report.d.ts.map +1 -0
- package/dist/builder/card-report.js +97 -0
- package/dist/builder/card-report.js.map +1 -0
- package/dist/builder/cert-review-card.d.ts +7 -5
- package/dist/builder/cert-review-card.d.ts.map +1 -1
- package/dist/builder/cert-review-card.js +202 -170
- package/dist/builder/cert-review-card.js.map +1 -1
- package/dist/builder/contract-card.d.ts +70 -0
- package/dist/builder/contract-card.d.ts.map +1 -0
- package/dist/builder/contract-card.js +191 -0
- package/dist/builder/contract-card.js.map +1 -0
- package/dist/builder/delivered-face.d.ts +9 -0
- package/dist/builder/delivered-face.d.ts.map +1 -1
- package/dist/builder/delivered-face.js +18 -5
- package/dist/builder/delivered-face.js.map +1 -1
- package/dist/builder/delivery-runtime.d.ts +27 -3
- package/dist/builder/delivery-runtime.d.ts.map +1 -1
- package/dist/builder/delivery-runtime.js +40 -4
- package/dist/builder/delivery-runtime.js.map +1 -1
- package/dist/builder/index.d.ts +7 -4
- package/dist/builder/index.d.ts.map +1 -1
- package/dist/builder/index.js +8 -4
- package/dist/builder/index.js.map +1 -1
- package/dist/builder/ssr-seed.d.ts +23 -4
- package/dist/builder/ssr-seed.d.ts.map +1 -1
- package/dist/builder/ssr-seed.js +29 -6
- package/dist/builder/ssr-seed.js.map +1 -1
- package/dist/builder/version.d.ts +3 -0
- package/dist/builder/version.d.ts.map +1 -0
- package/dist/builder/version.js +3 -0
- package/dist/builder/version.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/reader/reader-css.generated.d.ts +1 -1
- package/dist/reader/reader-css.generated.d.ts.map +1 -1
- package/dist/reader/reader-css.generated.js +1 -1
- package/dist/reader/reader-css.generated.js.map +1 -1
- package/dist/reader/render.d.ts.map +1 -1
- package/dist/reader/render.js +71 -34
- package/dist/reader/render.js.map +1 -1
- package/dist/reader/tokens.d.ts +2 -0
- package/dist/reader/tokens.d.ts.map +1 -1
- package/dist/reader/tokens.js +28 -6
- package/dist/reader/tokens.js.map +1 -1
- package/dist/verify/get-verified-delivery.d.ts +32 -0
- package/dist/verify/get-verified-delivery.d.ts.map +1 -1
- package/dist/verify/get-verified-delivery.js +30 -5
- package/dist/verify/get-verified-delivery.js.map +1 -1
- package/dist/verify/key-set.d.ts +67 -0
- package/dist/verify/key-set.d.ts.map +1 -0
- package/dist/verify/key-set.js +190 -0
- package/dist/verify/key-set.js.map +1 -0
- package/package.json +115 -112
- package/src/builder/card-beacon.ts +201 -0
- package/src/builder/card-contract.ts +336 -0
- package/src/builder/card-placement.ts +208 -0
- package/src/builder/card-report.ts +126 -0
- package/src/builder/cert-review-card.tsx +285 -201
- package/src/builder/contract-card.tsx +216 -0
- package/src/builder/delivered-face.ts +18 -4
- package/src/builder/delivery-runtime.ts +46 -4
- package/src/builder/index.tsx +16 -4
- package/src/builder/ssr-seed.ts +37 -7
- package/src/builder/version.ts +2 -0
- package/src/index.ts +9 -0
- package/src/reader/reader-css.generated.ts +1 -1
- package/src/reader/reader.css +297 -2
- package/src/reader/render.ts +87 -38
- package/src/reader/tokens.ts +29 -6
- package/src/verify/get-verified-delivery.ts +54 -5
- package/src/verify/key-set.ts +225 -0
|
@@ -42,8 +42,16 @@
|
|
|
42
42
|
* beside it, and `settleDelivery` hands it out only on a `render` verdict. NOTHING HERE VOUCHES FOR IT: the signature
|
|
43
43
|
* does not cover it. What binds it is the signed `payload.content.faceDigest` (cert-contract 0.6.0), and a caller
|
|
44
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.
|
|
45
52
|
*/
|
|
46
53
|
import type { CertChromeRenderDef } from '../builder/cert-chrome-data.js';
|
|
54
|
+
import { type DeliveredFaceHashes } from '../builder/delivered-face.js';
|
|
47
55
|
import type { CertPayload, CertSignature, CertSuppressReason, CertVerdict, RenderContext, ResolvePublicKeyByKid } from '../contract/kernel.js';
|
|
48
56
|
import { TtlCache } from './cache.js';
|
|
49
57
|
/**
|
|
@@ -67,11 +75,23 @@ export type CachedDelivery = {
|
|
|
67
75
|
readonly signature?: CertSignature;
|
|
68
76
|
/** 1.3.0: the unsigned face sibling, when the response carried a well-formed one; else absent. */
|
|
69
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;
|
|
70
88
|
} | {
|
|
71
89
|
readonly kind: 'suppressed';
|
|
72
90
|
readonly reason: CertSuppressReason;
|
|
73
91
|
/** 1.2.0: true when CertREV was not reached (no answer about the credential); see the module header. */
|
|
74
92
|
readonly unreachable?: true;
|
|
93
|
+
/** 2.0.1: the HTTP status, when CertREV answered with a non-OK status other than 404/410. */
|
|
94
|
+
readonly status?: number;
|
|
75
95
|
};
|
|
76
96
|
/** The answer for one render: the verdict AT THIS RENDER'S CLOCK, and the def to paint it with. */
|
|
77
97
|
export interface VerifiedDelivery {
|
|
@@ -82,11 +102,23 @@ export interface VerifiedDelivery {
|
|
|
82
102
|
readonly signature?: CertSignature;
|
|
83
103
|
/** 1.2.0: on a suppress verdict, true when CertREV was not reached; else undefined. */
|
|
84
104
|
readonly unreachable?: true;
|
|
105
|
+
/** 2.0.1: with `unreachable`, the HTTP status when CertREV answered with one (a 5xx, a 429, ...); else undefined. */
|
|
106
|
+
readonly status?: number;
|
|
85
107
|
/**
|
|
86
108
|
* 1.3.0: on a `render` verdict, the server-rendered face served beside the artifact, when the response carried a
|
|
87
109
|
* well-formed one; else undefined (never on a suppress verdict). UNVERIFIED: see `DeliveredFace`.
|
|
88
110
|
*/
|
|
89
111
|
readonly face?: DeliveredFace;
|
|
112
|
+
/**
|
|
113
|
+
* 2.0.0: on a `render` verdict, the card document served beside the artifact (a JSON object, exactly as served);
|
|
114
|
+
* else undefined. UNVERIFIED: print it only after `parseCardDocument` and the digest check of
|
|
115
|
+
* `src/builder/card-contract.ts`, against the verified payload's `faceDigest`.
|
|
116
|
+
*/
|
|
117
|
+
readonly card?: Readonly<Record<string, unknown>>;
|
|
118
|
+
/** 2.0.0: `card`'s digest as the read computed it, beside `card`; see `CachedDelivery`. */
|
|
119
|
+
readonly cardDigest?: string | null;
|
|
120
|
+
/** 2.0.0: `face`'s hashes as the read computed them, beside `face`; see `CachedDelivery`. */
|
|
121
|
+
readonly faceHashes?: DeliveredFaceHashes | null;
|
|
90
122
|
}
|
|
91
123
|
export interface GetVerifiedDeliveryOptions {
|
|
92
124
|
/** Base URL of the CertREV app that serves the Delivery API, e.g. 'https://portal.certrev.com'. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-verified-delivery.d.ts","sourceRoot":"","sources":["../../src/verify/get-verified-delivery.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"get-verified-delivery.d.ts","sourceRoot":"","sources":["../../src/verify/get-verified-delivery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AACzE,OAAO,EAAE,KAAK,mBAAmB,EAAqB,MAAM,8BAA8B,CAAA;AAC1F,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;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACpB;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GACvB;IACA,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;IAC7B,QAAQ,CAA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AmB,EAAE,CAAA"}
|
|
@@ -42,7 +42,16 @@
|
|
|
42
42
|
* beside it, and `settleDelivery` hands it out only on a `render` verdict. NOTHING HERE VOUCHES FOR IT: the signature
|
|
43
43
|
* does not cover it. What binds it is the signed `payload.content.faceDigest` (cert-contract 0.6.0), and a caller
|
|
44
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.
|
|
45
52
|
*/
|
|
53
|
+
import { cardDocumentDigest } from '../builder/card-contract.js';
|
|
54
|
+
import { hashDeliveredFace } from '../builder/delivered-face.js';
|
|
46
55
|
import { renderVerdict, verifyArtifact } from '../contract/kernel.js';
|
|
47
56
|
import { TtlCache } from './cache.js';
|
|
48
57
|
import { DEFAULT_FETCH_TIMEOUT_MS, fetchWithDeadline } from './fetch-with-deadline.js';
|
|
@@ -52,8 +61,13 @@ function suppressed(reason) {
|
|
|
52
61
|
return { kind: 'suppressed', reason };
|
|
53
62
|
}
|
|
54
63
|
/** A read that did not reach CertREV: the same least-wrong reason as before 1.2.0, marked `unreachable`. */
|
|
55
|
-
function unreachable() {
|
|
56
|
-
return {
|
|
64
|
+
function unreachable(status) {
|
|
65
|
+
return {
|
|
66
|
+
kind: 'suppressed',
|
|
67
|
+
reason: 'unsupported_contract_version',
|
|
68
|
+
unreachable: true,
|
|
69
|
+
...(status === undefined ? {} : { status }),
|
|
70
|
+
};
|
|
57
71
|
}
|
|
58
72
|
const isUnreachable = (v) => v.kind === 'suppressed' && v.unreachable === true;
|
|
59
73
|
/** The Delivery route; a design pin adds `?design=<v>` and, with a brand, `&designBrand=<brand>`. */
|
|
@@ -178,7 +192,7 @@ async function loadDelivery(opts) {
|
|
|
178
192
|
const fetchImpl = opts.fetchImpl ?? globalThis.fetch;
|
|
179
193
|
let res;
|
|
180
194
|
try {
|
|
181
|
-
res = await fetchWithDeadline(fetchImpl, deliveryUrl(opts.baseUrl, opts.platform, opts.externalId, opts.design), { headers: { accept: 'application/json' } }, opts.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS);
|
|
195
|
+
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);
|
|
182
196
|
}
|
|
183
197
|
catch {
|
|
184
198
|
// Unreachable, DNS/TLS, or the deadline. Same least-wrong member as getVerifiedEnvelope.
|
|
@@ -189,7 +203,7 @@ async function loadDelivery(opts) {
|
|
|
189
203
|
if (res.status === 404 || res.status === 410)
|
|
190
204
|
return suppressed('subject_mismatch');
|
|
191
205
|
if (!res.ok)
|
|
192
|
-
return unreachable();
|
|
206
|
+
return unreachable(res.status);
|
|
193
207
|
let body;
|
|
194
208
|
try {
|
|
195
209
|
body = await res.json();
|
|
@@ -214,12 +228,19 @@ async function loadDelivery(opts) {
|
|
|
214
228
|
// A `render` verdict came from an envelope (a tombstone never renders), so `signature` is the one just verified.
|
|
215
229
|
const signature = isRecord(body.signature) ? body.signature : undefined;
|
|
216
230
|
const face = parseDeliveredFace(body.face);
|
|
231
|
+
const card = isRecord(body.card) ? body.card : undefined;
|
|
232
|
+
// 2.0.0: the digests a render compares with the signed binding, computed here, once per read, so a render that waited
|
|
233
|
+
// for this read never waits a second time. Under React 19, `use` matches promises by their order in a render: a
|
|
234
|
+
// second suspension (on a digest) after the first (on this read) was handed this read's result, and the card failed.
|
|
235
|
+
const cardDigest = card ? await cardDocumentDigest(card) : undefined;
|
|
236
|
+
const faceHashes = face ? await hashDeliveredFace(face) : undefined;
|
|
217
237
|
return {
|
|
218
238
|
kind: 'verified',
|
|
219
239
|
payload: verdict.payload,
|
|
220
240
|
renderDef: parseRenderDef(body.renderDef),
|
|
221
241
|
...(signature ? { signature } : {}),
|
|
222
|
-
...(face ? { face } : {}),
|
|
242
|
+
...(face ? { face, faceHashes } : {}),
|
|
243
|
+
...(card ? { card, cardDigest } : {}),
|
|
223
244
|
};
|
|
224
245
|
}
|
|
225
246
|
/** Apply the render-time policy to a cached read: lifecycle + subject at THIS render's clock. */
|
|
@@ -229,6 +250,7 @@ export function settleDelivery(cached, context) {
|
|
|
229
250
|
verdict: { decision: 'suppress', reason: cached.reason },
|
|
230
251
|
renderDef: null,
|
|
231
252
|
...(cached.unreachable ? { unreachable: true } : {}),
|
|
253
|
+
...(cached.unreachable && cached.status !== undefined ? { status: cached.status } : {}),
|
|
232
254
|
};
|
|
233
255
|
}
|
|
234
256
|
const verdict = renderVerdict(cached.payload, context);
|
|
@@ -239,6 +261,9 @@ export function settleDelivery(cached, context) {
|
|
|
239
261
|
renderDef: cached.renderDef,
|
|
240
262
|
...(cached.signature ? { signature: cached.signature } : {}),
|
|
241
263
|
...(cached.face ? { face: cached.face } : {}),
|
|
264
|
+
...(cached.faceHashes !== undefined ? { faceHashes: cached.faceHashes } : {}),
|
|
265
|
+
...(cached.card ? { card: cached.card } : {}),
|
|
266
|
+
...(cached.cardDigest !== undefined ? { cardDigest: cached.cardDigest } : {}),
|
|
242
267
|
};
|
|
243
268
|
}
|
|
244
269
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-verified-delivery.js","sourceRoot":"","sources":["../../src/verify/get-verified-delivery.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"get-ver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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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