@decocms/blocks 8.7.0 → 8.9.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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/protocol/conformance/cases/changes.d.ts.map +1 -1
- package/dist/protocol/conformance/cases/changes.js +14 -3
- package/dist/protocol/conformance/cases/changes.js.map +1 -1
- package/dist/protocol/conformance/cases/guards.d.ts.map +1 -1
- package/dist/protocol/conformance/cases/guards.js +19 -42
- package/dist/protocol/conformance/cases/guards.js.map +1 -1
- package/dist/protocol/conformance/cases/overlay.d.ts +3 -0
- package/dist/protocol/conformance/cases/overlay.d.ts.map +1 -0
- package/dist/protocol/conformance/cases/overlay.js +164 -0
- package/dist/protocol/conformance/cases/overlay.js.map +1 -0
- package/dist/protocol/conformance/cases/reads.js +5 -5
- package/dist/protocol/conformance/cases/reads.js.map +1 -1
- package/dist/protocol/conformance/cases/writes.d.ts.map +1 -1
- package/dist/protocol/conformance/cases/writes.js +15 -3
- package/dist/protocol/conformance/cases/writes.js.map +1 -1
- package/dist/protocol/conformance/context.d.ts +0 -10
- package/dist/protocol/conformance/context.d.ts.map +1 -1
- package/dist/protocol/conformance/context.js.map +1 -1
- package/dist/protocol/conformance/index.d.ts.map +1 -1
- package/dist/protocol/conformance/index.js +2 -0
- package/dist/protocol/conformance/index.js.map +1 -1
- package/dist/protocol/server/content.d.ts +8 -1
- package/dist/protocol/server/content.d.ts.map +1 -1
- package/dist/protocol/server/content.js +18 -3
- package/dist/protocol/server/content.js.map +1 -1
- package/dist/protocol/server/core.d.ts +0 -6
- package/dist/protocol/server/core.d.ts.map +1 -1
- package/dist/protocol/server/core.js +0 -2
- package/dist/protocol/server/core.js.map +1 -1
- package/dist/protocol/server/methods/apply.d.ts +16 -5
- package/dist/protocol/server/methods/apply.d.ts.map +1 -1
- package/dist/protocol/server/methods/apply.js +42 -38
- package/dist/protocol/server/methods/apply.js.map +1 -1
- package/dist/protocol/server/methods/changes.d.ts.map +1 -1
- package/dist/protocol/server/methods/changes.js +31 -3
- package/dist/protocol/server/methods/changes.js.map +1 -1
- package/dist/protocol/server/methods/read.d.ts.map +1 -1
- package/dist/protocol/server/methods/read.js +2 -23
- package/dist/protocol/server/methods/read.js.map +1 -1
- package/dist/protocol/storage/fs/index.d.ts.map +1 -1
- package/dist/protocol/storage/fs/index.js +0 -18
- package/dist/protocol/storage/fs/index.js.map +1 -1
- package/dist/protocol/storage/memory.d.ts +11 -3
- package/dist/protocol/storage/memory.d.ts.map +1 -1
- package/dist/protocol/storage/memory.js +114 -45
- package/dist/protocol/storage/memory.js.map +1 -1
- package/dist/protocol/storage.d.ts +68 -18
- package/dist/protocol/storage.d.ts.map +1 -1
- package/dist/protocol/storage.js +7 -0
- package/dist/protocol/storage.js.map +1 -1
- package/dist/protocol/types.d.ts +51 -8
- package/dist/protocol/types.d.ts.map +1 -1
- package/dist/protocol/types.js +5 -3
- package/dist/protocol/types.js.map +1 -1
- package/dist/v8/analytics.d.ts +6 -2
- package/dist/v8/analytics.d.ts.map +1 -1
- package/dist/v8/analytics.js +24 -5
- package/dist/v8/analytics.js.map +1 -1
- package/dist/v8/builtins/data.d.ts +4 -0
- package/dist/v8/builtins/data.d.ts.map +1 -1
- package/dist/v8/builtins/data.js +6 -0
- package/dist/v8/builtins/data.js.map +1 -1
- package/dist/v8/builtins/index.d.ts +1 -4
- package/dist/v8/builtins/index.d.ts.map +1 -1
- package/dist/v8/builtins/index.js +1 -6
- package/dist/v8/builtins/index.js.map +1 -1
- package/dist/v8/builtins/legacy.d.ts +4 -4
- package/dist/v8/builtins/legacy.d.ts.map +1 -1
- package/dist/v8/builtins/legacy.js +4 -5
- package/dist/v8/builtins/legacy.js.map +1 -1
- package/dist/v8/cli/builtins.d.ts.map +1 -1
- package/dist/v8/cli/builtins.js +0 -1
- package/dist/v8/cli/builtins.js.map +1 -1
- package/dist/v8/cli/check/index.d.ts +1 -1
- package/dist/v8/cli/check/index.d.ts.map +1 -1
- package/dist/v8/cli/check/index.js +13 -33
- package/dist/v8/cli/check/index.js.map +1 -1
- package/dist/v8/cli/schema/builtinSchemas.d.ts.map +1 -1
- package/dist/v8/cli/schema/builtinSchemas.js +6 -8
- package/dist/v8/cli/schema/builtinSchemas.js.map +1 -1
- package/dist/v8/cli/schema/generate.d.ts.map +1 -1
- package/dist/v8/cli/schema/generate.js +1 -8
- package/dist/v8/cli/schema/generate.js.map +1 -1
- package/dist/v8/cli/schema/typeToSchema.d.ts +0 -1
- package/dist/v8/cli/schema/typeToSchema.d.ts.map +1 -1
- package/dist/v8/cli/schema/typeToSchema.js +5 -30
- package/dist/v8/cli/schema/typeToSchema.js.map +1 -1
- package/dist/v8/client.d.ts +1 -1
- package/dist/v8/client.d.ts.map +1 -1
- package/dist/v8/cms.d.ts.map +1 -1
- package/dist/v8/cms.js +5 -13
- package/dist/v8/cms.js.map +1 -1
- package/dist/v8/index.d.ts +1 -1
- package/dist/v8/index.d.ts.map +1 -1
- package/dist/v8/resolver.d.ts +1 -1
- package/dist/v8/resolver.d.ts.map +1 -1
- package/dist/v8/telemetry.d.ts +0 -2
- package/dist/v8/telemetry.d.ts.map +1 -1
- package/dist/v8/telemetry.js +5 -20
- package/dist/v8/telemetry.js.map +1 -1
- package/dist/v8/types.d.ts +4 -8
- package/dist/v8/types.d.ts.map +1 -1
- package/package.json +1 -6
- package/src/index.ts +1 -2
- package/src/protocol/conformance/cases/changes.ts +16 -4
- package/src/protocol/conformance/cases/guards.ts +19 -55
- package/src/protocol/conformance/cases/overlay.ts +195 -0
- package/src/protocol/conformance/cases/reads.ts +4 -4
- package/src/protocol/conformance/cases/writes.ts +15 -3
- package/src/protocol/conformance/context.ts +0 -7
- package/src/protocol/conformance/index.ts +2 -0
- package/src/protocol/server/content.ts +30 -4
- package/src/protocol/server/core.ts +0 -3
- package/src/protocol/server/methods/apply.ts +43 -38
- package/src/protocol/server/methods/changes.ts +42 -4
- package/src/protocol/server/methods/read.ts +2 -24
- package/src/protocol/storage/fs/index.ts +0 -18
- package/src/protocol/storage/memory.ts +124 -46
- package/src/protocol/storage.ts +69 -18
- package/src/protocol/types.ts +51 -8
- package/src/v8/analytics.ts +26 -5
- package/src/v8/builtins/data.ts +8 -0
- package/src/v8/builtins/index.ts +1 -6
- package/src/v8/builtins/legacy.ts +4 -5
- package/src/v8/cli/builtins.ts +0 -1
- package/src/v8/cli/check/index.ts +15 -34
- package/src/v8/cli/schema/builtinSchemas.ts +6 -8
- package/src/v8/cli/schema/generate.ts +1 -8
- package/src/v8/cli/schema/typeToSchema.ts +5 -31
- package/src/v8/client.ts +1 -1
- package/src/v8/cms.ts +5 -14
- package/src/v8/index.ts +0 -1
- package/src/v8/resolver.ts +1 -1
- package/src/v8/telemetry.ts +5 -20
- package/src/v8/types.ts +4 -5
- package/dist/protocol/ciphertext.d.ts +0 -7
- package/dist/protocol/ciphertext.d.ts.map +0 -1
- package/dist/protocol/ciphertext.js +0 -7
- package/dist/protocol/ciphertext.js.map +0 -1
- package/dist/protocol/secrets.d.ts +0 -22
- package/dist/protocol/secrets.d.ts.map +0 -1
- package/dist/protocol/secrets.js +0 -207
- package/dist/protocol/secrets.js.map +0 -1
- package/dist/v8/builtins/secret.d.ts +0 -7
- package/dist/v8/builtins/secret.d.ts.map +0 -1
- package/dist/v8/builtins/secret.js +0 -68
- package/dist/v8/builtins/secret.js.map +0 -1
- package/dist/v8/ciphertext.d.ts +0 -58
- package/dist/v8/ciphertext.d.ts.map +0 -1
- package/dist/v8/ciphertext.js +0 -134
- package/dist/v8/ciphertext.js.map +0 -1
- package/dist/v8/secrets.d.ts +0 -9
- package/dist/v8/secrets.d.ts.map +0 -1
- package/dist/v8/secrets.js +0 -14
- package/dist/v8/secrets.js.map +0 -1
- package/src/protocol/ciphertext.ts +0 -6
- package/src/protocol/secrets.ts +0 -239
- package/src/v8/builtins/secret.ts +0 -82
- package/src/v8/ciphertext.ts +0 -158
- package/src/v8/secrets.ts +0 -17
package/src/v8/client.ts
CHANGED
|
@@ -25,7 +25,7 @@ interface ClientOptions {
|
|
|
25
25
|
/** Loads this client's snapshot; called at most once. */
|
|
26
26
|
load: () => Promise<Snapshot>;
|
|
27
27
|
blocks: Blocks;
|
|
28
|
-
/** The built-
|
|
28
|
+
/** The built-in blocks. */
|
|
29
29
|
builtIns: Readonly<Blocks>;
|
|
30
30
|
/** Who is visiting (copied and frozen); `null` for none. */
|
|
31
31
|
visitor?: Visitor | null;
|
package/src/v8/cms.ts
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
import { runInBackground } from "./background.ts";
|
|
10
10
|
import { SETTINGS_BLOCK, SETTINGS_TYPE } from "./builtins/data.ts";
|
|
11
11
|
import { builtIns } from "./builtins/index.ts";
|
|
12
|
-
import { secretBlock } from "./builtins/secret.ts";
|
|
13
12
|
import { CMSClient } from "./client.ts";
|
|
14
13
|
import { ContentStore, isLoader, isSnapshot } from "./content.ts";
|
|
15
14
|
import type { Overrides } from "./current.ts";
|
|
@@ -62,13 +61,12 @@ interface Fingerprint {
|
|
|
62
61
|
interval: number;
|
|
63
62
|
telemetry: string;
|
|
64
63
|
preview: string;
|
|
65
|
-
secrets: string;
|
|
66
64
|
token: string;
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
/**
|
|
70
68
|
* The state one content root shares across `createCMS` calls: the content
|
|
71
|
-
* store, caps
|
|
69
|
+
* store, caps and telemetry. Each call gets its own handle
|
|
72
70
|
* holding its own block map (see `CMSHandle`).
|
|
73
71
|
*/
|
|
74
72
|
class CMSInstance {
|
|
@@ -77,8 +75,6 @@ class CMSInstance {
|
|
|
77
75
|
readonly #store: ContentStore;
|
|
78
76
|
readonly #interval: number;
|
|
79
77
|
readonly #warned = new Set<string>();
|
|
80
|
-
/** The built-ins with a `secret` that holds this instance's key (the first call's). */
|
|
81
|
-
readonly #builtIns: Readonly<Blocks>;
|
|
82
78
|
readonly #telemetry: TelemetryPipeline | undefined;
|
|
83
79
|
readonly #caps: SettingsCaps;
|
|
84
80
|
/** Settings of a `CMS` block with nothing to run, per release snapshot. */
|
|
@@ -107,10 +103,6 @@ class CMSInstance {
|
|
|
107
103
|
this.#telemetry = new TelemetryPipeline(destination);
|
|
108
104
|
setCurrentTelemetry(this.#telemetry);
|
|
109
105
|
}
|
|
110
|
-
// Decrypted values never leave in telemetry: the pipeline redacts each one.
|
|
111
|
-
const telemetry = this.#telemetry;
|
|
112
|
-
const secret = secretBlock(config.secrets?.key, (value) => telemetry?.redact(value));
|
|
113
|
-
this.#builtIns = Object.freeze({ ...builtIns, secret });
|
|
114
106
|
}
|
|
115
107
|
|
|
116
108
|
/**
|
|
@@ -233,7 +225,7 @@ class CMSInstance {
|
|
|
233
225
|
new CMSClient({
|
|
234
226
|
load: () => Promise.resolve(snapshot),
|
|
235
227
|
blocks,
|
|
236
|
-
builtIns
|
|
228
|
+
builtIns,
|
|
237
229
|
date: Date.now(),
|
|
238
230
|
onCollision: (name) => this.#warnCollision(name),
|
|
239
231
|
}),
|
|
@@ -298,7 +290,7 @@ class CMSInstance {
|
|
|
298
290
|
return new CMSClient({
|
|
299
291
|
load,
|
|
300
292
|
blocks,
|
|
301
|
-
builtIns
|
|
293
|
+
builtIns,
|
|
302
294
|
...inputs,
|
|
303
295
|
onCollision: (name) => this.#warnCollision(name),
|
|
304
296
|
telemetry: this.#telemetry?.forClient(),
|
|
@@ -336,8 +328,8 @@ const INSTANCE = Symbol.for("decocms.blocks.cms.instance");
|
|
|
336
328
|
|
|
337
329
|
/**
|
|
338
330
|
* What `createCMS` returns: the shared instance plus the block map of this
|
|
339
|
-
* call. Every handle on one content root shares its content, caps
|
|
340
|
-
*
|
|
331
|
+
* call. Every handle on one content root shares its content, caps and
|
|
332
|
+
* telemetry; each resolves with the block map it was created with.
|
|
341
333
|
*/
|
|
342
334
|
class CMSHandle implements CMS {
|
|
343
335
|
readonly #instance: CMSInstance;
|
|
@@ -552,7 +544,6 @@ function fingerprintOf(config: CMSConfig, interval: number): Fingerprint {
|
|
|
552
544
|
interval,
|
|
553
545
|
telemetry: stableJson(config.telemetry ?? null),
|
|
554
546
|
preview: stableJson(config.preview ?? null),
|
|
555
|
-
secrets: config.secrets?.key ? fnv1a(config.secrets.key) : "",
|
|
556
547
|
token: config.token ? fnv1a(config.token) : "",
|
|
557
548
|
};
|
|
558
549
|
}
|
package/src/v8/index.ts
CHANGED
package/src/v8/resolver.ts
CHANGED
|
@@ -33,7 +33,7 @@ type Path = (string | number)[];
|
|
|
33
33
|
interface ResolverOptions {
|
|
34
34
|
snapshot: Snapshot;
|
|
35
35
|
blocks: Blocks;
|
|
36
|
-
/** The built-
|
|
36
|
+
/** The built-in blocks. */
|
|
37
37
|
builtIns: Readonly<Blocks>;
|
|
38
38
|
/** The client this resolver belongs to: `currentClient()` while a block function runs. */
|
|
39
39
|
client?: Client;
|
package/src/v8/telemetry.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* Workers, on an unref'd timer elsewhere); a send that fails is retried
|
|
16
16
|
* once on 429/502/503/504 and otherwise dropped.
|
|
17
17
|
* - Everything is scrubbed before encoding: no query strings, tokens,
|
|
18
|
-
* cookies or authorization values
|
|
18
|
+
* cookies or authorization values.
|
|
19
19
|
*/
|
|
20
20
|
import { hasBackgroundHook, later, runInBackground } from "./background.ts";
|
|
21
21
|
import { rate, TELEMETRY_DEFAULTS } from "./builtins/data.ts";
|
|
@@ -29,7 +29,6 @@ const SINK = Symbol.for("decocms.blocks.telemetry");
|
|
|
29
29
|
const FLUSH_MS = 10_000;
|
|
30
30
|
const MAX_LOGS = 200;
|
|
31
31
|
const MAX_SPANS = 1_000;
|
|
32
|
-
const MAX_SECRETS = 1_000;
|
|
33
32
|
const RETRY_STATUSES = new Set([429, 502, 503, 504]);
|
|
34
33
|
/** OpenTelemetry's recommended `http.*.request.duration` buckets, in seconds. */
|
|
35
34
|
const BOUNDS = [0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10];
|
|
@@ -131,19 +130,12 @@ export class TelemetryPipeline {
|
|
|
131
130
|
#spans: (SpanInput & { spanId: string })[] = [];
|
|
132
131
|
#windowStart = Date.now();
|
|
133
132
|
#scheduled = false;
|
|
134
|
-
/** Values secret blocks decrypted, replaced with `[redacted]` wherever they'd be sent. */
|
|
135
|
-
readonly #secrets = new Set<string>();
|
|
136
133
|
|
|
137
134
|
constructor(destination: Destination) {
|
|
138
135
|
this.#destination = destination;
|
|
139
136
|
this.apply(TELEMETRY_DEFAULTS);
|
|
140
137
|
}
|
|
141
138
|
|
|
142
|
-
/** Never send `value`: it's replaced with `[redacted]` in every log, span and label. */
|
|
143
|
-
redact(value: string): void {
|
|
144
|
-
if (value.length > 0 && this.#secrets.size < MAX_SECRETS) this.#secrets.add(value);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
139
|
/** The release being served: its revision labels batches. */
|
|
148
140
|
useRelease(snapshot: Snapshot): void {
|
|
149
141
|
this.#release = snapshot.revision;
|
|
@@ -272,8 +264,7 @@ export class TelemetryPipeline {
|
|
|
272
264
|
this.#histograms = new Map();
|
|
273
265
|
this.#logs = [];
|
|
274
266
|
this.#spans = [];
|
|
275
|
-
const
|
|
276
|
-
const encode = (attributes: Attributes) => encodeAttributes(attributes, scrub);
|
|
267
|
+
const encode = encodeAttributes;
|
|
277
268
|
const resource = { attributes: encode(this.#resource()) };
|
|
278
269
|
const scope = { name: "@decocms/blocks" };
|
|
279
270
|
const sends: Promise<void>[] = [];
|
|
@@ -326,7 +317,7 @@ export class TelemetryPipeline {
|
|
|
326
317
|
timeUnixNano: nanos(log.time),
|
|
327
318
|
severityNumber: 17,
|
|
328
319
|
severityText: "ERROR",
|
|
329
|
-
body: { stringValue:
|
|
320
|
+
body: { stringValue: scrubText(log.message) },
|
|
330
321
|
attributes: encode(log.attributes),
|
|
331
322
|
})),
|
|
332
323
|
},
|
|
@@ -367,12 +358,6 @@ export class TelemetryPipeline {
|
|
|
367
358
|
await Promise.all(sends);
|
|
368
359
|
}
|
|
369
360
|
|
|
370
|
-
#scrub(text: string): string {
|
|
371
|
-
let out = text;
|
|
372
|
-
for (const secret of this.#secrets) out = out.split(secret).join("[redacted]");
|
|
373
|
-
return scrubText(out);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
361
|
#schedule(): void {
|
|
377
362
|
if (this.#scheduled) return;
|
|
378
363
|
this.#scheduled = true;
|
|
@@ -480,14 +465,14 @@ function randomHex(bytes: number): string {
|
|
|
480
465
|
return Array.from(values, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
481
466
|
}
|
|
482
467
|
|
|
483
|
-
function encodeAttributes(attributes: Attributes
|
|
468
|
+
function encodeAttributes(attributes: Attributes) {
|
|
484
469
|
return Object.entries(attributes)
|
|
485
470
|
.filter(([, value]) => value !== undefined)
|
|
486
471
|
.map(([key, value]) => ({
|
|
487
472
|
key,
|
|
488
473
|
value:
|
|
489
474
|
typeof value === "string"
|
|
490
|
-
? { stringValue:
|
|
475
|
+
? { stringValue: scrubText(value) }
|
|
491
476
|
: typeof value === "boolean"
|
|
492
477
|
? { boolValue: value }
|
|
493
478
|
: Number.isInteger(value)
|
package/src/v8/types.ts
CHANGED
|
@@ -151,9 +151,6 @@ export interface LegacyRedirect {
|
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
/** A field the site editor saves encrypted, as a `secret` block. */
|
|
155
|
-
export type Secret = string & { readonly __secret: true };
|
|
156
|
-
|
|
157
154
|
/** A prop the built-in `lazy` block fills; resolves its value when called, at most once. */
|
|
158
155
|
export type Lazy<T> = () => Promise<T>;
|
|
159
156
|
|
|
@@ -207,6 +204,10 @@ export interface Analytics {
|
|
|
207
204
|
collector?: string;
|
|
208
205
|
/** Default `true`; `false` makes `AnalyticsScript` render nothing. */
|
|
209
206
|
enabled?: boolean;
|
|
207
|
+
/** Public key from the site's Deco Analytics registration; renders its tag from the collector's origin. */
|
|
208
|
+
decoAnalyticsKey?: string;
|
|
209
|
+
/** Default `false`; `true` renders the Deco Analytics tag from the site's own host, which must route `/_dq/*` to the collector. */
|
|
210
|
+
decoAnalyticsFirstParty?: boolean;
|
|
210
211
|
}
|
|
211
212
|
|
|
212
213
|
/** Anything with a `url` and `headers`: a fetch `Request`, a `NextRequest`, a framework wrapper. */
|
|
@@ -298,8 +299,6 @@ export interface CMSConfig {
|
|
|
298
299
|
*/
|
|
299
300
|
draftHosts?: string[];
|
|
300
301
|
};
|
|
301
|
-
/** The private key that decrypts `secret` blocks. */
|
|
302
|
-
secrets?: { key?: string };
|
|
303
302
|
/**
|
|
304
303
|
* Your site ID (Studio's site slug): turns on hosted releases from
|
|
305
304
|
* `delivery.decocms.com`. Drafts don't need it.
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The secret ciphertext format. The implementation is a dependency-free leaf
|
|
3
|
-
* module of the SDK (`src/v8/ciphertext.ts`), where the `secret` built-in
|
|
4
|
-
* decrypts it; the protocol re-exports it for its secret guard.
|
|
5
|
-
*/
|
|
6
|
-
export * from "../v8/ciphertext.ts";
|
|
7
|
-
//# sourceMappingURL=ciphertext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ciphertext.d.ts","sourceRoot":"","sources":["../../src/protocol/ciphertext.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,qBAAqB,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The secret ciphertext format. The implementation is a dependency-free leaf
|
|
3
|
-
* module of the SDK (`src/v8/ciphertext.ts`), where the `secret` built-in
|
|
4
|
-
* decrypts it; the protocol re-exports it for its secret guard.
|
|
5
|
-
*/
|
|
6
|
-
export * from "../v8/ciphertext.js";
|
|
7
|
-
//# sourceMappingURL=ciphertext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ciphertext.js","sourceRoot":"","sources":["../../src/protocol/ciphertext.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,qBAAqB,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { BlockViolation } from "./errors.ts";
|
|
2
|
-
import type { DecoMeta } from "./types.ts";
|
|
3
|
-
/** The built-in block type that holds an encrypted value. */
|
|
4
|
-
export declare const SECRET_BLOCK_TYPE = "secret";
|
|
5
|
-
/** The JSON Schema `format` that marks a `Secret` field. */
|
|
6
|
-
export declare const SECRET_FORMAT = "secret";
|
|
7
|
-
/**
|
|
8
|
-
* True when `ciphertext` is a well-formed secret ciphertext:
|
|
9
|
-
* `v1.<wrappedKey>.<iv>.<ciphertext>` with segment lengths an RSA-OAEP and
|
|
10
|
-
* AES-256-GCM encryption produces. Checking it needs no key.
|
|
11
|
-
*/
|
|
12
|
-
export declare function isWellFormedCiphertext(ciphertext: unknown): ciphertext is string;
|
|
13
|
-
/** True when a JSON Schema node describes a `Secret` field. */
|
|
14
|
-
export declare function isSecretFieldSchema(schema: unknown): boolean;
|
|
15
|
-
/** True when `value` is a `secret` block with a well-formed `ciphertext`. */
|
|
16
|
-
export declare function isSecretBlock(value: unknown): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Checks one entry against the secret guard. `meta` is the parsed schema;
|
|
19
|
-
* without one, only the `secret` blocks' ciphertexts can be checked.
|
|
20
|
-
*/
|
|
21
|
-
export declare function checkSecrets(name: string, entry: unknown, meta: DecoMeta | null): BlockViolation[];
|
|
22
|
-
//# sourceMappingURL=secrets.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../src/protocol/secrets.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,6DAA6D;AAC7D,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,4DAA4D;AAC5D,eAAO,MAAM,aAAa,WAAW,CAAC;AAsBtC;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,IAAI,MAAM,CAEhF;AAED,+DAA+D;AAC/D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAE5D;AAED,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAIrD;AAmKD;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,QAAQ,GAAG,IAAI,GACpB,cAAc,EAAE,CAIlB"}
|
package/dist/protocol/secrets.js
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The secret guard: the content protocol refuses plain text in a `Secret`
|
|
3
|
-
* field, so the site editor and agents can't save a credential by mistake.
|
|
4
|
-
*
|
|
5
|
-
* A `Secret` field must hold a `secret` block with a well-formed
|
|
6
|
-
* `ciphertext` (`{ "__resolveType": "secret", "ciphertext": "v1.…" }`, in the
|
|
7
|
-
* format `./ciphertext` pins: three base64url segments of checked lengths), or a
|
|
8
|
-
* variant block whose every value does. Every `secret` block anywhere in an
|
|
9
|
-
* entry must carry a well-formed `ciphertext`, whatever its field.
|
|
10
|
-
*
|
|
11
|
-
* The schema marks a `Secret` field with `"format": "secret"` — the contract
|
|
12
|
-
* `deco schema` emits for the `Secret` type. A legacy secret loader block
|
|
13
|
-
* (`website/loaders/secret.ts`) is left alone. Browser-safe.
|
|
14
|
-
*/
|
|
15
|
-
import { parseCiphertext } from "./ciphertext.js";
|
|
16
|
-
/** The built-in block type that holds an encrypted value. */
|
|
17
|
-
export const SECRET_BLOCK_TYPE = "secret";
|
|
18
|
-
/** The JSON Schema `format` that marks a `Secret` field. */
|
|
19
|
-
export const SECRET_FORMAT = "secret";
|
|
20
|
-
const MULTIVARIATE_TYPES = new Set(["multivariate", "website/flags/multivariate.ts"]);
|
|
21
|
-
const LAZY_TYPE = "lazy";
|
|
22
|
-
/**
|
|
23
|
-
* The legacy (v7) secret loader. Its `encrypted` prop is a string marked
|
|
24
|
-
* `"format": "secret"` that already holds the site's own ciphertext, so it
|
|
25
|
-
* isn't a `Secret` field; its blocks are migrated, not guarded.
|
|
26
|
-
*/
|
|
27
|
-
const LEGACY_SECRET_LOADER = /(^|\/)loaders\/secret\.ts$/;
|
|
28
|
-
const MAX_DEPTH = 512;
|
|
29
|
-
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
30
|
-
const resolveTypeOf = (value) => isObject(value) && typeof value.__resolveType === "string" ? value.__resolveType : undefined;
|
|
31
|
-
const escapePointer = (key) => key.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
32
|
-
/**
|
|
33
|
-
* True when `ciphertext` is a well-formed secret ciphertext:
|
|
34
|
-
* `v1.<wrappedKey>.<iv>.<ciphertext>` with segment lengths an RSA-OAEP and
|
|
35
|
-
* AES-256-GCM encryption produces. Checking it needs no key.
|
|
36
|
-
*/
|
|
37
|
-
export function isWellFormedCiphertext(ciphertext) {
|
|
38
|
-
return parseCiphertext(ciphertext) !== null;
|
|
39
|
-
}
|
|
40
|
-
/** True when a JSON Schema node describes a `Secret` field. */
|
|
41
|
-
export function isSecretFieldSchema(schema) {
|
|
42
|
-
return isObject(schema) && schema.format === SECRET_FORMAT;
|
|
43
|
-
}
|
|
44
|
-
/** True when `value` is a `secret` block with a well-formed `ciphertext`. */
|
|
45
|
-
export function isSecretBlock(value) {
|
|
46
|
-
return (resolveTypeOf(value) === SECRET_BLOCK_TYPE && isWellFormedCiphertext(value.ciphertext));
|
|
47
|
-
}
|
|
48
|
-
const blockIndexCache = new WeakMap();
|
|
49
|
-
/** Every block type in the schema's manifest, by key, to the schema of its arguments. */
|
|
50
|
-
function blockIndex(meta) {
|
|
51
|
-
const cached = blockIndexCache.get(meta);
|
|
52
|
-
if (cached)
|
|
53
|
-
return cached;
|
|
54
|
-
const index = new Map();
|
|
55
|
-
for (const group of Object.values(meta.manifest?.blocks ?? {})) {
|
|
56
|
-
if (!isObject(group))
|
|
57
|
-
continue;
|
|
58
|
-
for (const [key, schema] of Object.entries(group)) {
|
|
59
|
-
if (!index.has(key))
|
|
60
|
-
index.set(key, schema);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
blockIndexCache.set(meta, index);
|
|
64
|
-
return index;
|
|
65
|
-
}
|
|
66
|
-
class SecretWalker {
|
|
67
|
-
name;
|
|
68
|
-
meta;
|
|
69
|
-
violations = [];
|
|
70
|
-
constructor(name, meta) {
|
|
71
|
-
this.name = name;
|
|
72
|
-
this.meta = meta;
|
|
73
|
-
}
|
|
74
|
-
report(pointer, rule, message) {
|
|
75
|
-
this.violations.push({ name: this.name, pointer, rule, message });
|
|
76
|
-
}
|
|
77
|
-
/** Follows local `$ref`s into `schema.definitions`. */
|
|
78
|
-
deref(schema) {
|
|
79
|
-
let current = schema;
|
|
80
|
-
for (let hops = 0; hops < 32 && isObject(current) && typeof current.$ref === "string"; hops++) {
|
|
81
|
-
const match = /^#\/definitions\/(.+)$/.exec(current.$ref);
|
|
82
|
-
if (!match)
|
|
83
|
-
return current;
|
|
84
|
-
const key = decodeURIComponent(match[1]).replace(/~1/g, "/").replace(/~0/g, "~");
|
|
85
|
-
current = this.meta?.schema?.definitions?.[key];
|
|
86
|
-
}
|
|
87
|
-
return current;
|
|
88
|
-
}
|
|
89
|
-
/** The schemas of a node, flattened through `allOf`/`anyOf`/`oneOf`. */
|
|
90
|
-
branches(schema, depth = 0) {
|
|
91
|
-
const node = this.deref(schema);
|
|
92
|
-
if (!isObject(node) || depth > 16)
|
|
93
|
-
return [];
|
|
94
|
-
const out = [node];
|
|
95
|
-
for (const combinator of ["allOf", "anyOf", "oneOf"]) {
|
|
96
|
-
const list = node[combinator];
|
|
97
|
-
if (Array.isArray(list))
|
|
98
|
-
for (const item of list)
|
|
99
|
-
out.push(...this.branches(item, depth + 1));
|
|
100
|
-
}
|
|
101
|
-
return out;
|
|
102
|
-
}
|
|
103
|
-
isSecretField(schema) {
|
|
104
|
-
return this.branches(schema).some(isSecretFieldSchema);
|
|
105
|
-
}
|
|
106
|
-
propertySchema(schema, key) {
|
|
107
|
-
for (const branch of this.branches(schema)) {
|
|
108
|
-
const properties = branch.properties;
|
|
109
|
-
if (isObject(properties) && key in properties)
|
|
110
|
-
return properties[key];
|
|
111
|
-
}
|
|
112
|
-
for (const branch of this.branches(schema)) {
|
|
113
|
-
if (isObject(branch.additionalProperties))
|
|
114
|
-
return branch.additionalProperties;
|
|
115
|
-
}
|
|
116
|
-
return undefined;
|
|
117
|
-
}
|
|
118
|
-
itemSchema(schema) {
|
|
119
|
-
for (const branch of this.branches(schema)) {
|
|
120
|
-
if (isObject(branch.items))
|
|
121
|
-
return branch.items;
|
|
122
|
-
}
|
|
123
|
-
return undefined;
|
|
124
|
-
}
|
|
125
|
-
/** A value stored in a `Secret` field. */
|
|
126
|
-
checkSecretValue(value, pointer, depth) {
|
|
127
|
-
if (depth > MAX_DEPTH)
|
|
128
|
-
return this.report(pointer, "too-deep", "the value is nested too deeply");
|
|
129
|
-
const type = resolveTypeOf(value);
|
|
130
|
-
if (type === SECRET_BLOCK_TYPE)
|
|
131
|
-
return this.walkBlock(value, pointer, depth);
|
|
132
|
-
if (type !== undefined && MULTIVARIATE_TYPES.has(type)) {
|
|
133
|
-
const variants = value.variants;
|
|
134
|
-
if (!Array.isArray(variants)) {
|
|
135
|
-
return this.report(pointer, "secret-field", "a Secret field holds a variant block without variants");
|
|
136
|
-
}
|
|
137
|
-
for (const [index, variant] of variants.entries()) {
|
|
138
|
-
const at = `${pointer}/variants/${index}`;
|
|
139
|
-
if (!isObject(variant)) {
|
|
140
|
-
this.report(at, "secret-field", "a variant must be an object");
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
if (variant.rule !== undefined)
|
|
144
|
-
this.walkAny(variant.rule, `${at}/rule`, depth + 1);
|
|
145
|
-
let inner = variant.value;
|
|
146
|
-
let innerAt = `${at}/value`;
|
|
147
|
-
if (resolveTypeOf(inner) === LAZY_TYPE) {
|
|
148
|
-
inner = inner.value;
|
|
149
|
-
innerAt = `${innerAt}/value`;
|
|
150
|
-
}
|
|
151
|
-
this.checkSecretValue(inner, innerAt, depth + 1);
|
|
152
|
-
}
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
this.report(pointer, "secret-field", 'a Secret field must hold a "secret" block with a well-formed ciphertext, never plain text');
|
|
156
|
-
}
|
|
157
|
-
/** A block value: its own definition (from the manifest) describes its arguments. */
|
|
158
|
-
walkBlock(block, pointer, depth) {
|
|
159
|
-
const type = block.__resolveType;
|
|
160
|
-
if (type === SECRET_BLOCK_TYPE && !isWellFormedCiphertext(block.ciphertext)) {
|
|
161
|
-
this.report(pointer, "secret-ciphertext", 'a "secret" block must carry a well-formed "ciphertext" (v1.<wrappedKey>.<iv>.<ciphertext>)');
|
|
162
|
-
}
|
|
163
|
-
const definition = this.meta && !LEGACY_SECRET_LOADER.test(type) ? blockIndex(this.meta).get(type) : undefined;
|
|
164
|
-
this.walkObject(block, definition, pointer, depth);
|
|
165
|
-
}
|
|
166
|
-
walkObject(object, schema, pointer, depth) {
|
|
167
|
-
for (const [key, child] of Object.entries(object)) {
|
|
168
|
-
if (key === "__resolveType")
|
|
169
|
-
continue;
|
|
170
|
-
const childSchema = schema === undefined ? undefined : this.propertySchema(schema, key);
|
|
171
|
-
this.walk(child, childSchema, `${pointer}/${escapePointer(key)}`, depth + 1);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
walk(value, schema, pointer, depth) {
|
|
175
|
-
if (depth > MAX_DEPTH)
|
|
176
|
-
return this.report(pointer, "too-deep", "the value is nested too deeply");
|
|
177
|
-
if (schema !== undefined && this.isSecretField(schema)) {
|
|
178
|
-
return this.checkSecretValue(value, pointer, depth);
|
|
179
|
-
}
|
|
180
|
-
if (Array.isArray(value)) {
|
|
181
|
-
const items = schema === undefined ? undefined : this.itemSchema(schema);
|
|
182
|
-
for (const [index, item] of value.entries()) {
|
|
183
|
-
this.walk(item, items, `${pointer}/${index}`, depth + 1);
|
|
184
|
-
}
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
if (!isObject(value))
|
|
188
|
-
return;
|
|
189
|
-
// A nested block is described by its own definition, not the field's union.
|
|
190
|
-
if (resolveTypeOf(value) !== undefined)
|
|
191
|
-
return this.walkBlock(value, pointer, depth);
|
|
192
|
-
this.walkObject(value, schema, pointer, depth);
|
|
193
|
-
}
|
|
194
|
-
walkAny(value, pointer, depth) {
|
|
195
|
-
this.walk(value, undefined, pointer, depth);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Checks one entry against the secret guard. `meta` is the parsed schema;
|
|
200
|
-
* without one, only the `secret` blocks' ciphertexts can be checked.
|
|
201
|
-
*/
|
|
202
|
-
export function checkSecrets(name, entry, meta) {
|
|
203
|
-
const walker = new SecretWalker(name, meta);
|
|
204
|
-
walker.walk(entry, undefined, "", 0);
|
|
205
|
-
return walker.violations;
|
|
206
|
-
}
|
|
207
|
-
//# sourceMappingURL=secrets.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../../src/protocol/secrets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAIlD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAE1C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC;AAEtC,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,+BAA+B,CAAC,CAAC,CAAC;AACtF,MAAM,SAAS,GAAG,MAAM,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S creates one per instance;
|
|
4
|
-
* the built-in list holds the keyless one, which always fails.
|
|
5
|
-
*/
|
|
6
|
-
export declare function secretBlock(key?: string, onDecrypt?: (value: string) => void): BlockFunction;
|
|
7
|
-
//# sourceMappingURL=secret.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"secret.d.ts","sourceRoot":"","sources":["../../../src/v8/builtins/secret.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAcjD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,aAAa,CA2C5F"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The built-in `secret` block (see /next/built-in-blocks#secrets):
|
|
3
|
-
* `{ "__resolveType": "secret", "ciphertext": "v1.…" }` resolves to the
|
|
4
|
-
* decrypted string, on the server only.
|
|
5
|
-
*
|
|
6
|
-
* The ciphertext format lives in `../ciphertext` (a leaf module with no
|
|
7
|
-
* imports, which the protocol re-exports): a fresh AES-256-GCM key per value, wrapped with the
|
|
8
|
-
* site's RSA public key using RSA-OAEP and SHA-256. Decrypting takes the
|
|
9
|
-
* matching PKCS#8 private key, the PEM `createCMS({ secrets: { key } })` gets.
|
|
10
|
-
*
|
|
11
|
-
* Every failure (no key, the wrong key, a malformed ciphertext, a browser)
|
|
12
|
-
* throws, so the resolver reports `BLOCK_FAILED` for that block alone. No
|
|
13
|
-
* message ever includes the key or a decrypted value. `{ run: false }` and
|
|
14
|
-
* `client.list` never run functions, so they return the ciphertext as saved.
|
|
15
|
-
*
|
|
16
|
-
* Every decrypted value is handed to `onDecrypt` (the CMS redacts it from
|
|
17
|
-
* telemetry). A decrypted value stays on the server because it's resolved
|
|
18
|
-
* there; tainting it (React's taint API) is up to the site's own code.
|
|
19
|
-
*/
|
|
20
|
-
import { parseCiphertext } from "../ciphertext.js";
|
|
21
|
-
/** True in a browser, where a secret must never be decrypted. */
|
|
22
|
-
function inBrowser() {
|
|
23
|
-
const scope = globalThis;
|
|
24
|
-
return typeof scope.window === "object" && typeof scope.document === "object";
|
|
25
|
-
}
|
|
26
|
-
/** The DER bytes of a single `PRIVATE KEY` (PKCS#8) PEM block. */
|
|
27
|
-
function privateKeyDer(pem) {
|
|
28
|
-
const match = /-----BEGIN PRIVATE KEY-----([\s\S]*?)-----END PRIVATE KEY-----/.exec(pem);
|
|
29
|
-
return Uint8Array.from(atob(match?.[1]?.replace(/\s+/g, "") ?? ""), (c) => c.charCodeAt(0));
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* The `secret` block for one private key. The CMS creates one per instance;
|
|
33
|
-
* the built-in list holds the keyless one, which always fails.
|
|
34
|
-
*/
|
|
35
|
-
export function secretBlock(key, onDecrypt) {
|
|
36
|
-
let imported;
|
|
37
|
-
return async ({ ciphertext } = {}) => {
|
|
38
|
-
if (inBrowser())
|
|
39
|
-
throw new Error("a secret block resolves on the server only");
|
|
40
|
-
if (!key)
|
|
41
|
-
throw new Error("no key to decrypt secrets: pass createCMS({ secrets: { key } })");
|
|
42
|
-
const parts = parseCiphertext(ciphertext);
|
|
43
|
-
if (!parts)
|
|
44
|
-
throw new Error("the ciphertext is not well formed");
|
|
45
|
-
imported ??= Promise.resolve().then(() => crypto.subtle.importKey("pkcs8", privateKeyDer(key), { name: "RSA-OAEP", hash: "SHA-256" }, false, ["decrypt"]));
|
|
46
|
-
let rsa;
|
|
47
|
-
try {
|
|
48
|
-
rsa = await imported;
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
throw new Error("the secrets key is not an RSA private key in PKCS#8 PEM");
|
|
52
|
-
}
|
|
53
|
-
let value;
|
|
54
|
-
try {
|
|
55
|
-
const raw = await crypto.subtle.decrypt({ name: "RSA-OAEP" }, rsa, parts.wrappedKey);
|
|
56
|
-
const aes = await crypto.subtle.importKey("raw", raw, "AES-GCM", false, ["decrypt"]);
|
|
57
|
-
const plain = await crypto.subtle.decrypt({ name: "AES-GCM", iv: parts.iv }, aes, parts.ciphertext);
|
|
58
|
-
value = new TextDecoder().decode(plain);
|
|
59
|
-
}
|
|
60
|
-
catch {
|
|
61
|
-
// Web Crypto's errors say nothing useful, and this one never names the value.
|
|
62
|
-
throw new Error("the secret could not be decrypted with this key");
|
|
63
|
-
}
|
|
64
|
-
onDecrypt?.(value);
|
|
65
|
-
return value;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=secret.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"secret.js","sourceRoot":"","sources":["../../../src/v8/builtins/secret.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,iEAAiE;AACjE,SAAS,SAAS;IAChB,MAAM,KAAK,GAAG,UAAsD,CAAC;IACrE,OAAO,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC;AAChF,CAAC;AAED,kEAAkE;AAClE,SAAS,aAAa,CAAC,GAAW;IAChC,MAAM,KAAK,GAAG,gEAAgE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzF,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9F,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,GAAY,EAAE,SAAmC;IAC3E,IAAI,QAAwC,CAAC;IAC7C,OAAO,KAAK,EAAE,EAAE,UAAU,EAA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C,UAA0B,CACjC,CAAC;YACF,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;QAAC,MAAM,CAAC;YACP,8EAA8E;YAC9E,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;QACD,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/v8/ciphertext.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `secret` block's ciphertext format, in one place: the secret guard
|
|
3
|
-
* checks it, and `encryptSecret` (`@decocms/blocks/secrets`) produces it.
|
|
4
|
-
*
|
|
5
|
-
* ```
|
|
6
|
-
* v1.<wrappedKey>.<iv>.<ciphertext>
|
|
7
|
-
* ```
|
|
8
|
-
*
|
|
9
|
-
* Each segment is unpadded base64url. A fresh AES-256-GCM key encrypts the
|
|
10
|
-
* UTF-8 value; the key is wrapped with the site's RSA public key using
|
|
11
|
-
* RSA-OAEP with SHA-256.
|
|
12
|
-
*
|
|
13
|
-
* - `wrappedKey` — the RSA-OAEP output: as long as the modulus, so 256, 384
|
|
14
|
-
* or 512 bytes (2048-, 3072- or 4096-bit keys; `deco` creates 3072-bit ones).
|
|
15
|
-
* - `iv` — the AES-GCM nonce: exactly 12 bytes.
|
|
16
|
-
* - `ciphertext` — the AES-GCM output, its 16-byte tag included: at least 16 bytes.
|
|
17
|
-
*
|
|
18
|
-
* Checking the structure needs no key, so the content protocol and
|
|
19
|
-
* `deco check` refuse text that merely looks like a ciphertext (`v1.hunter2`).
|
|
20
|
-
* Web Crypto only: runs in browsers, on Workers and on Node.
|
|
21
|
-
*/
|
|
22
|
-
/** The format version every ciphertext starts with. */
|
|
23
|
-
export declare const CIPHERTEXT_VERSION = "v1";
|
|
24
|
-
/** The wrapped-key lengths a ciphertext may carry: 2048-, 3072- and 4096-bit RSA. */
|
|
25
|
-
export declare const WRAPPED_KEY_BYTES: readonly number[];
|
|
26
|
-
/** The AES-GCM nonce length. */
|
|
27
|
-
export declare const IV_BYTES = 12;
|
|
28
|
-
/** The AES-GCM authentication tag length, the smallest ciphertext segment. */
|
|
29
|
-
export declare const GCM_TAG_BYTES = 16;
|
|
30
|
-
/**
|
|
31
|
-
* The shape of a ciphertext: `v1.` and three base64url segments. A match is
|
|
32
|
-
* necessary but not sufficient; `parseCiphertext` also checks segment lengths.
|
|
33
|
-
*/
|
|
34
|
-
export declare const CIPHERTEXT_PATTERN: RegExp;
|
|
35
|
-
/** The decoded segments of a ciphertext. */
|
|
36
|
-
export interface CiphertextParts {
|
|
37
|
-
wrappedKey: Uint8Array;
|
|
38
|
-
iv: Uint8Array;
|
|
39
|
-
ciphertext: Uint8Array;
|
|
40
|
-
}
|
|
41
|
-
/** Unpadded base64url. */
|
|
42
|
-
export declare function encodeBase64Url(bytes: Uint8Array): string;
|
|
43
|
-
/** Decodes unpadded base64url; `null` when `text` isn't canonical base64url. */
|
|
44
|
-
export declare function decodeBase64Url(text: string): Uint8Array | null;
|
|
45
|
-
/** Splits and decodes a ciphertext; `null` when it isn't well formed. */
|
|
46
|
-
export declare function parseCiphertext(text: unknown): CiphertextParts | null;
|
|
47
|
-
/** Joins decoded segments into a ciphertext. Throws when a segment has the wrong length. */
|
|
48
|
-
export declare function formatCiphertext(parts: CiphertextParts): string;
|
|
49
|
-
/** The DER bytes of a single `PUBLIC KEY` PEM block; `null` for anything else. */
|
|
50
|
-
export declare function publicKeyDerFromPem(pem: string): Uint8Array | null;
|
|
51
|
-
/** A `PUBLIC KEY` PEM block for SPKI `der` bytes, with 64-character lines. */
|
|
52
|
-
export declare function publicKeyPemFromDer(der: Uint8Array): string;
|
|
53
|
-
/**
|
|
54
|
-
* Encrypts `value` for the holder of the private key matching `publicKeyPem`
|
|
55
|
-
* (an SPKI `PUBLIC KEY` PEM, such as `.deco/secrets.pub`).
|
|
56
|
-
*/
|
|
57
|
-
export declare function encryptToCiphertext(publicKeyPem: string, value: string): Promise<string>;
|
|
58
|
-
//# sourceMappingURL=ciphertext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ciphertext.d.ts","sourceRoot":"","sources":["../../src/v8/ciphertext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,uDAAuD;AACvD,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC,qFAAqF;AACrF,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAAoB,CAAC;AAEpE,gCAAgC;AAChC,eAAO,MAAM,QAAQ,KAAK,CAAC;AAE3B,8EAA8E;AAC9E,eAAO,MAAM,aAAa,KAAK,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAyD,CAAC;AAEzF,4CAA4C;AAC5C,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,UAAU,CAAC;IACvB,EAAE,EAAE,UAAU,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;CACxB;AAID,0BAA0B;AAC1B,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAMzD;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAa/D;AAOD,yEAAyE;AACzE,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CASrE;AAED,4FAA4F;AAC5F,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAY/D;AAID,kFAAkF;AAClF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAYlE;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAQ3D;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,YAAY,EAA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