@zincapp/znvault-cli 4.23.0 → 4.24.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.
Files changed (36) hide show
  1. package/dist/commands/dynamic-secrets/connection.js +1 -1
  2. package/dist/commands/dynamic-secrets/connection.js.map +1 -1
  3. package/dist/commands/dynamic-secrets/index.d.ts.map +1 -1
  4. package/dist/commands/dynamic-secrets/index.js +16 -17
  5. package/dist/commands/dynamic-secrets/index.js.map +1 -1
  6. package/dist/commands/dynamic-secrets/lease.d.ts.map +1 -1
  7. package/dist/commands/dynamic-secrets/lease.js +3 -1
  8. package/dist/commands/dynamic-secrets/lease.js.map +1 -1
  9. package/dist/commands/dynamic-secrets/role.js +1 -1
  10. package/dist/commands/dynamic-secrets/role.js.map +1 -1
  11. package/dist/commands/dynamic-secrets/types.d.ts +2 -1
  12. package/dist/commands/dynamic-secrets/types.d.ts.map +1 -1
  13. package/dist/commands/lmk-ceremony.d.ts +3 -0
  14. package/dist/commands/lmk-ceremony.d.ts.map +1 -0
  15. package/dist/commands/lmk-ceremony.js +597 -0
  16. package/dist/commands/lmk-ceremony.js.map +1 -0
  17. package/dist/commands/lmk-escrow.d.ts.map +1 -1
  18. package/dist/commands/lmk-escrow.js +2 -0
  19. package/dist/commands/lmk-escrow.js.map +1 -1
  20. package/dist/lib/ceremony/gates.d.ts +126 -0
  21. package/dist/lib/ceremony/gates.d.ts.map +1 -0
  22. package/dist/lib/ceremony/gates.js +270 -0
  23. package/dist/lib/ceremony/gates.js.map +1 -0
  24. package/dist/lib/ceremony/system.d.ts +36 -0
  25. package/dist/lib/ceremony/system.d.ts.map +1 -0
  26. package/dist/lib/ceremony/system.js +176 -0
  27. package/dist/lib/ceremony/system.js.map +1 -0
  28. package/dist/lib/ceremony/workspace.d.ts +54 -0
  29. package/dist/lib/ceremony/workspace.d.ts.map +1 -0
  30. package/dist/lib/ceremony/workspace.js +98 -0
  31. package/dist/lib/ceremony/workspace.js.map +1 -0
  32. package/dist/lib/db/key-lifecycle.d.ts +86 -0
  33. package/dist/lib/db/key-lifecycle.d.ts.map +1 -0
  34. package/dist/lib/db/key-lifecycle.js +182 -0
  35. package/dist/lib/db/key-lifecycle.js.map +1 -0
  36. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"lmk-escrow.js","sourceRoot":"","sources":["../../src/commands/lmk-escrow.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,2BAA2B,EAC3B,0BAA0B,GAG3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAiB3C;;;;;;;;GAQG;AACH,KAAK,UAAU,SAAS,CACtB,OAAwB,EACxB,QAAuB;IAEvB,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAChD,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,QA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AC,CAAC,+BAA+B,CACpC,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC;YACd,MAAM,EAAE,OAAO,CAAC,UAAU;YAC1B,IAAI,EAAE,OAAO,CAAC,SAAS;YACvB,MAAM,EAAE,OAAO,CAAC,QAAQ;YACxB,oBAAoB,EAAE,OAAO,CAAC,gBAAgB;YAC9C,iBAAiB,EAAE,OAAO,CAAC,MAAM;SAClC,CAAC,CAAC;QACH,MAAM,CAAC,OAAO,CACZ,OAAO,CAAC,OAAO,KAAK,UAAU;YAC5B,CAAC,CAAC,yEAAyE;YAC3E,CAAC,CAAC,8DAA8D,CACnE,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,126 @@
1
+ /** A row of `root_key_envelopes`, reduced to what a gate needs. */
2
+ export interface EnvelopeRef {
3
+ providerId: string;
4
+ /** Publishable KCV recorded at wrap time. The anchor. */
5
+ kcv: string;
6
+ }
7
+ /** A mounted escrow device, as the system reports it. */
8
+ export interface MountedDevice {
9
+ mountPoint: string;
10
+ /** USB serial — the stable identity. `null` if it could not be read. */
11
+ usbSerial: string | null;
12
+ /** Volume label. A NAME, not an identity: it changes when reformatted. */
13
+ volumeLabel: string;
14
+ }
15
+ /** An in-flight key-lifecycle operation (migration 093). */
16
+ export interface ActiveOperation {
17
+ operationId: string;
18
+ kind: string;
19
+ phase: string;
20
+ ownerPrincipal: string;
21
+ startedAt: string;
22
+ }
23
+ /**
24
+ * The gate that replaces `--from-provider` when the appliance is unreachable.
25
+ *
26
+ * `--from-provider` cannot run from the operator's Mac: the Sentinel listens
27
+ * only on the crypto VLAN and its allowlist is CN `vault-1..5`. But what it
28
+ * contributed was ONE thing — checking the key against the KCV PostgreSQL
29
+ * recorded when the envelope was wrapped, a value the source neither supplies
30
+ * nor can influence at read time.
31
+ *
32
+ * That check does not need the appliance. It needs the database. So it survives
33
+ * the topology.
34
+ *
35
+ * Without it, the ceremony escrows whatever it was handed: the bundle would
36
+ * verify against itself perfectly and restore a key that opens nothing here.
37
+ *
38
+ * @throws naming both fingerprints.
39
+ */
40
+ export declare function assertKeyMatchesEnvelope(key: Buffer, envelope: EnvelopeRef): void;
41
+ /**
42
+ * The same check for a key that has no envelope to anchor against.
43
+ *
44
+ * The legacy BSK is covered by NO provider: its only protection is file
45
+ * permissions on five nodes, and it is the only key for the retained backups
46
+ * from before the 2026-05-17 cutover. Its anchor is therefore the fingerprint
47
+ * recorded in the custody inventory and verified independently on three nodes.
48
+ *
49
+ * @param label what is being checked, so a failure names it.
50
+ */
51
+ export declare function assertKeyMatchesExpectedKcv(key: Buffer, expectedKcv: string, label: string): void;
52
+ /**
53
+ * Refuse to start while another key-lifecycle operation holds the slot.
54
+ *
55
+ * Two ceremonies at once, or a ceremony during an LMK rotation, is how the
56
+ * inventory and the bundle end up describing different moments. The database
57
+ * enforces the exclusion (migration 093's partial unique index); this turns the
58
+ * resulting 23505 into something an operator can act on.
59
+ */
60
+ export declare function assertNoOtherCeremonyRunning(active: ActiveOperation | null): void;
61
+ /** The phases of a ceremony, in the only order they are allowed to occur. */
62
+ export declare const CEREMONY_ROUTE: readonly ["preflight", "workspace", "material", "write-a", "write-b", "verify", "teardown"];
63
+ export type RoutePhase = (typeof CEREMONY_ROUTE)[number];
64
+ /**
65
+ * Refuse a phase that does not follow the one the ceremony is actually in.
66
+ *
67
+ * @throws naming both phases and what is expected next, because the operator is
68
+ * mid-ceremony and needs to know where they are, not merely that they are wrong.
69
+ */
70
+ export declare function assertTransitionAllowed(from: string, to: string): void;
71
+ /**
72
+ * Refuse to close a ceremony that did not travel the whole route.
73
+ *
74
+ * The check is over the RECORDED history rather than the current phase, so a
75
+ * ceremony that reached teardown by a path that skipped both writes is refused
76
+ * at the last moment even if every individual transition were somehow allowed.
77
+ *
78
+ * @param recorded every phase in `key_lifecycle_phase_events`, in order.
79
+ */
80
+ export declare function assertRouteComplete(recorded: readonly string[]): void;
81
+ /**
82
+ * Normalise and check a copy label.
83
+ *
84
+ * There are exactly two copies. An unrecognised label used to fall through to
85
+ * copy A, so a typo silently corrupted the trail rather than stopping.
86
+ */
87
+ export declare function assertCopyLabel(label: string): 'A' | 'B';
88
+ /**
89
+ * Refuse to write both copies to the same physical device.
90
+ *
91
+ * THE GATE THIS REPLACES DID NOTHING. It compared the device's serial against a
92
+ * serial the operator had just typed — after the device had been LOOKED UP by
93
+ * that same serial. The mismatch branch was unreachable; the gate could only
94
+ * ever pass. What it claimed to prevent therefore remained wide open: write copy
95
+ * A to a device, then copy B to the same device, and the operator walks away
96
+ * with both bundles on one stick and none on the other, believing there are two
97
+ * copies in two locations.
98
+ *
99
+ * The fix is to compare against something the operator cannot supply at this
100
+ * moment: the serial ALREADY RECORDED for the other copy, read back from the
101
+ * append-only phase events of this same ceremony.
102
+ *
103
+ * @param serial the device about to be written.
104
+ * @param otherCopySerial what this ceremony recorded for the other copy, or
105
+ * `null` if that copy has not been written yet.
106
+ */
107
+ export declare function assertNotTheOtherCopy(serial: string, copy: 'A' | 'B', otherCopySerial: string | null): void;
108
+ /**
109
+ * Refuse to drive a ceremony that belongs to another machine.
110
+ *
111
+ * The state lives in the cluster database, so any host with DATABASE_URL can
112
+ * reach any ceremony — and every fact this command checks is gathered LOCALLY.
113
+ * Run `teardown` against another Mac's ceremony and `hdiutil detach` finds
114
+ * nothing, `mount` reports nothing, and the teardown gate passes: it truthfully
115
+ * observes that the device is absent HERE while the real RAM volume stays
116
+ * mounted THERE, with the bootstrap key in it. The check that fixed the argv
117
+ * problem does not survive the wrong host, so the host has to be checked too.
118
+ *
119
+ * A ceremony is a single-machine procedure by construction: one operator, one
120
+ * RAM volume, two devices in their hands.
121
+ */
122
+ export declare function assertCeremonyIsOurs(active: {
123
+ ownerNodeId: string;
124
+ ownerPrincipal: string;
125
+ }, thisNodeId: string): void;
126
+ //# sourceMappingURL=gates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gates.d.ts","sourceRoot":"","sources":["../../../src/lib/ceremony/gates.ts"],"names":[],"m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AAE,MAAM,GAAG,GAAG,GAAG,GAAG,CASxD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,GAAG,GAAG,GAAG,EACf,eAAe,EAAE,MAAM,GAAG,IAAI,GAC7B,IAAI,CAWN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,EACvD,UAAU,EAAE,MAAM,GACjB,IAAI,CAUN"}
@@ -0,0 +1,270 @@
1
+ // Path: src/lib/ceremony/gates.ts
2
+ //
3
+ // The gates an escrow ceremony refuses to advance past.
4
+ //
5
+ // Every one of them exists because of a specific way the ceremony can SUCCEED
6
+ // while achieving nothing — which is the failure mode that matters here, since
7
+ // nobody opens an escrow bundle until the day everything else is already gone.
8
+ //
9
+ // Pure functions on purpose. The command around them drives `hdiutil`, `ssh`
10
+ // and a USB device, none of which can be unit-tested; everything that DECIDES
11
+ // anything lives here.
12
+ import { computeBskKcv, isBskKcv } from '../kcv.js';
13
+ const BSK_LEN = 32;
14
+ /**
15
+ * The gate that replaces `--from-provider` when the appliance is unreachable.
16
+ *
17
+ * `--from-provider` cannot run from the operator's Mac: the Sentinel listens
18
+ * only on the crypto VLAN and its allowlist is CN `vault-1..5`. But what it
19
+ * contributed was ONE thing — checking the key against the KCV PostgreSQL
20
+ * recorded when the envelope was wrapped, a value the source neither supplies
21
+ * nor can influence at read time.
22
+ *
23
+ * That check does not need the appliance. It needs the database. So it survives
24
+ * the topology.
25
+ *
26
+ * Without it, the ceremony escrows whatever it was handed: the bundle would
27
+ * verify against itself perfectly and restore a key that opens nothing here.
28
+ *
29
+ * @throws naming both fingerprints.
30
+ */
31
+ export function assertKeyMatchesEnvelope(key, envelope) {
32
+ if (!isBskKcv(envelope.kcv)) {
33
+ throw new Error(`The envelope for provider '${envelope.providerId}' records a KCV that is not ` +
34
+ `a kcv1: fingerprint (${JSON.stringify(envelope.kcv)}). The row in ` +
35
+ 'root_key_envelopes is malformed — this is a database problem, not a key ' +
36
+ 'problem. Do not proceed.');
37
+ }
38
+ if (key.length !== BSK_LEN) {
39
+ throw new Error(`A bootstrap key is exactly ${String(BSK_LEN)} bytes; this one is ${String(key.length)} bytes.`);
40
+ }
41
+ const actual = computeBskKcv(key);
42
+ if (actual !== envelope.kcv) {
43
+ throw new Error(`The key does not match what provider '${envelope.providerId}' recorded: it is a ` +
44
+ `DIFFERENT key. Envelope records ${envelope.kcv}; the key provided is ${actual}. ` +
45
+ 'Refusing to build an escrow bundle around it — the bundle would verify ' +
46
+ 'against itself and restore a key that opens nothing in this deployment.');
47
+ }
48
+ }
49
+ /**
50
+ * The same check for a key that has no envelope to anchor against.
51
+ *
52
+ * The legacy BSK is covered by NO provider: its only protection is file
53
+ * permissions on five nodes, and it is the only key for the retained backups
54
+ * from before the 2026-05-17 cutover. Its anchor is therefore the fingerprint
55
+ * recorded in the custody inventory and verified independently on three nodes.
56
+ *
57
+ * @param label what is being checked, so a failure names it.
58
+ */
59
+ export function assertKeyMatchesExpectedKcv(key, expectedKcv, label) {
60
+ if (!isBskKcv(expectedKcv)) {
61
+ throw new Error(`The expected fingerprint for the ${label} is not a kcv1: value.`);
62
+ }
63
+ if (key.length !== BSK_LEN) {
64
+ throw new Error(`The ${label} must be ${String(BSK_LEN)} bytes, got ${String(key.length)}.`);
65
+ }
66
+ const actual = computeBskKcv(key);
67
+ if (actual !== expectedKcv) {
68
+ throw new Error(`The ${label} does not match its recorded fingerprint. Expected ${expectedKcv}, ` +
69
+ `got ${actual}. Either the wrong file was fetched, or the key on the node has ` +
70
+ 'changed — both are reasons to stop the ceremony, not to continue.');
71
+ }
72
+ }
73
+ // REMOVED, 2026-08-25, after an independent audit: `assertDeviceIsExpectedCopy`.
74
+ //
75
+ // It compared a device's USB serial against a serial the operator had typed —
76
+ // but the command found the device BY that serial first, so the mismatch branch
77
+ // was unreachable and the gate could only ever pass. It was pure, it was
78
+ // tested, and it decided nothing. Its replacement is `assertNotTheOtherCopy`
79
+ // below, which compares against the serial this ceremony already RECORDED for
80
+ // the other copy: a value the operator cannot retype at the moment of the check.
81
+ //
82
+ // The lesson is not about this function. A gate is only as good as what it is
83
+ // handed, and a test that feeds it inputs the caller can never produce will
84
+ // stay green forever while the door stands open.
85
+ /**
86
+ * Refuse to start while another key-lifecycle operation holds the slot.
87
+ *
88
+ * Two ceremonies at once, or a ceremony during an LMK rotation, is how the
89
+ * inventory and the bundle end up describing different moments. The database
90
+ * enforces the exclusion (migration 093's partial unique index); this turns the
91
+ * resulting 23505 into something an operator can act on.
92
+ */
93
+ export function assertNoOtherCeremonyRunning(active) {
94
+ if (active === null)
95
+ return;
96
+ throw new Error(`Another key-lifecycle operation is in progress: ${active.kind}, phase ` +
97
+ `'${active.phase}', held by ${active.ownerPrincipal} since ${active.startedAt} ` +
98
+ `(operation ${active.operationId}). Finish or abandon it before starting a ` +
99
+ 'ceremony — two operations at once make the bundle and the inventory ' +
100
+ 'describe different moments.');
101
+ }
102
+ // ---------------------------------------------------------------------------
103
+ // The route
104
+ // ---------------------------------------------------------------------------
105
+ //
106
+ // ADDED AFTER AN INDEPENDENT AUDIT, 2026-08-25. The first version of this
107
+ // command had gates but no route: every subcommand jumped to a fixed phase from
108
+ // ANY phase, and `finish` asked only "are we at teardown?". So this worked, with
109
+ // no error at any step:
110
+ //
111
+ // ceremony start -> preflight
112
+ // ceremony teardown … -> teardown
113
+ // ceremony finish -> COMPLETED
114
+ //
115
+ // A ceremony that created no workspace, checked no key, touched no device, and
116
+ // wrote no bundle — recorded as COMPLETED in the one place anybody will look
117
+ // years later. The gates were pure, tested and entirely bypassable, which is
118
+ // worse than not having them: the record inspires confidence it has not earned.
119
+ /** The phases of a ceremony, in the only order they are allowed to occur. */
120
+ export const CEREMONY_ROUTE = [
121
+ 'preflight',
122
+ 'workspace',
123
+ 'material',
124
+ 'write-a',
125
+ 'write-b',
126
+ 'verify',
127
+ 'teardown',
128
+ ];
129
+ /**
130
+ * Which phase may follow which.
131
+ *
132
+ * `material` repeats because a ceremony checks several keys (the current BSK,
133
+ * the legacy BSK, the mini-CA) and each one is a separate check. Nothing else
134
+ * repeats: writing copy A twice means something is wrong that a re-run should
135
+ * not paper over.
136
+ *
137
+ * TEARDOWN IS REACHABLE FROM EVERYWHERE, and that is not a hole. The first
138
+ * version of this table allowed it only after `verify`, which deadlocked the
139
+ * exact case it most needed to serve: a ceremony abandoned at `material` has a
140
+ * RAM volume with key material in it, and refusing to tear it down leaves the
141
+ * bootstrap key mounted with no command able to destroy it. Destroying the
142
+ * workspace is always safe and always desirable. What must never be reachable
143
+ * early is COMPLETED — and that is enforced separately, by
144
+ * `assertRouteComplete`, which asks the recorded history rather than the
145
+ * current phase.
146
+ */
147
+ const ALLOWED_NEXT = {
148
+ preflight: ['workspace', 'teardown'],
149
+ workspace: ['material', 'teardown'],
150
+ material: ['material', 'write-a', 'teardown'],
151
+ 'write-a': ['write-b', 'teardown'],
152
+ 'write-b': ['verify', 'teardown'],
153
+ verify: ['teardown'],
154
+ teardown: [],
155
+ };
156
+ function isRoutePhase(phase) {
157
+ return CEREMONY_ROUTE.includes(phase);
158
+ }
159
+ /**
160
+ * Refuse a phase that does not follow the one the ceremony is actually in.
161
+ *
162
+ * @throws naming both phases and what is expected next, because the operator is
163
+ * mid-ceremony and needs to know where they are, not merely that they are wrong.
164
+ */
165
+ export function assertTransitionAllowed(from, to) {
166
+ if (!isRoutePhase(from)) {
167
+ throw new Error(`The ceremony is at an unrecognised phase '${from}'. Refusing to move it: ` +
168
+ 'the record would stop describing anything. Inspect the operation by hand.');
169
+ }
170
+ if (!isRoutePhase(to)) {
171
+ throw new Error(`'${to}' is not a phase of a ceremony.`);
172
+ }
173
+ const allowed = ALLOWED_NEXT[from];
174
+ if (!allowed.includes(to)) {
175
+ const next = allowed.length === 0
176
+ ? 'nothing — the ceremony is at its last phase and can only be closed'
177
+ : allowed.map((p) => `'${p}'`).join(' or ');
178
+ throw new Error(`A ceremony cannot go from '${from}' to '${to}'. What follows '${from}' is ` +
179
+ `${next}. Skipping a phase does not skip the work — it only removes it ` +
180
+ 'from the record.');
181
+ }
182
+ }
183
+ /**
184
+ * Refuse to close a ceremony that did not travel the whole route.
185
+ *
186
+ * The check is over the RECORDED history rather than the current phase, so a
187
+ * ceremony that reached teardown by a path that skipped both writes is refused
188
+ * at the last moment even if every individual transition were somehow allowed.
189
+ *
190
+ * @param recorded every phase in `key_lifecycle_phase_events`, in order.
191
+ */
192
+ export function assertRouteComplete(recorded) {
193
+ const seen = new Set(recorded);
194
+ const missing = CEREMONY_ROUTE.filter((p) => !seen.has(p));
195
+ if (missing.length > 0) {
196
+ throw new Error(`This ceremony never reached ${missing.map((p) => `'${p}'`).join(', ')}. ` +
197
+ 'Closing it as COMPLETED would record two escrow copies that were never ' +
198
+ 'written or never verified — and nobody opens an escrow bundle until the ' +
199
+ 'day everything else is already gone. Abandon it instead, with the reason: ' +
200
+ "'ceremony abort --reason …'.");
201
+ }
202
+ }
203
+ /**
204
+ * Normalise and check a copy label.
205
+ *
206
+ * There are exactly two copies. An unrecognised label used to fall through to
207
+ * copy A, so a typo silently corrupted the trail rather than stopping.
208
+ */
209
+ export function assertCopyLabel(label) {
210
+ const upper = label.trim().toUpperCase();
211
+ if (upper !== 'A' && upper !== 'B') {
212
+ throw new Error(`'${label}' is not a copy: there are exactly two, A and B. A label that is ` +
213
+ 'neither would be recorded against a phase it does not belong to.');
214
+ }
215
+ return upper;
216
+ }
217
+ /**
218
+ * Refuse to write both copies to the same physical device.
219
+ *
220
+ * THE GATE THIS REPLACES DID NOTHING. It compared the device's serial against a
221
+ * serial the operator had just typed — after the device had been LOOKED UP by
222
+ * that same serial. The mismatch branch was unreachable; the gate could only
223
+ * ever pass. What it claimed to prevent therefore remained wide open: write copy
224
+ * A to a device, then copy B to the same device, and the operator walks away
225
+ * with both bundles on one stick and none on the other, believing there are two
226
+ * copies in two locations.
227
+ *
228
+ * The fix is to compare against something the operator cannot supply at this
229
+ * moment: the serial ALREADY RECORDED for the other copy, read back from the
230
+ * append-only phase events of this same ceremony.
231
+ *
232
+ * @param serial the device about to be written.
233
+ * @param otherCopySerial what this ceremony recorded for the other copy, or
234
+ * `null` if that copy has not been written yet.
235
+ */
236
+ export function assertNotTheOtherCopy(serial, copy, otherCopySerial) {
237
+ if (otherCopySerial === null)
238
+ return;
239
+ if (serial === otherCopySerial) {
240
+ throw new Error(`This is the same physical device as copy ${copy === 'A' ? 'B' : 'A'} ` +
241
+ `(USB serial ${serial}). Both bundles would sit on one stick and the other ` +
242
+ 'would hold nothing, with no error at any step and nothing in the record ' +
243
+ 'to show it. The two copies exist to be in two places: plug in the other ' +
244
+ 'device.');
245
+ }
246
+ }
247
+ /**
248
+ * Refuse to drive a ceremony that belongs to another machine.
249
+ *
250
+ * The state lives in the cluster database, so any host with DATABASE_URL can
251
+ * reach any ceremony — and every fact this command checks is gathered LOCALLY.
252
+ * Run `teardown` against another Mac's ceremony and `hdiutil detach` finds
253
+ * nothing, `mount` reports nothing, and the teardown gate passes: it truthfully
254
+ * observes that the device is absent HERE while the real RAM volume stays
255
+ * mounted THERE, with the bootstrap key in it. The check that fixed the argv
256
+ * problem does not survive the wrong host, so the host has to be checked too.
257
+ *
258
+ * A ceremony is a single-machine procedure by construction: one operator, one
259
+ * RAM volume, two devices in their hands.
260
+ */
261
+ export function assertCeremonyIsOurs(active, thisNodeId) {
262
+ if (active.ownerNodeId !== thisNodeId) {
263
+ throw new Error(`This ceremony is being run on ${active.ownerNodeId} by ${active.ownerPrincipal}, ` +
264
+ `and you are on ${thisNodeId}. Every check this command makes — the RAM ` +
265
+ 'volume, the mounted devices, the teardown — is about the machine it runs ' +
266
+ 'on, so from here they would describe the wrong computer and pass. Work on ' +
267
+ `${active.ownerNodeId}, or have that ceremony abandoned first.`);
268
+ }
269
+ }
270
+ //# sourceMappingURL=gates.js.map
@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;;;;GAkBG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAAc,EACd,IAAe,EACf,eAA8B;IAE9B,IAAI,eAAe,KAAK,IAAI;QAAE,OAAO;IACrC,IAAI,MAAM,KAAK,eAAe,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACb,4CAA4C,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG;YACvE,eAAe,MAAM,uDAAuD;YAC5E,0EAA0E;YAC1E,0EAA0E;YAC1E,SAAS,CACV,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAuD,EACvD,UAAkB;IAElB,IAAI,MAAM,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CACb,iCAAiC,MAAM,CAAC,WAAW,OAAO,MAAM,CAAC,cAAc,IAAI;YACnF,kBAAkB,UAAU,6CAA6C;YACzE,2EAA2E;YAC3E,4EAA4E;YAC5E,GAAG,MAAM,CAAC,WAAW,0CAA0C,CAChE,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { DeviceFacts, TeardownFacts } from './workspace.js';
2
+ import type { MountedDevice } from './gates.js';
3
+ /**
4
+ * Create a RAM-backed volume and report what the system says about it.
5
+ *
6
+ * Returns facts rather than throwing on failure: `assertRamBacked` is what
7
+ * refuses, and it must see the same facts an operator would — including the
8
+ * case where the mount silently did not happen, which is the whole reason the
9
+ * gate exists.
10
+ *
11
+ * `awk '{print $1}'` and NOT `tr -d ' '`: hdiutil pads the device path with
12
+ * TABS, and stripping only spaces yields a malformed path whose mount fails
13
+ * quietly while writes land on the SSD. That was a real hour of this build.
14
+ */
15
+ export declare function createRamWorkspace(megabytes: number): DeviceFacts;
16
+ /** What `hdiutil info` and `mount` currently say about a device. */
17
+ export declare function describeDevice(device: string): DeviceFacts;
18
+ /**
19
+ * Unmount and detach, then report whether it worked.
20
+ *
21
+ * Reports rather than asserts, for the same reason as above: unmounting does
22
+ * not destroy a RAM device, and `assertTornDown` is what insists on both.
23
+ */
24
+ export declare function destroyRamWorkspace(device: string): TeardownFacts;
25
+ /**
26
+ * Every mounted datAshur, with the USB serial that actually identifies it.
27
+ *
28
+ * The mapping matters more than it looks: both devices shipped with the same
29
+ * volume label, so the mount path is not an identity. This walks the IO
30
+ * registry to pair each BSD disk with the serial of the USB device it hangs
31
+ * from — the same walk done by hand on 2026-08-25 to tell copy A from copy B.
32
+ */
33
+ export declare function listEscrowDevices(): MountedDevice[];
34
+ /** Is Spotlight indexing this path? Ceremony hygiene, reported not enforced. */
35
+ export declare function indexingEnabled(path: string): boolean | null;
36
+ //# sourceMappingURL=system.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../src/lib/ceremony/system.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAuChD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,CAajE;AAED,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAqB1D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAejE;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,EAAE,CA6BnD;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAM5D"}