@certrev/cert-block 1.0.2 → 1.1.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/CHANGELOG.md +89 -0
- package/README.md +6 -1
- package/dist/builder/cert-chrome-data.d.ts +26 -1
- package/dist/builder/cert-chrome-data.d.ts.map +1 -1
- package/dist/builder/cert-chrome-data.js +1 -0
- package/dist/builder/cert-chrome-data.js.map +1 -1
- package/dist/builder/cert-review-card.d.ts +41 -4
- package/dist/builder/cert-review-card.d.ts.map +1 -1
- package/dist/builder/cert-review-card.js +133 -7
- package/dist/builder/cert-review-card.js.map +1 -1
- package/dist/builder/delivery-runtime.d.ts +23 -0
- package/dist/builder/delivery-runtime.d.ts.map +1 -0
- package/dist/builder/delivery-runtime.js +38 -0
- package/dist/builder/delivery-runtime.js.map +1 -0
- package/dist/builder/envelope-face.d.ts +63 -0
- package/dist/builder/envelope-face.d.ts.map +1 -0
- package/dist/builder/envelope-face.js +151 -0
- package/dist/builder/envelope-face.js.map +1 -0
- package/dist/builder/index.d.ts +15 -3
- package/dist/builder/index.d.ts.map +1 -1
- package/dist/builder/index.js +15 -3
- package/dist/builder/index.js.map +1 -1
- package/dist/builder/issuer-key.d.ts +12 -0
- package/dist/builder/issuer-key.d.ts.map +1 -0
- package/dist/builder/issuer-key.js +14 -0
- package/dist/builder/issuer-key.js.map +1 -0
- package/dist/components/memo-toggle.d.ts +42 -0
- package/dist/components/memo-toggle.d.ts.map +1 -0
- package/dist/components/memo-toggle.js +60 -0
- package/dist/components/memo-toggle.js.map +1 -0
- package/dist/components/render-cert-block.d.ts +9 -0
- package/dist/components/render-cert-block.d.ts.map +1 -1
- package/dist/components/render-cert-block.js +80 -19
- package/dist/components/render-cert-block.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/verify/get-verified-delivery.d.ts +91 -0
- package/dist/verify/get-verified-delivery.d.ts.map +1 -0
- package/dist/verify/get-verified-delivery.js +157 -0
- package/dist/verify/get-verified-delivery.js.map +1 -0
- package/package.json +5 -1
- package/src/builder/cert-chrome-data.ts +27 -0
- package/src/builder/cert-review-card.tsx +170 -10
- package/src/builder/delivery-runtime.ts +54 -0
- package/src/builder/envelope-face.ts +173 -0
- package/src/builder/index.tsx +24 -2
- package/src/builder/issuer-key.ts +13 -0
- package/src/components/memo-toggle.ts +63 -0
- package/src/components/render-cert-block.ts +121 -22
- package/src/index.ts +28 -0
- package/src/verify/get-verified-delivery.ts +211 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,95 @@ change the rendered cert output and never break a compiling integration** (regis
|
|
|
5
5
|
exports, types). Anything that would alter what a visitor sees, or require integration changes,
|
|
6
6
|
is announced loudly here first.
|
|
7
7
|
|
|
8
|
+
## 1.1.0 · 2026-09-26
|
|
9
|
+
|
|
10
|
+
Minor: the Builder card can paint from the signed envelope and the brand's render def. **Read
|
|
11
|
+
this before upgrading a Builder integration: a block that carries the new `delivery` marker
|
|
12
|
+
renders a different face from the same block's options.** This is the one deliberate exception
|
|
13
|
+
to the contract above, and it is opt-in per block: the marker is written by the CertREV exporter,
|
|
14
|
+
never by the upgrade itself.
|
|
15
|
+
|
|
16
|
+
- **No marker, no change.** A block without `delivery` (every entry exported before 1.1.0, and
|
|
17
|
+
every block an editor built by hand) renders through the options path exactly as 1.0.3 did,
|
|
18
|
+
byte for byte, including the banner bridge for entries with no `mode`. Upgrading changes no
|
|
19
|
+
pixel on an existing page. `delivery-card.test.tsx` pins this against the 1.0.3 mapping.
|
|
20
|
+
- **With the marker, the options are ignored.** `delivery: { v: 1, baseUrl }` makes
|
|
21
|
+
`CertReviewCard` read `GET {baseUrl}/api/cert/v1/delivery/builder/{entry id}`, verify the signed
|
|
22
|
+
artifact against the baked `cert-issuer-1` key (the key the storefront badge ships), and paint
|
|
23
|
+
the verified content with the render def the Delivery API serves beside it (`renderDef`): the
|
|
24
|
+
brand's accent and surface, hidden fields (e.g. no reviewer photo), rung and layout. The entry id
|
|
25
|
+
is `builderContext.content.id`, so the registration now sets
|
|
26
|
+
`shouldReceiveBuilderProps: { builderContext: true }`; a block copied onto another entry asks for
|
|
27
|
+
that entry's cert.
|
|
28
|
+
- **Fail-closed.** A revoked cert (tombstone), an expired one, a signature that does not verify,
|
|
29
|
+
an envelope for another entry, a 404/5xx/timeout, a marker that is not exactly `{ v: 1, baseUrl }`
|
|
30
|
+
with `baseUrl` an `https:` origin on `certrev.com` or a subdomain, or a missing entry id: the card
|
|
31
|
+
renders nothing. Revocation and expiry are re-judged at every render against the cached,
|
|
32
|
+
verified payload, so an expiry lands at `expiresAt`, and a revocation or def change lands within
|
|
33
|
+
the cache TTL (60s positive, 5s negative) with no republish.
|
|
34
|
+
- **Suspense.** The marker path suspends once per placement (`React.use` on React 19; the thrown
|
|
35
|
+
promise on React 18) inside its own `<Suspense fallback={null}>`, so streaming SSR resolves it
|
|
36
|
+
and hydration finds the read cached.
|
|
37
|
+
- **New API, all additive.** Root: `getVerifiedDelivery`, `peekVerifiedDelivery`,
|
|
38
|
+
`settleDelivery`, `invalidateDelivery`, `parseRenderDef`, `deliveryUrl`, `deliveryCacheKey`,
|
|
39
|
+
`sharedDeliveryCache` and their types. `./builder`: `acceptedDeliveryMarker`, the
|
|
40
|
+
`CertDeliveryMarker` type and the envelope-face helpers. New subpath `./builder/face`
|
|
41
|
+
(react-free): `envelopeCardInput`, the one mapping from verified content + def to the
|
|
42
|
+
`renderCertBlock` input, so a server-side preview renders through the same function as the card.
|
|
43
|
+
- **Wire type.** `BuilderCertChromeData` gains `delivery: CertDeliveryMarker | null` (key 20,
|
|
44
|
+
appended to `BUILDER_CERT_CHROME_KEYS`, registered as an `advanced` input with helper text
|
|
45
|
+
telling editors not to edit it). A TypeScript exporter that builds the full wire object must
|
|
46
|
+
now set it (`null` keeps the options face).
|
|
47
|
+
- **Phone face (opt-in, envelope card only).** `renderCertBlock` gains `responsive?: boolean`.
|
|
48
|
+
Only `responsive: true` changes anything; absent or `false`, every face is byte-identical to
|
|
49
|
+
1.0.3 (`render-cert-block-responsive.test.ts` pins 14 shapes against the 1.0.3 tarball's own
|
|
50
|
+
output). The envelope face (`envelopeCardInput`) always sets it, so a marker card on a viewport
|
|
51
|
+
640px wide or narrower stacks the banner header's two columns into one and clamps a long memo
|
|
52
|
+
(over 160 characters, or four or more line breaks) to 4 lines behind a native
|
|
53
|
+
`<button type="button">` ("Read the full memo" / "Show less") that flips `aria-expanded`. The
|
|
54
|
+
full memo stays in the markup, so a screen reader reads all of it in both states. Wider
|
|
55
|
+
viewports see the same card as before and no button. The rules ship as one `<style>` element,
|
|
56
|
+
first inside the card root, every rule inside `@media (max-width: 640px)` and scoped to
|
|
57
|
+
`.certrev-cert[data-certrev-responsive]`; a host that strips `<style>` or blocks it by CSP
|
|
58
|
+
(it needs `style-src 'unsafe-inline'`, as the card's inline styles already do) gets the
|
|
59
|
+
1.0.3 card, memo unclamped and button hidden. The toggle is `toggleMemo` / `memoToggleFor`,
|
|
60
|
+
new root exports with the `MEMO_*` constants, which `CertReviewCard` binds on its wrapper and
|
|
61
|
+
any other host of the phone face can call.
|
|
62
|
+
- **Unchanged:** the registered name `CertREV Cert`, the `@certrev/cert-block/builder` import,
|
|
63
|
+
`certRevCertComponent` / `BUILDER_REGISTRATION`, every existing input, the anchor path, the web
|
|
64
|
+
component and the modal bundle. `renderCertBlock` and `renderPreviewBlock` paint exactly what
|
|
65
|
+
1.0.3 painted for every input without `responsive: true`, which is every caller in the package
|
|
66
|
+
but the envelope face (the options card among them); the floating pill is unchanged in every case.
|
|
67
|
+
|
|
68
|
+
## 1.0.3 · 2026-08-18
|
|
69
|
+
|
|
70
|
+
Patch: restores the placement a pre-existing Builder entry renders. **If you integrated via
|
|
71
|
+
Builder before 1.0.0, upgrade to this from any 1.0.x.**
|
|
72
|
+
|
|
73
|
+
- **1.0.0 silently repainted already-exported Builder entries from banner to sidebar.** `mode` is
|
|
74
|
+
a PLACEMENT input, not one of the 19 wire keys, and the exporter emits only the wire projection,
|
|
75
|
+
so every entry exported to date carries no `mode` key. Through 0.5.5 `CertReviewCard` read
|
|
76
|
+
`props.mode ?? 'banner'` and those entries rendered the banner face. 1.0.0 removed that fallback
|
|
77
|
+
so the renderer would own a single default, which changed what those entries paint. Consumers
|
|
78
|
+
install unpinned, so it reached live pages with no entry edit and no upgrade on their side.
|
|
79
|
+
- **The fallback is restored, as a bridge and not as a reversal.** The sidebar default stands
|
|
80
|
+
everywhere it was actually the point: a direct `renderCertBlock` caller omitting `mode` still
|
|
81
|
+
gets sidebar, and `sidebar` is still the registered `defaultValue`, so every block created in
|
|
82
|
+
the editor from now on carries an explicit `mode` and never reaches the fallback. The bridge
|
|
83
|
+
covers only entries that predate the exporter emitting `mode`, and is deleted once the exporter
|
|
84
|
+
writes it and existing entries are backfilled. The registered enum, `defaultValue`, helper text
|
|
85
|
+
and `render-cert-block.ts` are untouched by this release.
|
|
86
|
+
- **A third gate, of a kind neither existing one could be.** The rendered-surface sweep checks
|
|
87
|
+
text that IS on a surface; the string-literal rule checks strings that ARE in the source. This
|
|
88
|
+
regression was the absence of a value: what an entry paints when an input is missing. That is
|
|
89
|
+
invisible to both, and it is why 1.0.0 shipped green. `builder.test.tsx` now pins the
|
|
90
|
+
exported-entry shape (no `mode`, and `mode: null`) to the banner face, pins an explicit `mode`
|
|
91
|
+
as still winning, and pins the direct renderer as still defaulting to sidebar so the bridge can
|
|
92
|
+
never quietly widen into a package-wide change. Confirmed to fail with the fallback removed.
|
|
93
|
+
- **One editor-facing em dash**, in the design-time anchor placeholder (`builder/index.tsx`), now
|
|
94
|
+
a colon. It is JSX text rather than a quoted string, so the 1.0.2 literal rule could not see it
|
|
95
|
+
either; recorded here because it is the same blind spot, not a separate lesson.
|
|
96
|
+
|
|
8
97
|
## 1.0.2 · 2026-08-18
|
|
9
98
|
|
|
10
99
|
Patch: copy only, in strings nobody renders. No API change, no type change, no behaviour change.
|
package/README.md
CHANGED
|
@@ -60,6 +60,11 @@ import { defineCertRevBadge, setCertRevKidResolver } from '@certrev/cert-block/w
|
|
|
60
60
|
// Builder.io registration (separate subpath; no Builder dependency)
|
|
61
61
|
import { certRevCertComponent, BUILDER_REGISTRATION, CERT_COMPONENT_NAME } from '@certrev/cert-block/builder'
|
|
62
62
|
|
|
63
|
+
// The envelope face mapping on its own (separate subpath, react-free): verified envelope content
|
|
64
|
+
// plus the brand's render def, to the renderCertBlock input a `delivery`-marker card paints.
|
|
65
|
+
// A server-side preview renders through the same function as the card.
|
|
66
|
+
import { envelopeCardInput, faceFromDef, themeFromDef, layoutFor, CERT_FACE_FIELDS } from '@certrev/cert-block/builder/face'
|
|
67
|
+
|
|
63
68
|
// Certificate modal: the ONE SIDE-EFFECTING entry in the package. Importing it registers
|
|
64
69
|
// <certrev-cert-modal> and, in a browser, starts four DOM passes (placement, interactions,
|
|
65
70
|
// FTC guard, badge revalidation). Browser only. Never import it from server code. Most
|
|
@@ -606,7 +611,7 @@ published at `@certrev/cert-block/fixtures`).
|
|
|
606
611
|
|
|
607
612
|
## Version
|
|
608
613
|
|
|
609
|
-
`1.0
|
|
614
|
+
`1.1.0`: see [CHANGELOG.md](./CHANGELOG.md) for the release history and the semver contract
|
|
610
615
|
(patch/minor never change the rendered cert output or break a compiling integration). Publishes
|
|
611
616
|
**publicly** to npm as `@certrev/cert-block` (`publishConfig.access: public`) via GitHub Actions
|
|
612
617
|
trusted publishing (OIDC); the internal `@certrev` GitHub-Packages channel mirrors it.
|
|
@@ -60,6 +60,24 @@ export interface CertChromeRenderDef {
|
|
|
60
60
|
readonly placedFields: readonly string[];
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* The DELIVERY MARKER (1.1.0): the exporter's statement that this block's cert is served,
|
|
65
|
+
* signed, by the CertREV Delivery API at `baseUrl`. When it is present the card no longer
|
|
66
|
+
* paints the other option keys: it takes its `externalId` from its own Builder entry id,
|
|
67
|
+
* fetches `GET {baseUrl}/api/cert/v1/delivery/builder/{externalId}`, verifies the envelope
|
|
68
|
+
* against the baked issuer key, and paints from the verified facts plus the brand's render
|
|
69
|
+
* def served beside them. A revoked, expired or unverifiable cert renders nothing.
|
|
70
|
+
*
|
|
71
|
+
* `baseUrl` is honoured ONLY when it is `https:` on `certrev.com` or a subdomain of it. The
|
|
72
|
+
* marker is an option like any other, so an editor can type into it; a foreign origin would
|
|
73
|
+
* let a page answer its own revocation check, and so renders nothing (never the options).
|
|
74
|
+
*/
|
|
75
|
+
export interface CertDeliveryMarker {
|
|
76
|
+
/** Marker shape version. Only `1` is understood; anything else renders nothing. */
|
|
77
|
+
readonly v: 1;
|
|
78
|
+
/** The CertREV app origin that serves the Delivery API (e.g. `https://portal.certrev.com`). */
|
|
79
|
+
readonly baseUrl: string;
|
|
80
|
+
}
|
|
63
81
|
/**
|
|
64
82
|
* The OPTIONS a brand's native cert component receives. Delivered per certified
|
|
65
83
|
* article; until the brand registers the component the block renders nothing.
|
|
@@ -134,6 +152,13 @@ export interface BuilderCertChromeData {
|
|
|
134
152
|
renderDef: CertChromeRenderDef | null;
|
|
135
153
|
/** Version of the delivered string set (`data-certrev-strings-version` for the crawl monitor). */
|
|
136
154
|
stringsVersion: string;
|
|
155
|
+
/**
|
|
156
|
+
* 1.1.0: where the signed envelope for this block is served, or null for an options-only
|
|
157
|
+
* block. Present ⇒ the card paints from the verified envelope + def and ignores the keys
|
|
158
|
+
* above; they stay on the wire so installs older than 1.1.0 keep painting during the
|
|
159
|
+
* transition. See `CertDeliveryMarker`.
|
|
160
|
+
*/
|
|
161
|
+
delivery: CertDeliveryMarker | null;
|
|
137
162
|
}
|
|
138
163
|
/**
|
|
139
164
|
* The ordered keys of `BuilderCertChromeData` — the SINGLE SOURCE the Builder
|
|
@@ -142,6 +167,6 @@ export interface BuilderCertChromeData {
|
|
|
142
167
|
* interface without adding it here (or vice-versa) fails the `keyof` exhaustiveness
|
|
143
168
|
* check in `assertChromeKeysExhaustive` below.
|
|
144
169
|
*/
|
|
145
|
-
export declare const BUILDER_CERT_CHROME_KEYS: readonly ["bylineCredentialed", "credentialVerification", "bylinePlain", "reviewerName", "bio", "background", "memo", "compensationCue", "scopeLine", "reviewerPhoto", "reviewerProfileUrl", "verifyUrl", "certifiedAt", "contentModifiedAt", "authorName", "authorTitle", "display", "renderDef", "stringsVersion"];
|
|
170
|
+
export declare const BUILDER_CERT_CHROME_KEYS: readonly ["bylineCredentialed", "credentialVerification", "bylinePlain", "reviewerName", "bio", "background", "memo", "compensationCue", "scopeLine", "reviewerPhoto", "reviewerProfileUrl", "verifyUrl", "certifiedAt", "contentModifiedAt", "authorName", "authorTitle", "display", "renderDef", "stringsVersion", "delivery"];
|
|
146
171
|
export type BuilderCertChromeKey = (typeof BUILDER_CERT_CHROME_KEYS)[number];
|
|
147
172
|
//# sourceMappingURL=cert-chrome-data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cert-chrome-data.d.ts","sourceRoot":"","sources":["../../src/builder/cert-chrome-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IACnC,8EAA8E;IAC9E,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE;QAChB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;QAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;QACzB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;QAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;QACxB,QAAQ,CAAC,QAAQ,CAAC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,0DAA0D;IAC1D,OAAO,EAAE;QACR,eAAe,EAAE,OAAO,CAAA;QACxB,kGAAkG;QAClG,eAAe,EAAE,OAAO,CAAA;KACxB,CAAA;IACD,qFAAqF;IACrF,SAAS,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACrC,kGAAkG;IAClG,cAAc,EAAE,MAAM,CAAA;IACtB;;;;;OAKG;IACH,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAA;CACnC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,kUAqB3B,CAAA;AAEV,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cert-chrome-data.js","sourceRoot":"","sources":["../../src/builder/cert-chrome-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;
|
|
1
|
+
{"version":3,"file":"cert-chrome-data.js","sourceRoot":"","sources":["../../src/builder/cert-chrome-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA6IH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACvC,oBAAoB;IACpB,wBAAwB;IACxB,aAAa;IACb,cAAc;IACd,KAAK;IACL,YAAY;IACZ,MAAM;IACN,iBAAiB;IACjB,WAAW;IACX,eAAe;IACf,oBAAoB;IACpB,WAAW;IACX,aAAa;IACb,mBAAmB;IACnB,YAAY;IACZ,aAAa;IACb,SAAS;IACT,WAAW;IACX,gBAAgB;IAChB,UAAU;CACD,CAAA;AAIV;;;;;GAKG;AACH,MAAM,cAAc,GAA8C,MAAM,CAAC,WAAW,CACnF,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CACR,CAAA;AACvC,MAAM,eAAe,GAAuC,cAAc,CAAA;AAC1E,KAAK,eAAe,CAAA"}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* - maps v2 `barInk`/`inkColor` into the theme (the demo predated brand-ink theming);
|
|
18
18
|
* - honors `display.showCredentials`.
|
|
19
19
|
*/
|
|
20
|
+
import * as React from 'react';
|
|
20
21
|
import { type CertBlockMode } from '../components/render-cert-block.js';
|
|
21
22
|
import type { BuilderCertChromeData } from './cert-chrome-data.js';
|
|
22
23
|
/**
|
|
@@ -28,8 +29,12 @@ export declare const CERT_COMPONENT_NAME = "CertREV Cert";
|
|
|
28
29
|
export interface CertReviewCardProps extends Partial<BuilderCertChromeData> {
|
|
29
30
|
/**
|
|
30
31
|
* Placement face — the ENTRY/editor chooses this, NOT the exporter (not a wire-type field).
|
|
31
|
-
*
|
|
32
|
-
*
|
|
32
|
+
*
|
|
33
|
+
* Absent ⇒ `banner`, via the compatibility bridge in the render body below. That is NOT the
|
|
34
|
+
* package default: a direct `renderCertBlock` caller omitting `mode` gets `sidebar`, and
|
|
35
|
+
* `sidebar` is the registered input's `defaultValue`, so blocks created in the editor carry
|
|
36
|
+
* an explicit `mode`. The bridge covers only entries exported before the exporter emitted
|
|
37
|
+
* `mode` at all, and is deleted once those are backfilled. See the render body for why.
|
|
33
38
|
*/
|
|
34
39
|
mode?: CertBlockMode | null;
|
|
35
40
|
/**
|
|
@@ -40,8 +45,28 @@ export interface CertReviewCardProps extends Partial<BuilderCertChromeData> {
|
|
|
40
45
|
* string-splitting shim is gone — `renderCertBlock` composes each part directly.
|
|
41
46
|
*/
|
|
42
47
|
part?: 'full' | 'header' | 'memo' | null;
|
|
48
|
+
/**
|
|
49
|
+
* 1.1.0: what `@builder.io/sdk-react` passes because the registration sets
|
|
50
|
+
* `shouldReceiveBuilderProps: { builderContext: true }`. Only `content.id` is read: it is the
|
|
51
|
+
* Builder entry this block renders inside, which IS the Delivery placement's `externalId`, so a
|
|
52
|
+
* block copied onto another entry asks for that entry's cert and never shows this one's.
|
|
53
|
+
*/
|
|
54
|
+
builderContext?: {
|
|
55
|
+
readonly content?: {
|
|
56
|
+
readonly id?: unknown;
|
|
57
|
+
} | null;
|
|
58
|
+
} | null;
|
|
43
59
|
}
|
|
44
|
-
|
|
60
|
+
/**
|
|
61
|
+
* The delivery marker, accepted only as `{ v: 1, baseUrl }` with `baseUrl` an `https:` ORIGIN on
|
|
62
|
+
* `certrev.com` or one of its subdomains (no path, query, credentials or port). Anything else is
|
|
63
|
+
* null, and a block carrying a marker that is not accepted renders NOTHING: falling back to the
|
|
64
|
+
* options would let an edit to the marker switch revocation off.
|
|
65
|
+
*/
|
|
66
|
+
export declare function acceptedDeliveryMarker(value: unknown): {
|
|
67
|
+
readonly baseUrl: string;
|
|
68
|
+
} | null;
|
|
69
|
+
export declare function CertReviewCard(props: CertReviewCardProps): React.JSX.Element | null;
|
|
45
70
|
/**
|
|
46
71
|
* The subset of the Builder.io input schema this kit emits. Every field below is verified
|
|
47
72
|
* against `@builder.io/sdk-react`'s own `Input` declaration (`types/types/input.d.ts`, 5.2.7) —
|
|
@@ -71,7 +96,7 @@ export interface BuilderInput {
|
|
|
71
96
|
readonly advanced?: boolean;
|
|
72
97
|
}
|
|
73
98
|
/**
|
|
74
|
-
* The wire-type inputs — DERIVED from `BUILDER_CERT_CHROME_KEYS`, so the
|
|
99
|
+
* The wire-type inputs — DERIVED from `BUILDER_CERT_CHROME_KEYS`, so the 20-field
|
|
75
100
|
* option set can never drift from the type (the W3 lock asserts name-parity). This
|
|
76
101
|
* kills the demo's hand-maintained 17-entry array.
|
|
77
102
|
*/
|
|
@@ -90,6 +115,10 @@ export interface CertBlockBuilderRegistration {
|
|
|
90
115
|
readonly name: string;
|
|
91
116
|
readonly component: typeof CertReviewCard;
|
|
92
117
|
readonly inputs: readonly BuilderInput[];
|
|
118
|
+
/** 1.1.0: asks the SDK for `builderContext`, whose `content.id` the delivery path reads. */
|
|
119
|
+
readonly shouldReceiveBuilderProps: {
|
|
120
|
+
readonly builderContext: true;
|
|
121
|
+
};
|
|
93
122
|
}
|
|
94
123
|
/**
|
|
95
124
|
* The canonical registration data (readonly view). Most consumers want
|
|
@@ -111,6 +140,14 @@ export interface CertReviewCardRegisteredComponent {
|
|
|
111
140
|
name: string;
|
|
112
141
|
description?: string;
|
|
113
142
|
inputs: BuilderInput[];
|
|
143
|
+
/**
|
|
144
|
+
* 1.1.0: `@builder.io/sdk-react`'s `RegisteredComponent.shouldReceiveBuilderProps`. The SDK then
|
|
145
|
+
* passes the `builderContext` prop, and the delivery path takes its placement from
|
|
146
|
+
* `builderContext.content.id`.
|
|
147
|
+
*/
|
|
148
|
+
shouldReceiveBuilderProps: {
|
|
149
|
+
builderContext: boolean;
|
|
150
|
+
};
|
|
114
151
|
}
|
|
115
152
|
/**
|
|
116
153
|
* Ready-to-register: `customComponents={[...yourComponents, certRevCertComponent]}` —
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cert-review-card.d.ts","sourceRoot":"","sources":["../../src/builder/cert-review-card.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,oCAAoC,CAAA;
|
|
1
|
+
{"version":3,"file":"cert-review-card.d.ts","sourceRoot":"","sources":["../../src/builder/cert-review-card.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,oCAAoC,CAAA;AAGxF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAKlE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,iBAAiB,CAAA;AAEjD,MAAM,WAAW,mBAAoB,SAAQ,OAAO,CAAC,qBAAqB,CAAC;IAC1E;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IAC3B;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MA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A;IACrB,QAAQ,CAAC,SAAS,EAAE,OAAO,cAAc,CAAA;IACzC,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;IACxC,4FAA4F;IAC5F,QAAQ,CAAC,yBAAyB,EAAE;QAAE,QAAQ,CAAC,cAAc,EAAE,IAAI,CAAA;KAAE,CAAA;CACrE;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,EAAE,4BAKlC,CAAA;AAED;;;;;GAKG;AACH,MAAM,WAAW,iCAAiC;IACjD,SAAS,EAAE,OAAO,cAAc,CAAA;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,YAAY,EAAE,CAAA;IACtB;;;;OAIG;IACH,yBAAyB,EAAE;QAAE,cAAc,EAAE,OAAO,CAAA;KAAE,CAAA;CACtD;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,iCAOlC,CAAA"}
|
|
@@ -18,8 +18,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
18
18
|
* - maps v2 `barInk`/`inkColor` into the theme (the demo predated brand-ink theming);
|
|
19
19
|
* - honors `display.showCredentials`.
|
|
20
20
|
*/
|
|
21
|
+
import * as React from 'react';
|
|
22
|
+
import { Suspense } from 'react';
|
|
23
|
+
import { memoToggleFor, toggleMemo } from '../components/memo-toggle.js';
|
|
21
24
|
import { renderCertBlock } from '../components/render-cert-block.js';
|
|
25
|
+
import { CERT_STRINGS_VERSION } from '../components/render-def.js';
|
|
26
|
+
import { getVerifiedDelivery, peekVerifiedDelivery } from '../verify/get-verified-delivery.js';
|
|
22
27
|
import { BUILDER_CERT_CHROME_KEYS } from './cert-chrome-data.js';
|
|
28
|
+
import { cardDeliveryRuntime } from './delivery-runtime.js';
|
|
29
|
+
import { envelopeCardInput } from './envelope-face.js';
|
|
23
30
|
/**
|
|
24
31
|
* The canonical Builder block name. A brand's registration + the portal
|
|
25
32
|
* `certComponent` connection field default to THIS; config exists only for
|
|
@@ -60,7 +67,106 @@ function fusedCredential(pair) {
|
|
|
60
67
|
const verifiedAt = text(pair.verifiedAt);
|
|
61
68
|
return credential && verifiedAt ? { credential, verifiedAt } : null;
|
|
62
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* The delivery marker, accepted only as `{ v: 1, baseUrl }` with `baseUrl` an `https:` ORIGIN on
|
|
72
|
+
* `certrev.com` or one of its subdomains (no path, query, credentials or port). Anything else is
|
|
73
|
+
* null, and a block carrying a marker that is not accepted renders NOTHING: falling back to the
|
|
74
|
+
* options would let an edit to the marker switch revocation off.
|
|
75
|
+
*/
|
|
76
|
+
export function acceptedDeliveryMarker(value) {
|
|
77
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
78
|
+
return null;
|
|
79
|
+
const { v, baseUrl } = value;
|
|
80
|
+
if (v !== 1 || typeof baseUrl !== 'string')
|
|
81
|
+
return null;
|
|
82
|
+
let url;
|
|
83
|
+
try {
|
|
84
|
+
url = new URL(baseUrl);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
if (url.protocol !== 'https:' || url.username || url.password || url.port)
|
|
90
|
+
return null;
|
|
91
|
+
if (url.pathname !== '/' || url.search || url.hash)
|
|
92
|
+
return null;
|
|
93
|
+
const host = url.hostname.toLowerCase();
|
|
94
|
+
if (host !== 'certrev.com' && !host.endsWith('.certrev.com'))
|
|
95
|
+
return null;
|
|
96
|
+
return { baseUrl: url.origin };
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Suspend on a Delivery read. React 19 gets `use` with ONE promise per placement while it is in
|
|
100
|
+
* flight; React 18 (no `use`) gets the promise thrown, the Suspense protocol it supports. Either
|
|
101
|
+
* way the retry finds the settled read in the cache through `peekVerifiedDelivery`, so it never
|
|
102
|
+
* suspends on a second promise.
|
|
103
|
+
*/
|
|
104
|
+
const inflightReads = new Map();
|
|
105
|
+
function suspendOn(key, start) {
|
|
106
|
+
let pending = inflightReads.get(key);
|
|
107
|
+
if (!pending) {
|
|
108
|
+
pending = start().finally(() => inflightReads.delete(key));
|
|
109
|
+
inflightReads.set(key, pending);
|
|
110
|
+
}
|
|
111
|
+
const use = React.use;
|
|
112
|
+
if (typeof use === 'function')
|
|
113
|
+
return use(pending);
|
|
114
|
+
throw pending;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The painted envelope face, with the phone memo toggle bound. One native click listener on the
|
|
118
|
+
* wrapper (delegated, so it survives a re-render of the HTML) flips the memo box the button sits
|
|
119
|
+
* in; the button is native, so Enter and Space reach it as clicks. Bound after hydration only: the
|
|
120
|
+
* server HTML is the collapsed face, which is also what a reader without JS keeps (the whole memo
|
|
121
|
+
* is still in the text for a screen reader, and the desktop never clamps it).
|
|
122
|
+
*/
|
|
123
|
+
function EnvelopeFace(props) {
|
|
124
|
+
const ref = React.useRef(null);
|
|
125
|
+
React.useEffect(() => {
|
|
126
|
+
const el = ref.current;
|
|
127
|
+
if (!el)
|
|
128
|
+
return;
|
|
129
|
+
const onClick = (e) => {
|
|
130
|
+
const button = memoToggleFor(e.target);
|
|
131
|
+
if (button && el.contains(button))
|
|
132
|
+
toggleMemo(button);
|
|
133
|
+
};
|
|
134
|
+
el.addEventListener('click', onClick);
|
|
135
|
+
return () => el.removeEventListener('click', onClick);
|
|
136
|
+
}, []);
|
|
137
|
+
return (_jsx("div", { ref: ref, "data-certrev-cert-chrome": "", "data-certrev-delivery": "", "data-certrev-strings-version": CERT_STRINGS_VERSION, "data-certrev-def-version": props.defVersion,
|
|
138
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: renderCertBlock is the escaping-safe SSR string renderer
|
|
139
|
+
dangerouslySetInnerHTML: { __html: props.html } }));
|
|
140
|
+
}
|
|
141
|
+
function EnvelopeCertReviewCard(props) {
|
|
142
|
+
const rt = cardDeliveryRuntime();
|
|
143
|
+
// The clock is read per render, so the lifecycle is judged NOW, not when the envelope was fetched.
|
|
144
|
+
const context = { platform: 'builder', externalId: props.externalId, now: new Date(rt.now()) };
|
|
145
|
+
const read = { baseUrl: props.baseUrl, platform: 'builder', externalId: props.externalId, context, cache: rt.cache };
|
|
146
|
+
const settled = peekVerifiedDelivery(read) ??
|
|
147
|
+
suspendOn(`${props.baseUrl}|${props.externalId}`, () => getVerifiedDelivery({ ...read, resolveKid: rt.resolveKid, fetchImpl: rt.fetchImpl(), timeoutMs: rt.timeoutMs }));
|
|
148
|
+
// Revoked, expired, unverifiable, for another entry, or unreachable: nothing at all.
|
|
149
|
+
if (settled.verdict.decision !== 'render')
|
|
150
|
+
return null;
|
|
151
|
+
const input = envelopeCardInput(settled.verdict.payload.content, settled.renderDef, {
|
|
152
|
+
mode: props.mode,
|
|
153
|
+
part: props.part,
|
|
154
|
+
});
|
|
155
|
+
if (!input)
|
|
156
|
+
return null;
|
|
157
|
+
return _jsx(EnvelopeFace, { html: renderCertBlock(input), defVersion: settled.renderDef ? settled.renderDef.v : undefined });
|
|
158
|
+
}
|
|
63
159
|
export function CertReviewCard(props) {
|
|
160
|
+
// 1.1.0: a block that carries the delivery marker paints from the signed envelope and the
|
|
161
|
+
// brand's def, never from the options beside it. No marker (every entry exported before 1.1.0)
|
|
162
|
+
// takes the options path below, unchanged from 1.0.3.
|
|
163
|
+
if (props.delivery != null) {
|
|
164
|
+
const marker = acceptedDeliveryMarker(props.delivery);
|
|
165
|
+
const entryId = text(props.builderContext?.content?.id);
|
|
166
|
+
if (!marker || !entryId)
|
|
167
|
+
return null;
|
|
168
|
+
return (_jsx(Suspense, { fallback: null, children: _jsx(EnvelopeCertReviewCard, { baseUrl: marker.baseUrl, externalId: entryId, mode: props.mode, part: props.part }) }));
|
|
169
|
+
}
|
|
64
170
|
const reviewerName = text(props.reviewerName);
|
|
65
171
|
const verifyUrl = text(props.verifyUrl);
|
|
66
172
|
if (!reviewerName || !verifyUrl)
|
|
@@ -81,12 +187,28 @@ export function CertReviewCard(props) {
|
|
|
81
187
|
}
|
|
82
188
|
: undefined;
|
|
83
189
|
const html = renderCertBlock({
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
|
|
190
|
+
// COMPATIBILITY BRIDGE, NOT THE DESIGN. Delete this fallback once the exporter emits an
|
|
191
|
+
// explicit `mode` and existing entries have been backfilled; until then it must stay.
|
|
192
|
+
//
|
|
193
|
+
// `renderCertBlock` owns the ONE placement default (absent or unrecognised ⇒ sidebar) and
|
|
194
|
+
// that decision STANDS: it is what a direct caller gets, and `sidebar` is the registered
|
|
195
|
+
// input's `defaultValue`, so every block created in the editor from now on carries an
|
|
196
|
+
// explicit `mode` and never reaches this line.
|
|
197
|
+
//
|
|
198
|
+
// The problem is the entries that already exist. `mode` is a PLACEMENT input, not one of
|
|
199
|
+
// the 20 wire keys (`BUILDER_CERT_CHROME_KEYS`), and the exporter emits only the wire
|
|
200
|
+
// projection (`options: { ...certData }`), so every entry exported to date has NO `mode`
|
|
201
|
+
// key at all. Through 0.5.5 this line read `?? 'banner'` and those entries rendered the
|
|
202
|
+
// banner face. Removing it in 1.0.0 did not give them the renderer's default in the
|
|
203
|
+
// abstract; it silently repainted live pages from banner to sidebar, with no entry edit
|
|
204
|
+
// and no version pin to protect them, because their install line is unpinned.
|
|
205
|
+
//
|
|
206
|
+
// So this is a bridge for pre-existing entries, NOT a reversal of the sidebar default.
|
|
207
|
+
// The three-copies-of-a-default problem that motivated removing it is still real and is
|
|
208
|
+
// still fixed: the helper text and the wire type's doc comment no longer name a default,
|
|
209
|
+
// and this line names one only for input the renderer can no longer distinguish from a
|
|
210
|
+
// deliberate choice. The exporter writing `mode` is what retires it.
|
|
211
|
+
mode: props.mode ?? 'banner',
|
|
90
212
|
theme,
|
|
91
213
|
// First-class banner memo split — renderCertBlock composes the requested
|
|
92
214
|
// part directly; no string-splitting. Ignored outside banner mode, and an unrecognised
|
|
@@ -138,6 +260,7 @@ const WIRE_INPUT_TYPE = {
|
|
|
138
260
|
display: 'object',
|
|
139
261
|
renderDef: 'object',
|
|
140
262
|
stringsVersion: 'string',
|
|
263
|
+
delivery: 'object',
|
|
141
264
|
};
|
|
142
265
|
/**
|
|
143
266
|
* The COMPLIANCE-COPY inputs, called what they are.
|
|
@@ -152,9 +275,10 @@ const WIRE_INPUT_TYPE = {
|
|
|
152
275
|
const WIRE_INPUT_HELPER_TEXT = {
|
|
153
276
|
compensationCue: 'System-populated by CertREV. Only its PRESENCE is read (absent = a pro-bono reviewer, so no cue renders); the cue itself is a locked constant, so editing this text changes nothing on the page, and clearing it does not remove the disclosure.',
|
|
154
277
|
scopeLine: 'System-populated by CertREV. The FTC scope line renders byte-verbatim from a locked constant: editing this text changes nothing on the page.',
|
|
278
|
+
delivery: 'System-populated by CertREV. When set, the card shows the certificate CertREV serves for this entry, verified, and ignores the other fields; if CertREV revokes it or it expires, the card shows nothing. Do not edit.',
|
|
155
279
|
};
|
|
156
280
|
/**
|
|
157
|
-
* The wire-type inputs — DERIVED from `BUILDER_CERT_CHROME_KEYS`, so the
|
|
281
|
+
* The wire-type inputs — DERIVED from `BUILDER_CERT_CHROME_KEYS`, so the 20-field
|
|
158
282
|
* option set can never drift from the type (the W3 lock asserts name-parity). This
|
|
159
283
|
* kills the demo's hand-maintained 17-entry array.
|
|
160
284
|
*/
|
|
@@ -214,6 +338,7 @@ export const BUILDER_REGISTRATION = {
|
|
|
214
338
|
name: CERT_COMPONENT_NAME,
|
|
215
339
|
component: CertReviewCard,
|
|
216
340
|
inputs: [...PLACEMENT_INPUTS, ...WIRE_INPUTS],
|
|
341
|
+
shouldReceiveBuilderProps: { builderContext: true },
|
|
217
342
|
};
|
|
218
343
|
/**
|
|
219
344
|
* Ready-to-register: `customComponents={[...yourComponents, certRevCertComponent]}` —
|
|
@@ -226,5 +351,6 @@ export const certRevCertComponent = {
|
|
|
226
351
|
component: CertReviewCard,
|
|
227
352
|
description: 'CertREV expert-review cert card. Options are populated by the CertREV exporter; editors choose placement (mode/part) only.',
|
|
228
353
|
inputs: [...PLACEMENT_INPUTS, ...WIRE_INPUTS],
|
|
354
|
+
shouldReceiveBuilderProps: { builderContext: true },
|
|
229
355
|
};
|
|
230
356
|
//# sourceMappingURL=cert-review-card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cert-review-card.js","sourceRoot":"","sources":["../../src/builder/cert-review-card.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAsB,eAAe,EAAE,MAAM,oCAAoC,CAAA;
|
|
1
|
+
{"version":3,"file":"cert-review-card.js","sourceRoot":"","sources":["../../src/builder/cert-review-card.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACxE,OAAO,EAAsB,eAAe,EAAE,MAAM,oCAAoC,CAAA;AACxF,OAAO,EAAE,oBAAoB,EAA2B,MAAM,6BAA6B,CAAA;AAC3F,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAyB,MAAM,oCAAoC,CAAA;AAErH,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAA;AA8BjD;;;;;;;;;GASG;AACH,SAAS,IAAI,CAAC,KAAc;IAC3B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;AAC9C,CAAC;AAED,yFAAyF;AACzF,SAAS,YAAY,C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AS,EAAE;YACtC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;YACpC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;SACxC;KACD;IACD;QACC,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,aAAa;QAC3B,yFAAyF;QACzF,wEAAwE;QACxE,UAAU,EAAE,wDAAwD;QACpE,YAAY,EAAE,MAAM;QACpB,IAAI,EAAE;YACL,EAAE,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,EAAE;YAChD,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE;YACzC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE;SACrC;KACD;CACD,CAAA;AAWD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAiC;IACjE,IAAI,EAAE,mBAAmB;IACzB,SAAS,EAAE,cAAc;IACzB,MAAM,EAAE,CAAC,GAAG,gBAAgB,EAAE,GAAG,WAAW,CAAC;IAC7C,yBAAyB,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;CACnD,CAAA;AAqBD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAsC;IACtE,IAAI,EAAE,mBAAmB;IACzB,SAAS,EAAE,cAAc;IACzB,WAAW,EACV,4HAA4H;IAC7H,MAAM,EAAE,CAAC,GAAG,gBAAgB,EAAE,GAAG,WAAW,CAAC;IAC7C,yBAAyB,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;CACnD,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Builder card's Delivery runtime (1.1.0): the trust root, fetch, cache and clock the
|
|
3
|
+
* envelope-backed `CertReviewCard` reads with.
|
|
4
|
+
*
|
|
5
|
+
* INTERNAL. This module is deliberately NOT on the package `exports` map, so a consumer cannot
|
|
6
|
+
* swap the trust root through the published API: the card verifies against the baked
|
|
7
|
+
* `cert-issuer-1` key, the same key the storefront badge bundle ships. The package's own tests
|
|
8
|
+
* reach the setter by relative import to run the real kernel against fixture-signed envelopes.
|
|
9
|
+
*/
|
|
10
|
+
import type { ResolvePublicKeyByKid } from '../contract/kernel.js';
|
|
11
|
+
import { TtlCache } from '../verify/cache.js';
|
|
12
|
+
import type { CachedDelivery } from '../verify/get-verified-delivery.js';
|
|
13
|
+
export interface CardDeliveryRuntime {
|
|
14
|
+
readonly resolveKid: ResolvePublicKeyByKid;
|
|
15
|
+
readonly fetchImpl: () => typeof fetch;
|
|
16
|
+
readonly cache: TtlCache<CachedDelivery>;
|
|
17
|
+
readonly now: () => number;
|
|
18
|
+
readonly timeoutMs?: number;
|
|
19
|
+
}
|
|
20
|
+
export declare function cardDeliveryRuntime(): CardDeliveryRuntime;
|
|
21
|
+
/** Test seam: replace parts of the runtime (a fresh cache unless one is given). Returns a restore. */
|
|
22
|
+
export declare function setCardDeliveryRuntimeForTests(overrides: Partial<CardDeliveryRuntime>): () => void;
|
|
23
|
+
//# sourceMappingURL=delivery-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery-runtime.d.ts","sourceRoot":"","sources":["../../src/builder/delivery-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAGxE,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAA;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,OAAO,KAAK,CAAA;IACtC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAA;IACxC,QAAQ,CAAC,GAAG,EAAE,MAAM,MAAM,CAAA;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC3B;AAgBD,wBAAgB,mBAAmB,IAAI,mBAAmB,CAEzD;AAED,sGAAsG;AACtG,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,MAAM,IAAI,CAWlG"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Builder card's Delivery runtime (1.1.0): the trust root, fetch, cache and clock the
|
|
3
|
+
* envelope-backed `CertReviewCard` reads with.
|
|
4
|
+
*
|
|
5
|
+
* INTERNAL. This module is deliberately NOT on the package `exports` map, so a consumer cannot
|
|
6
|
+
* swap the trust root through the published API: the card verifies against the baked
|
|
7
|
+
* `cert-issuer-1` key, the same key the storefront badge bundle ships. The package's own tests
|
|
8
|
+
* reach the setter by relative import to run the real kernel against fixture-signed envelopes.
|
|
9
|
+
*/
|
|
10
|
+
import { TtlCache } from '../verify/cache.js';
|
|
11
|
+
import { CERT_ISSUER_KID, CERT_ISSUER_PUBLIC_KEY_PEM } from './issuer-key.js';
|
|
12
|
+
const bakedResolveKid = (kid) => kid === CERT_ISSUER_KID ? { format: 'pem', pem: CERT_ISSUER_PUBLIC_KEY_PEM } : null;
|
|
13
|
+
function defaultRuntime() {
|
|
14
|
+
return {
|
|
15
|
+
resolveKid: bakedResolveKid,
|
|
16
|
+
fetchImpl: () => globalThis.fetch,
|
|
17
|
+
cache: new TtlCache({ ttlMs: 60_000, negativeTtlMs: 5_000 }),
|
|
18
|
+
now: Date.now,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
let runtime = defaultRuntime();
|
|
22
|
+
export function cardDeliveryRuntime() {
|
|
23
|
+
return runtime;
|
|
24
|
+
}
|
|
25
|
+
/** Test seam: replace parts of the runtime (a fresh cache unless one is given). Returns a restore. */
|
|
26
|
+
export function setCardDeliveryRuntimeForTests(overrides) {
|
|
27
|
+
const previous = runtime;
|
|
28
|
+
const now = overrides.now ?? previous.now;
|
|
29
|
+
runtime = {
|
|
30
|
+
...previous,
|
|
31
|
+
cache: new TtlCache({ ttlMs: 60_000, negativeTtlMs: 5_000, now }),
|
|
32
|
+
...overrides,
|
|
33
|
+
};
|
|
34
|
+
return () => {
|
|
35
|
+
runtime = previous;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=delivery-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery-runtime.js","sourceRoot":"","sources":["../../src/builder/delivery-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAA;AAU7E,MAAM,eAAe,GAA0B,CAAC,GAAG,EAAE,EAAE,CACtD,GAAG,KAAK,eAAe,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,0BAA0B,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AAEpF,SAAS,cAAc;IACtB,OAAO;QACN,UAAU,EAAE,eAAe;QAC3B,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK;QACjC,KAAK,EAAE,IAAI,QAAQ,CAAiB,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAC5E,GAAG,EAAE,IAAI,CAAC,GAAG;KACb,CAAA;AACF,CAAC;AAED,IAAI,OAAO,GAAwB,cAAc,EAAE,CAAA;AAEnD,MAAM,UAAU,mBAAmB;IAClC,OAAO,OAAO,CAAA;AACf,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,8BAA8B,CAAC,SAAuC;IACrF,MAAM,QAAQ,GAAG,OAAO,CAAA;IACxB,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,IAAI,QAAQ,CAA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