@941design/marmot 0.2.0-alpha.0 → 0.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/account/teardown.d.ts +66 -3
- package/dist/account/teardown.js +24 -2
- package/dist/client/admission-cleanup.d.ts +197 -0
- package/dist/client/admission-cleanup.js +635 -0
- package/dist/client/adoption-proof.d.ts +39 -0
- package/dist/client/adoption-proof.js +102 -0
- package/dist/client/before-publish-hooks.js +3 -1
- package/dist/client/commit-redrive.d.ts +28 -4
- package/dist/client/commit-redrive.js +54 -1
- package/dist/client/confirm-hooks.d.ts +6 -1
- package/dist/client/confirm-hooks.js +15 -0
- package/dist/client/create-client.d.ts +107 -3
- package/dist/client/create-client.js +114 -7
- package/dist/client/group-availability.d.ts +182 -0
- package/dist/client/group-availability.js +301 -0
- package/dist/client/group-history.d.ts +26 -0
- package/dist/client/group-history.js +77 -7
- package/dist/client/group-records.d.ts +39 -2
- package/dist/client/group-records.js +88 -5
- package/dist/client/group-runtime.d.ts +30 -3
- package/dist/client/group-runtime.js +131 -21
- package/dist/client/group-snapshot.d.ts +7 -1
- package/dist/client/group-snapshot.js +23 -2
- package/dist/client/index.d.ts +4 -1
- package/dist/client/ingest.js +47 -13
- package/dist/client/invitation-outcomes.d.ts +50 -0
- package/dist/client/invitation-outcomes.js +135 -0
- package/dist/client/opaque-candidates.d.ts +2 -1
- package/dist/client/opaque-candidates.js +2 -1
- package/dist/client/own-change-outbox.js +2 -0
- package/dist/client/pipeline.d.ts +30 -1
- package/dist/client/pipeline.js +142 -21
- package/dist/client/reentrancy-guard.d.ts +6 -0
- package/dist/client/reentrancy-guard.js +6 -0
- package/dist/history/admission-lineage.d.ts +186 -0
- package/dist/history/admission-lineage.js +589 -0
- package/dist/history/fencing.d.ts +41 -0
- package/dist/history/fencing.js +67 -7
- package/dist/history/index.d.ts +2 -1
- package/dist/history/index.js +2 -1
- package/dist/history/own-change.d.ts +13 -1
- package/dist/invitations/decline.d.ts +8 -2
- package/dist/invitations/decline.js +9 -3
- package/dist/invitations/delivery-evidence.d.ts +288 -0
- package/dist/invitations/delivery-evidence.js +766 -0
- package/dist/invitations/index.d.ts +4 -2
- package/dist/invitations/index.js +4 -2
- package/dist/invitations/invitation-outcome.d.ts +110 -0
- package/dist/invitations/invitation-outcome.js +210 -0
- package/dist/invitations/invite.d.ts +61 -6
- package/dist/invitations/invite.js +187 -51
- package/dist/invitations/welcome-processor.d.ts +20 -1
- package/dist/invitations/welcome-processor.js +81 -20
- package/dist/shared/errors.d.ts +7 -0
- package/dist/shared/errors.js +11 -0
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/storage/index.d.ts +10 -0
- package/dist/storage/index.js +33 -1
- package/dist/storage/lease.d.ts +13 -0
- package/dist/storage/lease.js +51 -0
- package/package.json +2 -2
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admission lineage (epic marmot-invitation-outcomes S4; ADR-019 D1; architecture SC-4, I10–I12).
|
|
3
|
+
*
|
|
4
|
+
* An *admission* begins at the exact MLS Commit that inserted a leaf at one position of this group (the Add an
|
|
5
|
+
* {@link LineageAnchor} names), continues through verified Updates and path successions of that leaf, and ends on the
|
|
6
|
+
* first Remove of that position (inline, by reference, or a `self_remove` of its own leaf). Reuse of the position, the
|
|
7
|
+
* signature key, the leaf bytes or the last-resort KeyPackage after that Remove is a NEW admission: the walk stops at
|
|
8
|
+
* the first end and never resumes. A Remove and an Add at the same position in one commit ends the old admission
|
|
9
|
+
* (`replaced`).
|
|
10
|
+
*
|
|
11
|
+
* Everything here is pure: the occupancy of an admission is derived from the persisted rewind window (the selected
|
|
12
|
+
* path, its serialized states and authenticated commits) plus at most one {@link LineageCheckpoint} — the occupancy at
|
|
13
|
+
* a window root, written by `recordTransition` before the window that prunes the anchor (or the previous checkpoint)
|
|
14
|
+
* is persisted (I11). The derivation FAILS CLOSED (I12): whatever it cannot prove — an undecodable or non-public
|
|
15
|
+
* commit, a proposal reference the parent does not hold, a leaf that changes without an Update, a checkpoint and an
|
|
16
|
+
* anchor both missing from the window while the window root is newer than the checkpoint — is a `gap`, never
|
|
17
|
+
* `occupying`.
|
|
18
|
+
*
|
|
19
|
+
* What is guaranteed: a derivation reads `occupying` only when its proof starts at the anchored Add on the selected
|
|
20
|
+
* path, or at a checkpoint this store wrote from authenticated transitions (`transition`), or at an imported
|
|
21
|
+
* (`snapshot`) checkpoint the window cannot refute — its node is on the path at its epoch, the Add is nowhere in the
|
|
22
|
+
* window, and the walk from the window's root to that node carries the position's occupant to the claimed key without
|
|
23
|
+
* a Remove or an unprovable link (so a re-admission at the position inside the window is never taken for the
|
|
24
|
+
* anchored one). Whether the root's occupant is the anchored admission is, for a snapshot checkpoint, the snapshot's
|
|
25
|
+
* own claim: an imported checkpoint at the window root is trusted as far as the window cannot contradict it, and
|
|
26
|
+
* keeps `snapshot` provenance (never settled) until a transition re-proves it.
|
|
27
|
+
*
|
|
28
|
+
* `history/` never imports `invitations/` (SC-1 I3): {@link LineageAnchor} is structurally identical to the
|
|
29
|
+
* invitations module's `AddAnchor`; `client/` maps between them.
|
|
30
|
+
*/
|
|
31
|
+
import { deserializeClientState } from '@941design/marmot-engine/core';
|
|
32
|
+
import { bytesToBase64, contentTypes, defaultProposalTypes, nodeTypes, proposalOrRefTypes, selfRemoveProposalType, senderTypes, wireformats, } from '@941design/marmot-engine/mls';
|
|
33
|
+
import { isMalformedRowError, MarmotError } from '../shared/index.js';
|
|
34
|
+
import { hexOf } from './hex.js';
|
|
35
|
+
import { canonicalPath, commitOf, linkRestorable } from './retained-window.js';
|
|
36
|
+
/** Group extension holding one {@link AdmissionLineageRecord} per anchor, keyed `<addDigest>:<leafIndex>`. */
|
|
37
|
+
export const ADMISSION_LINEAGE_EXTENSION = 'marmot.admission-lineage';
|
|
38
|
+
/** The record key of `anchor`. */
|
|
39
|
+
export function lineageKey(anchor) {
|
|
40
|
+
return `${anchor.addDigest}:${anchor.leafIndex}`;
|
|
41
|
+
}
|
|
42
|
+
/** The record an own Add confirmation seeds: the Add node (at `addEpoch`) is its checkpoint, occupying. */
|
|
43
|
+
export function seedLineage(anchor, candidateIds, addEpoch) {
|
|
44
|
+
return {
|
|
45
|
+
v: 1,
|
|
46
|
+
anchor,
|
|
47
|
+
candidateIds: [...new Set(candidateIds)].sort(),
|
|
48
|
+
checkpoint: { at: { tag: anchor.addTag, epoch: addEpoch }, occupancy: { kind: 'occupying', leafKey: anchor.leafKey }, provenance: 'transition' },
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* `stored` with `seed`'s candidates merged in, or `seed` when nothing is stored. A stored record keeps its checkpoint
|
|
53
|
+
* (idempotent: a re-run confirmation never moves an advanced checkpoint back to the Add). `undefined` when `stored`
|
|
54
|
+
* already holds every candidate (nothing to write).
|
|
55
|
+
*/
|
|
56
|
+
export function mergeSeed(stored, seed) {
|
|
57
|
+
if (stored === undefined)
|
|
58
|
+
return seed;
|
|
59
|
+
const ids = new Set(stored.candidateIds);
|
|
60
|
+
if (seed.candidateIds.every((id) => ids.has(id)))
|
|
61
|
+
return undefined;
|
|
62
|
+
for (const id of seed.candidateIds)
|
|
63
|
+
ids.add(id);
|
|
64
|
+
return { ...stored, candidateIds: [...ids].sort() };
|
|
65
|
+
}
|
|
66
|
+
/** Hex signature key of the leaf at `leafIndex` of `state`, or `undefined` when the leaf is blank (or out of range). */
|
|
67
|
+
export function leafKeyAt(state, leafIndex) {
|
|
68
|
+
const node = state.ratchetTree[leafIndex * 2];
|
|
69
|
+
return node?.nodeType === nodeTypes.leaf ? hexOf(node.leaf.signaturePublicKey) : undefined;
|
|
70
|
+
}
|
|
71
|
+
/** The commit's proposals with their senders (a reference resolved against the parent's staged proposals), or `undefined`. */
|
|
72
|
+
function resolvedProposals(node, parent) {
|
|
73
|
+
const commit = commitOf(node);
|
|
74
|
+
if (commit === undefined)
|
|
75
|
+
return undefined;
|
|
76
|
+
const message = commit.message;
|
|
77
|
+
if (message.wireformat !== wireformats.mls_public_message)
|
|
78
|
+
return undefined;
|
|
79
|
+
const content = message.publicMessage.content;
|
|
80
|
+
if (content.contentType !== contentTypes.commit)
|
|
81
|
+
return undefined;
|
|
82
|
+
const committer = content.sender.senderType === senderTypes.member ? Number(content.sender.leafIndex) : undefined;
|
|
83
|
+
const proposals = [];
|
|
84
|
+
for (const entry of content.commit.proposals) {
|
|
85
|
+
if (entry.proposalOrRefType === proposalOrRefTypes.proposal) {
|
|
86
|
+
proposals.push({ proposal: entry.proposal, sender: committer, byReference: false });
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const staged = parent.unappliedProposals[bytesToBase64(entry.reference)];
|
|
90
|
+
if (staged === undefined)
|
|
91
|
+
return undefined;
|
|
92
|
+
proposals.push({ proposal: staged.proposal, sender: staged.senderLeafIndex === undefined ? undefined : Number(staged.senderLeafIndex), byReference: true });
|
|
93
|
+
}
|
|
94
|
+
return { proposals, committer };
|
|
95
|
+
}
|
|
96
|
+
function removes(entry, leafIndex) {
|
|
97
|
+
const { proposal } = entry;
|
|
98
|
+
if (proposal.proposalType === defaultProposalTypes.remove)
|
|
99
|
+
return 'remove' in proposal && Number(proposal.remove.removed) === leafIndex;
|
|
100
|
+
if (proposal.proposalType === selfRemoveProposalType)
|
|
101
|
+
return entry.sender === leafIndex;
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
function updates(entry, leafIndex) {
|
|
105
|
+
return entry.proposal.proposalType === defaultProposalTypes.update && entry.sender === leafIndex;
|
|
106
|
+
}
|
|
107
|
+
const gap = (reason) => ({ kind: 'gap', reason });
|
|
108
|
+
/**
|
|
109
|
+
* I10: the occupancy after one commit of the selected path. Only an `occupying` admission moves; every other
|
|
110
|
+
* occupancy is final for the walk. The commit must be a framed PublicMessage commit whose digest matches its stored
|
|
111
|
+
* one, every proposal reference must resolve against the parent's staged proposals, and both states must be at hand
|
|
112
|
+
* — otherwise `gap` (`undecodable-commit`). A Remove of the position (inline, by reference, or the leaf's own
|
|
113
|
+
* `self_remove`) ends it: `by-reference` when any such Remove came by reference, `replaced` when the same commit put
|
|
114
|
+
* a leaf back at the position, else `inline-remove`; `committerOwn` when this device committed it. Otherwise the leaf
|
|
115
|
+
* must still be there, and a changed signature key needs an Update by the leaf or the leaf's own commit (a path
|
|
116
|
+
* succession) — a leaf that changes or vanishes any other way is a `gap`. Never throws.
|
|
117
|
+
*/
|
|
118
|
+
export function admissionStep(occupancy, link, leafIndex) {
|
|
119
|
+
if (occupancy.kind !== 'occupying')
|
|
120
|
+
return occupancy;
|
|
121
|
+
try {
|
|
122
|
+
const node = link.node;
|
|
123
|
+
if (!linkRestorable(node) || node.digest === undefined)
|
|
124
|
+
return gap('undecodable-commit');
|
|
125
|
+
const parent = link.parentState();
|
|
126
|
+
const child = link.childState();
|
|
127
|
+
if (parent === undefined || child === undefined)
|
|
128
|
+
return gap('undecodable-commit');
|
|
129
|
+
const resolved = resolvedProposals(node, parent);
|
|
130
|
+
if (resolved === undefined)
|
|
131
|
+
return gap('undecodable-commit');
|
|
132
|
+
const childLeaf = leafKeyAt(child, leafIndex);
|
|
133
|
+
const ending = resolved.proposals.filter((p) => removes(p, leafIndex));
|
|
134
|
+
if (ending.length > 0) {
|
|
135
|
+
const by = ending.some((p) => p.byReference) ? 'by-reference' : childLeaf !== undefined ? 'replaced' : 'inline-remove';
|
|
136
|
+
const own = Number(parent.privatePath.leafIndex);
|
|
137
|
+
return { kind: 'ended', digest: node.digest, by, committerOwn: resolved.committer !== undefined && resolved.committer === own };
|
|
138
|
+
}
|
|
139
|
+
if (childLeaf === undefined)
|
|
140
|
+
return gap('undecodable-commit');
|
|
141
|
+
if (childLeaf !== occupancy.leafKey && resolved.committer !== leafIndex && !resolved.proposals.some((p) => updates(p, leafIndex)))
|
|
142
|
+
return gap('undecodable-commit');
|
|
143
|
+
return { kind: 'occupying', leafKey: childLeaf };
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return gap('undecodable-commit');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
export function stateResolver(window, tipState) {
|
|
150
|
+
const cache = new Map();
|
|
151
|
+
return (node) => {
|
|
152
|
+
if (node.tag === window.tipTag)
|
|
153
|
+
return tipState;
|
|
154
|
+
if (!cache.has(node.tag)) {
|
|
155
|
+
let state;
|
|
156
|
+
try {
|
|
157
|
+
state = node.snapshot === undefined ? undefined : deserializeClientState(node.snapshot);
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
state = undefined;
|
|
161
|
+
}
|
|
162
|
+
cache.set(node.tag, state);
|
|
163
|
+
}
|
|
164
|
+
return cache.get(node.tag);
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The occupancy of `record`'s admission at the tip of `window`'s selected path (`tipState` is the tip's state, the
|
|
169
|
+
* stored `clientState`), or at the path node `upTo`. The proof starts at the Add node when it is on the path, else at
|
|
170
|
+
* the checkpoint when its node is on the path (same epoch), and walks every later commit with {@link admissionStep}.
|
|
171
|
+
*
|
|
172
|
+
* - The Add node is in the window but off the path, or the record only holds its seed (the Add node itself) and the
|
|
173
|
+
* path covers the Add's epoch with another node or ends below it: `add-off-path` (the Add may return to the path).
|
|
174
|
+
* - Neither the Add nor the checkpoint is on the path otherwise: `gap` (`unprovable-root`) — fail closed (I12).
|
|
175
|
+
* - The start state must hold the admission's leaf at its position under the recorded key, and a derivation ending
|
|
176
|
+
* `occupying` must find that leaf on the end state; otherwise `gap`.
|
|
177
|
+
* - A proof that starts at an `occupying` checkpoint of `snapshot` provenance is re-checked against the window as a
|
|
178
|
+
* restore validates it (`snapshotCheckpointHolds`); one the window refutes is a `gap` (`restore`).
|
|
179
|
+
*/
|
|
180
|
+
export function deriveAdmission(record, window, tipState, upTo) {
|
|
181
|
+
return deriveWith(record, window, stateResolver(window, tipState), upTo);
|
|
182
|
+
}
|
|
183
|
+
function deriveWith(record, window, stateOf, upTo) {
|
|
184
|
+
const full = canonicalPath(window);
|
|
185
|
+
const last = full[full.length - 1];
|
|
186
|
+
const fallback = { tag: last?.tag ?? window.tipTag, epoch: last?.epoch ?? 0 };
|
|
187
|
+
const fail = (reason, at = fallback) => ({ occupancy: gap(reason), provenance: 'transition', at });
|
|
188
|
+
if (last === undefined)
|
|
189
|
+
return fail('unprovable-root');
|
|
190
|
+
let path = full;
|
|
191
|
+
if (upTo !== undefined) {
|
|
192
|
+
const cut = full.findIndex((n) => n.tag === upTo);
|
|
193
|
+
if (cut < 0)
|
|
194
|
+
return fail('unprovable-root');
|
|
195
|
+
path = full.slice(0, cut + 1);
|
|
196
|
+
}
|
|
197
|
+
const end = path[path.length - 1];
|
|
198
|
+
const at = { tag: end.tag, epoch: end.epoch };
|
|
199
|
+
const { anchor, checkpoint } = record;
|
|
200
|
+
const leafIndex = anchor.leafIndex;
|
|
201
|
+
let start;
|
|
202
|
+
let occupancy;
|
|
203
|
+
let provenance;
|
|
204
|
+
const onPath = path.findIndex((n) => n.tag === anchor.addTag);
|
|
205
|
+
const checkpointAt = checkpoint === undefined ? -1 : path.findIndex((n) => n.tag === checkpoint.at.tag && n.epoch === checkpoint.at.epoch);
|
|
206
|
+
if (onPath >= 0) {
|
|
207
|
+
const node = path[onPath];
|
|
208
|
+
// The Add node's own link (when the window still holds it) must be the anchored commit.
|
|
209
|
+
if (node.parentTag !== undefined && node.digest !== undefined && node.digest !== anchor.addDigest)
|
|
210
|
+
return fail('unprovable-root', at);
|
|
211
|
+
start = onPath;
|
|
212
|
+
occupancy = { kind: 'occupying', leafKey: anchor.leafKey };
|
|
213
|
+
provenance = checkpoint?.at.tag === anchor.addTag ? checkpoint.provenance : 'transition';
|
|
214
|
+
}
|
|
215
|
+
else if (checkpoint !== undefined && checkpointAt >= 0) {
|
|
216
|
+
start = checkpointAt;
|
|
217
|
+
occupancy = checkpoint.occupancy;
|
|
218
|
+
provenance = checkpoint.provenance;
|
|
219
|
+
}
|
|
220
|
+
else if (full.some((n) => n.tag === anchor.addTag)) {
|
|
221
|
+
// The Add comes after `upTo` on this path: nothing to say about `upTo` (never asked by the callers).
|
|
222
|
+
return fail('unprovable-root', at);
|
|
223
|
+
}
|
|
224
|
+
else if (window.nodes.has(anchor.addTag)) {
|
|
225
|
+
return { occupancy: { kind: 'add-off-path' }, provenance: 'transition', at };
|
|
226
|
+
}
|
|
227
|
+
else if (checkpoint !== undefined && checkpoint.at.tag === anchor.addTag) {
|
|
228
|
+
// Only the seed: the Add node left the window. Off the path when the path covers the Add's epoch (or ends below).
|
|
229
|
+
const root = path[0];
|
|
230
|
+
if (end.epoch < checkpoint.at.epoch || root.epoch <= checkpoint.at.epoch)
|
|
231
|
+
return { occupancy: { kind: 'add-off-path' }, provenance: 'transition', at };
|
|
232
|
+
return fail('unprovable-root', at);
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
return fail('unprovable-root', at);
|
|
236
|
+
}
|
|
237
|
+
if (occupancy.kind === 'occupying') {
|
|
238
|
+
const state = stateOf(path[start]);
|
|
239
|
+
if (state === undefined || leafKeyAt(state, leafIndex) !== occupancy.leafKey)
|
|
240
|
+
return { occupancy: gap('unprovable-root'), provenance, at };
|
|
241
|
+
// An imported checkpoint is re-checked on every read, whichever way it entered the store (fail closed, I12).
|
|
242
|
+
if (onPath < 0 && provenance === 'snapshot' && !snapshotCheckpointHolds(record.anchor, occupancy.leafKey, window, path, start, stateOf)) {
|
|
243
|
+
return { occupancy: gap('restore'), provenance, at };
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
let endedAt;
|
|
247
|
+
for (let i = start + 1; i < path.length && occupancy.kind === 'occupying'; i++) {
|
|
248
|
+
const parentNode = path[i - 1];
|
|
249
|
+
const node = path[i];
|
|
250
|
+
occupancy = admissionStep(occupancy, { node, parentState: () => stateOf(parentNode), childState: () => stateOf(node) }, leafIndex);
|
|
251
|
+
if (occupancy.kind === 'ended')
|
|
252
|
+
endedAt = i;
|
|
253
|
+
}
|
|
254
|
+
if (occupancy.kind === 'occupying') {
|
|
255
|
+
const state = stateOf(end);
|
|
256
|
+
if (state === undefined || leafKeyAt(state, leafIndex) !== occupancy.leafKey)
|
|
257
|
+
return { occupancy: gap('unprovable-root'), provenance, at };
|
|
258
|
+
}
|
|
259
|
+
return { occupancy, provenance, at, ...(endedAt === undefined ? {} : { endedDepth: path.length - 1 - endedAt }) };
|
|
260
|
+
}
|
|
261
|
+
// ---------------------------------------------------------------------------
|
|
262
|
+
// Checkpoint advance (I11)
|
|
263
|
+
// ---------------------------------------------------------------------------
|
|
264
|
+
/**
|
|
265
|
+
* One window holding every node of `windows`, tip `tipTag`. A node several windows hold keeps the version with a
|
|
266
|
+
* parent link (a window's root is stored without one) and with a snapshot when one has it.
|
|
267
|
+
*/
|
|
268
|
+
export function mergeWindows(tipTag, windows) {
|
|
269
|
+
const nodes = new Map();
|
|
270
|
+
for (const window of windows) {
|
|
271
|
+
for (const node of window.nodes.values()) {
|
|
272
|
+
const held = nodes.get(node.tag);
|
|
273
|
+
if (held === undefined) {
|
|
274
|
+
nodes.set(node.tag, node);
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
const linked = held.parentTag === undefined && node.parentTag !== undefined ? node : held;
|
|
278
|
+
const other = linked === held ? node : held;
|
|
279
|
+
nodes.set(node.tag, linked.snapshot === undefined && other.snapshot !== undefined && node.tag !== tipTag ? { ...linked, snapshot: other.snapshot } : linked);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (!nodes.has(tipTag))
|
|
283
|
+
throw new Error('mergeWindows: the tip is in none of the windows');
|
|
284
|
+
// The tip carries no snapshot (its state is the stored clientState), as in every window.
|
|
285
|
+
const tip = nodes.get(tipTag);
|
|
286
|
+
if (tip.snapshot !== undefined) {
|
|
287
|
+
const { snapshot: _state, ...bare } = tip;
|
|
288
|
+
nodes.set(tipTag, bare);
|
|
289
|
+
}
|
|
290
|
+
return { tipTag, nodes };
|
|
291
|
+
}
|
|
292
|
+
/** The root of `window`'s selected path. */
|
|
293
|
+
export function windowRootOf(window) {
|
|
294
|
+
return canonicalPath(window)[0];
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* I11: `record` with its checkpoint moved to the root of `after` (the window a transition persists, whose tip state is
|
|
298
|
+
* `afterTip`), or `undefined` when it needs no move. A move is needed only when `after` alone no longer proves what
|
|
299
|
+
* the record proved — neither its Add nor its checkpoint is left on `after`'s path, and `after`'s root is not already
|
|
300
|
+
* the checkpoint. The occupancy at the new root is derived over every node the transition saw (`before`, the window
|
|
301
|
+
* it diffed against, and `after`), starting where the record's proof starts. What cannot be bridged becomes a `gap`
|
|
302
|
+
* checkpoint at the new root: `switch` when the new path shares no node with `before` (a branch switch), else
|
|
303
|
+
* `unprovable-root`. A checkpoint derived from a snapshot-supplied checkpoint keeps `snapshot` provenance.
|
|
304
|
+
*/
|
|
305
|
+
export function advanceLineage(record, windows, afterTip) {
|
|
306
|
+
return advanceWith(record, transitionContext(windows, afterTip));
|
|
307
|
+
}
|
|
308
|
+
function transitionContext(windows, afterTip) {
|
|
309
|
+
const path = canonicalPath(windows.after);
|
|
310
|
+
let merged;
|
|
311
|
+
return {
|
|
312
|
+
before: windows.before,
|
|
313
|
+
after: windows.after,
|
|
314
|
+
root: path[0],
|
|
315
|
+
afterPath: new Set(path.map((n) => n.tag)),
|
|
316
|
+
afterTip,
|
|
317
|
+
merged() {
|
|
318
|
+
if (merged === undefined) {
|
|
319
|
+
const window = mergeWindows(windows.after.tipTag, [windows.after, ...(windows.diff === undefined ? [] : [windows.diff]), windows.before]);
|
|
320
|
+
merged = { window, stateOf: stateResolver(window, afterTip) };
|
|
321
|
+
}
|
|
322
|
+
return merged;
|
|
323
|
+
},
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
function advanceWith(record, ctx) {
|
|
327
|
+
const root = ctx.root;
|
|
328
|
+
if (root === undefined)
|
|
329
|
+
return undefined;
|
|
330
|
+
const checkpoint = record.checkpoint;
|
|
331
|
+
if (checkpoint?.at.tag === root.tag && checkpoint.at.epoch === root.epoch)
|
|
332
|
+
return undefined;
|
|
333
|
+
// Still provable from `after` alone: its proof starts on `after`'s path (or it reads add-off-path there).
|
|
334
|
+
if (ctx.afterPath.has(record.anchor.addTag) || (checkpoint !== undefined && ctx.afterPath.has(checkpoint.at.tag)))
|
|
335
|
+
return undefined;
|
|
336
|
+
if (deriveWith(record, ctx.after, stateResolver(ctx.after, ctx.afterTip)).occupancy.kind !== 'gap')
|
|
337
|
+
return undefined;
|
|
338
|
+
const merged = ctx.merged();
|
|
339
|
+
const atRoot = deriveWith(record, merged.window, merged.stateOf, root.tag);
|
|
340
|
+
let occupancy = atRoot.occupancy;
|
|
341
|
+
if (occupancy.kind === 'gap' && occupancy.reason === 'unprovable-root') {
|
|
342
|
+
const shared = [...ctx.afterPath].some((tag) => ctx.before.nodes.has(tag));
|
|
343
|
+
if (!shared)
|
|
344
|
+
occupancy = gap('switch');
|
|
345
|
+
}
|
|
346
|
+
// A gap already recorded at an older node stays the reason it was (a restore stays a restore).
|
|
347
|
+
let provenance = atRoot.provenance;
|
|
348
|
+
if (occupancy.kind === 'gap' && checkpoint?.occupancy.kind === 'gap') {
|
|
349
|
+
occupancy = checkpoint.occupancy;
|
|
350
|
+
provenance = checkpoint.provenance;
|
|
351
|
+
}
|
|
352
|
+
return { ...record, checkpoint: { at: { tag: root.tag, epoch: root.epoch }, occupancy, provenance } };
|
|
353
|
+
}
|
|
354
|
+
// ---------------------------------------------------------------------------
|
|
355
|
+
// Restore validation
|
|
356
|
+
// ---------------------------------------------------------------------------
|
|
357
|
+
/**
|
|
358
|
+
* Whether an imported `occupying` checkpoint (claimed key `leafKey`) at `path[at]` is consistent with `window`: the
|
|
359
|
+
* anchored Add is nowhere in the window (an Add the window holds proves or refutes the admission itself), the node's
|
|
360
|
+
* state holds `leafKey` at the anchor's position, and {@link admissionStep} carries the position's occupant at the
|
|
361
|
+
* window's root, link by link, to that node — still occupying, under `leafKey`. A Remove of the position before the
|
|
362
|
+
* node (the anchored admission began before the root, so whatever follows is a re-admission) or a link that proves
|
|
363
|
+
* nothing refutes the checkpoint.
|
|
364
|
+
*/
|
|
365
|
+
function snapshotCheckpointHolds(anchor, leafKey, window, path, at, stateOf) {
|
|
366
|
+
if (window.nodes.has(anchor.addTag))
|
|
367
|
+
return false;
|
|
368
|
+
const node = path[at];
|
|
369
|
+
const nodeState = node === undefined ? undefined : stateOf(node);
|
|
370
|
+
if (nodeState === undefined || leafKeyAt(nodeState, anchor.leafIndex) !== leafKey)
|
|
371
|
+
return false;
|
|
372
|
+
const rootState = stateOf(path[0]);
|
|
373
|
+
const rootKey = rootState === undefined ? undefined : leafKeyAt(rootState, anchor.leafIndex);
|
|
374
|
+
if (rootKey === undefined)
|
|
375
|
+
return false;
|
|
376
|
+
let occupancy = { kind: 'occupying', leafKey: rootKey };
|
|
377
|
+
for (let i = 1; i <= at && occupancy.kind === 'occupying'; i++) {
|
|
378
|
+
const parentNode = path[i - 1];
|
|
379
|
+
const child = path[i];
|
|
380
|
+
occupancy = admissionStep(occupancy, { node: child, parentState: () => stateOf(parentNode), childState: () => stateOf(child) }, anchor.leafIndex);
|
|
381
|
+
}
|
|
382
|
+
return occupancy.kind === 'occupying' && occupancy.leafKey === leafKey;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* The lineage a restore adopts from a snapshot's `records`, validated against the snapshot's own selected path
|
|
386
|
+
* (`window`, tip state `tipState`). A record whose Add is on that path is kept (the window proves it). A record whose
|
|
387
|
+
* checkpoint names a node of that path at its epoch is kept with `snapshot` provenance when the window cannot refute
|
|
388
|
+
* it — for an `occupying` checkpoint: the Add is nowhere in the window, and the position's occupant is carried from
|
|
389
|
+
* the window's root to that node, without a Remove or an unprovable link, under the claimed key
|
|
390
|
+
* ({@link snapshotCheckpointHolds}). Every other record gets a `gap` (`restore`) checkpoint at the window's root:
|
|
391
|
+
* insufficient evidence until a transition re-proves it from the Add. A record of a duplicate key keeps its first
|
|
392
|
+
* occurrence.
|
|
393
|
+
*/
|
|
394
|
+
export function validateRestoredLineage(records, window, tipState) {
|
|
395
|
+
const path = canonicalPath(window);
|
|
396
|
+
const root = path[0];
|
|
397
|
+
const stateOf = stateResolver(window, tipState);
|
|
398
|
+
const out = [];
|
|
399
|
+
const seen = new Set();
|
|
400
|
+
for (const record of records) {
|
|
401
|
+
const key = lineageKey(record.anchor);
|
|
402
|
+
if (seen.has(key))
|
|
403
|
+
continue;
|
|
404
|
+
seen.add(key);
|
|
405
|
+
const asSnapshot = (checkpoint) => ({ ...checkpoint, provenance: 'snapshot' });
|
|
406
|
+
if (path.some((n) => n.tag === record.anchor.addTag)) {
|
|
407
|
+
out.push(record.checkpoint === undefined ? record : { ...record, checkpoint: asSnapshot(record.checkpoint) });
|
|
408
|
+
continue;
|
|
409
|
+
}
|
|
410
|
+
const checkpoint = record.checkpoint;
|
|
411
|
+
const at = checkpoint === undefined ? -1 : path.findIndex((n) => n.tag === checkpoint.at.tag && n.epoch === checkpoint.at.epoch);
|
|
412
|
+
let valid = checkpoint !== undefined && at >= 0;
|
|
413
|
+
if (valid && checkpoint.occupancy.kind === 'occupying') {
|
|
414
|
+
valid = snapshotCheckpointHolds(record.anchor, checkpoint.occupancy.leafKey, window, path, at, stateOf);
|
|
415
|
+
}
|
|
416
|
+
if (valid) {
|
|
417
|
+
out.push({ ...record, checkpoint: asSnapshot(checkpoint) });
|
|
418
|
+
}
|
|
419
|
+
else if (root !== undefined) {
|
|
420
|
+
out.push({ ...record, checkpoint: { at: { tag: root.tag, epoch: root.epoch }, occupancy: gap('restore'), provenance: 'snapshot' } });
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return out;
|
|
424
|
+
}
|
|
425
|
+
// ---------------------------------------------------------------------------
|
|
426
|
+
// Codec (strict; absent optional fields accepted)
|
|
427
|
+
// ---------------------------------------------------------------------------
|
|
428
|
+
function isObject(value) {
|
|
429
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value) && !(value instanceof Uint8Array);
|
|
430
|
+
}
|
|
431
|
+
function malformed(where, detail) {
|
|
432
|
+
return new MarmotError('store-failed', `${where}: malformed admission lineage (${detail})`, { details: { where, malformed: true } });
|
|
433
|
+
}
|
|
434
|
+
const isIndex = (value) => typeof value === 'number' && Number.isSafeInteger(value) && value >= 0;
|
|
435
|
+
const isText = (value) => typeof value === 'string' && value.length > 0;
|
|
436
|
+
const GAP_REASONS = new Set(['unprovable-root', 'undecodable-commit', 'restore', 'switch']);
|
|
437
|
+
const ENDED_BY = new Set(['inline-remove', 'replaced', 'by-reference']);
|
|
438
|
+
function decodeOccupancy(where, raw) {
|
|
439
|
+
if (!isObject(raw))
|
|
440
|
+
throw malformed(where, 'occupancy');
|
|
441
|
+
switch (raw['kind']) {
|
|
442
|
+
case 'occupying':
|
|
443
|
+
if (!isText(raw['leafKey']))
|
|
444
|
+
throw malformed(where, 'occupying leafKey');
|
|
445
|
+
return { kind: 'occupying', leafKey: raw['leafKey'] };
|
|
446
|
+
case 'ended':
|
|
447
|
+
if (!isText(raw['digest']) || typeof raw['by'] !== 'string' || !ENDED_BY.has(raw['by']) || typeof raw['committerOwn'] !== 'boolean')
|
|
448
|
+
throw malformed(where, 'ended');
|
|
449
|
+
return { kind: 'ended', digest: raw['digest'], by: raw['by'], committerOwn: raw['committerOwn'] };
|
|
450
|
+
case 'add-off-path':
|
|
451
|
+
return { kind: 'add-off-path' };
|
|
452
|
+
case 'gap':
|
|
453
|
+
if (typeof raw['reason'] !== 'string' || !GAP_REASONS.has(raw['reason']))
|
|
454
|
+
throw malformed(where, 'gap reason');
|
|
455
|
+
return { kind: 'gap', reason: raw['reason'] };
|
|
456
|
+
default:
|
|
457
|
+
throw malformed(where, 'occupancy kind');
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
function decodeAnchor(where, raw) {
|
|
461
|
+
if (!isObject(raw))
|
|
462
|
+
throw malformed(where, 'anchor');
|
|
463
|
+
const { addDigest, addTag, commitEventId, leafIndex, leafKey } = raw;
|
|
464
|
+
if (!isText(addDigest) || !isText(addTag) || typeof commitEventId !== 'string' || !isIndex(leafIndex) || !isText(leafKey))
|
|
465
|
+
throw malformed(where, 'anchor fields');
|
|
466
|
+
return { addDigest, addTag, commitEventId, leafIndex, leafKey };
|
|
467
|
+
}
|
|
468
|
+
/** Decodes one stored (or snapshot-carried) record strictly: anything else throws a malformed-row error. */
|
|
469
|
+
export function decodeLineageRecord(where, raw) {
|
|
470
|
+
if (!isObject(raw) || raw['v'] !== 1)
|
|
471
|
+
throw malformed(where, 'record');
|
|
472
|
+
const anchor = decodeAnchor(where, raw['anchor']);
|
|
473
|
+
const ids = raw['candidateIds'];
|
|
474
|
+
if (!Array.isArray(ids) || !ids.every(isText))
|
|
475
|
+
throw malformed(where, 'candidateIds');
|
|
476
|
+
const rawCheckpoint = raw['checkpoint'];
|
|
477
|
+
if (rawCheckpoint === undefined)
|
|
478
|
+
return { v: 1, anchor, candidateIds: [...ids] };
|
|
479
|
+
if (!isObject(rawCheckpoint) || !isObject(rawCheckpoint['at']))
|
|
480
|
+
throw malformed(where, 'checkpoint');
|
|
481
|
+
const at = rawCheckpoint['at'];
|
|
482
|
+
const provenance = rawCheckpoint['provenance'];
|
|
483
|
+
if (!isText(at['tag']) || !isIndex(at['epoch']) || (provenance !== 'transition' && provenance !== 'snapshot'))
|
|
484
|
+
throw malformed(where, 'checkpoint fields');
|
|
485
|
+
return { v: 1, anchor, candidateIds: [...ids], checkpoint: { at: { tag: at['tag'], epoch: at['epoch'] }, occupancy: decodeOccupancy(where, rawCheckpoint['occupancy']), provenance } };
|
|
486
|
+
}
|
|
487
|
+
function encodeOccupancy(occupancy) {
|
|
488
|
+
switch (occupancy.kind) {
|
|
489
|
+
case 'occupying':
|
|
490
|
+
return { kind: 'occupying', leafKey: occupancy.leafKey };
|
|
491
|
+
case 'ended':
|
|
492
|
+
return { kind: 'ended', digest: occupancy.digest, by: occupancy.by, committerOwn: occupancy.committerOwn };
|
|
493
|
+
case 'add-off-path':
|
|
494
|
+
return { kind: 'add-off-path' };
|
|
495
|
+
case 'gap':
|
|
496
|
+
return { kind: 'gap', reason: occupancy.reason };
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
export function encodeLineageRecord(record) {
|
|
500
|
+
const { anchor, checkpoint } = record;
|
|
501
|
+
return {
|
|
502
|
+
v: 1,
|
|
503
|
+
anchor: { addDigest: anchor.addDigest, addTag: anchor.addTag, commitEventId: anchor.commitEventId, leafIndex: anchor.leafIndex, leafKey: anchor.leafKey },
|
|
504
|
+
candidateIds: [...record.candidateIds],
|
|
505
|
+
...(checkpoint === undefined
|
|
506
|
+
? {}
|
|
507
|
+
: { checkpoint: { at: { tag: checkpoint.at.tag, epoch: checkpoint.at.epoch }, occupancy: encodeOccupancy(checkpoint.occupancy), provenance: checkpoint.provenance } }),
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
// ---------------------------------------------------------------------------
|
|
511
|
+
// Shells over the group extension (inside the caller's transaction)
|
|
512
|
+
// ---------------------------------------------------------------------------
|
|
513
|
+
/**
|
|
514
|
+
* Every decodable record of the extension view. A row that does not open or decode is skipped — no record is no
|
|
515
|
+
* evidence, so the admission it described reads as a gap (fail closed); any other read error propagates.
|
|
516
|
+
*/
|
|
517
|
+
export async function readLineageRecords(view) {
|
|
518
|
+
const out = [];
|
|
519
|
+
for (const key of await view.keys()) {
|
|
520
|
+
const record = await readLineageRecord(view, key);
|
|
521
|
+
if (record !== undefined)
|
|
522
|
+
out.push(record);
|
|
523
|
+
}
|
|
524
|
+
return out;
|
|
525
|
+
}
|
|
526
|
+
/** The record at `key`, `undefined` when absent or malformed (envelope or payload); other read errors propagate. */
|
|
527
|
+
export async function readLineageRecord(view, key) {
|
|
528
|
+
let raw;
|
|
529
|
+
try {
|
|
530
|
+
raw = await view.get(key);
|
|
531
|
+
}
|
|
532
|
+
catch (error) {
|
|
533
|
+
if (isMalformedRowError(error))
|
|
534
|
+
return undefined;
|
|
535
|
+
throw error;
|
|
536
|
+
}
|
|
537
|
+
if (raw === undefined)
|
|
538
|
+
return undefined;
|
|
539
|
+
try {
|
|
540
|
+
const record = decodeLineageRecord(`${ADMISSION_LINEAGE_EXTENSION}/${key}`, raw);
|
|
541
|
+
return lineageKey(record.anchor) === key ? record : undefined;
|
|
542
|
+
}
|
|
543
|
+
catch (error) {
|
|
544
|
+
if (isMalformedRowError(error))
|
|
545
|
+
return undefined;
|
|
546
|
+
throw error;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
export async function writeLineageRecord(view, record) {
|
|
550
|
+
await view.put(lineageKey(record.anchor), encodeLineageRecord(record));
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Seeds the lineage of the anchors an own Add commit confirmed (in the confirmation's group transaction):
|
|
554
|
+
* `anchors` maps each anchor to the candidates it admitted; `addEpoch` is the epoch of the Add's state.
|
|
555
|
+
* Idempotent: a re-run confirmation only merges candidates into a stored record and never moves its checkpoint.
|
|
556
|
+
*/
|
|
557
|
+
export async function seedLineageRecords(view, anchors, addEpoch) {
|
|
558
|
+
for (const { anchor, candidateIds } of anchors.values()) {
|
|
559
|
+
const key = lineageKey(anchor);
|
|
560
|
+
const next = mergeSeed(await readLineageRecord(view, key), seedLineage(anchor, candidateIds, addEpoch));
|
|
561
|
+
if (next !== undefined)
|
|
562
|
+
await view.put(key, encodeLineageRecord(next));
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* I11, the shell: moves every stored record's checkpoint the transition needs moved ({@link advanceLineage}), in the
|
|
567
|
+
* transition's own transaction. Records that need no move are not rewritten.
|
|
568
|
+
*/
|
|
569
|
+
export async function advanceLineageRecords(view, windows, afterTip) {
|
|
570
|
+
const keys = await view.keys();
|
|
571
|
+
if (keys.length === 0)
|
|
572
|
+
return;
|
|
573
|
+
const ctx = transitionContext(windows, afterTip);
|
|
574
|
+
for (const key of keys) {
|
|
575
|
+
const record = await readLineageRecord(view, key);
|
|
576
|
+
if (record === undefined)
|
|
577
|
+
continue;
|
|
578
|
+
const next = advanceWith(record, ctx);
|
|
579
|
+
if (next !== undefined)
|
|
580
|
+
await view.put(key, encodeLineageRecord(next));
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
/** Replaces the extension's records with `records` (a restore's adoption, inside its transaction). */
|
|
584
|
+
export async function replaceLineageRecords(view, records) {
|
|
585
|
+
for (const key of await view.keys())
|
|
586
|
+
await view.delete(key);
|
|
587
|
+
for (const record of records)
|
|
588
|
+
await writeLineageRecord(view, record);
|
|
589
|
+
}
|
|
@@ -10,12 +10,48 @@ export declare function isFencingError(error: unknown): error is Error;
|
|
|
10
10
|
/** The first fencing error among `errors`, if any. */
|
|
11
11
|
export declare function fencingErrorIn(errors: readonly unknown[] | undefined): Error | undefined;
|
|
12
12
|
export declare function fencedError(groupId: string, operation: string, cause: unknown): MarmotError;
|
|
13
|
+
/**
|
|
14
|
+
* The coarse cause of a fence (epic marmot-invitation-outcomes, SC-10): `lost-path-secrets` for the AC-HIST-4 replay
|
|
15
|
+
* failure, `invalid-stored-evidence` for stored evidence that cannot be trusted (a malformed present marker, a corrupt
|
|
16
|
+
* held-candidate record), `unknown` for a legacy marker written before the cause was recorded.
|
|
17
|
+
*/
|
|
18
|
+
export type FenceCause = 'lost-path-secrets' | 'invalid-stored-evidence' | 'unknown';
|
|
13
19
|
export interface FenceRecord {
|
|
14
20
|
readonly at: number;
|
|
15
21
|
readonly epoch: string;
|
|
16
22
|
readonly message: string;
|
|
23
|
+
/** Additive (v:1): absent on a marker written before causes were recorded — it reads `unknown`. */
|
|
24
|
+
readonly cause?: FenceCause;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Stored fence evidence that cannot be trusted: a present but malformed fence marker, or a held-candidate record the
|
|
28
|
+
* engine refuses (client/opaque-candidates.ts `OpaqueRecordCorrupt` extends it). The group fails closed: it is
|
|
29
|
+
* fenced with cause `invalid-stored-evidence`.
|
|
30
|
+
*/
|
|
31
|
+
export declare class InvalidStoredEvidenceError extends Error {
|
|
32
|
+
readonly name: string;
|
|
17
33
|
}
|
|
18
34
|
export declare function writeFence(view: KeyValueView, record: FenceRecord): Promise<void>;
|
|
35
|
+
/** What {@link loadFenceMarker} found under the marker key. */
|
|
36
|
+
export type FenceMarker = {
|
|
37
|
+
readonly kind: 'absent';
|
|
38
|
+
} | {
|
|
39
|
+
readonly kind: 'valid';
|
|
40
|
+
readonly record: FenceRecord;
|
|
41
|
+
} | {
|
|
42
|
+
readonly kind: 'malformed';
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The fence marker as a load must judge it (fail closed): `absent` when no marker is stored, `valid` for a
|
|
46
|
+
* well-formed one (its `cause` kept when it is a known cause), `malformed` for anything else that is present —
|
|
47
|
+
* including a stored payload that does not decode. A malformed marker is never read as no fence. Any other read failure (an incompatible store, a failing backend) is thrown.
|
|
48
|
+
*/
|
|
49
|
+
export declare function loadFenceMarker(view: KeyValueView): Promise<FenceMarker>;
|
|
50
|
+
/**
|
|
51
|
+
* Compatibility/test reader: the legacy fields (`at`, `epoch`, `message` — no `cause`) of a {@link loadFenceMarker |
|
|
52
|
+
* valid} marker, else `undefined`. `undefined` does not mean "no marker": a malformed one also reads `undefined` here,
|
|
53
|
+
* while a load fails closed on it. Code that decides whether a group is fenced uses {@link loadFenceMarker}.
|
|
54
|
+
*/
|
|
19
55
|
export declare function readFence(view: KeyValueView): Promise<FenceRecord | undefined>;
|
|
20
56
|
/**
|
|
21
57
|
* The cause a reloaded fence carries: the ts-mls `InternalError` object does
|
|
@@ -23,3 +59,8 @@ export declare function readFence(view: KeyValueView): Promise<FenceRecord | und
|
|
|
23
59
|
* with the recorded message (not an `instanceof InternalError`).
|
|
24
60
|
*/
|
|
25
61
|
export declare function recordedFencingError(record: FenceRecord): Error;
|
|
62
|
+
/**
|
|
63
|
+
* The coarse cause of the fence `error` stands for: a reloaded marker's recorded cause, `invalid-stored-evidence` for
|
|
64
|
+
* {@link InvalidStoredEvidenceError}, `lost-path-secrets` for the ts-mls replay failure, else `unknown`.
|
|
65
|
+
*/
|
|
66
|
+
export declare function fenceCauseOf(error: unknown): FenceCause;
|