@serfab/cadre-core 1.16.0 → 1.18.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/README.md +4 -3
- package/dist/bootstrap-peer-store-file.js +1 -1
- package/dist/bootstrap-peer-store.d.ts +1 -1
- package/dist/bootstrap-peer-store.js +4 -4
- package/dist/cadre-invite-protocol.d.ts +81 -142
- package/dist/cadre-invite-protocol.js +168 -458
- package/dist/cadre-invite-protocol.js.map +1 -1
- package/dist/cadre-join-request.d.ts +15 -2
- package/dist/cadre-join-request.js +22 -3
- package/dist/cadre-join-request.js.map +1 -1
- package/dist/cadre-node.d.ts +1089 -475
- package/dist/cadre-node.js +2170 -1037
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-authorization.d.ts +36 -14
- package/dist/control-authorization.js +20 -3
- package/dist/control-authorization.js.map +1 -1
- package/dist/control-cohort.d.ts +88 -32
- package/dist/control-cohort.js +91 -33
- package/dist/control-cohort.js.map +1 -1
- package/dist/control-database.d.ts +856 -318
- package/dist/control-database.js +1422 -701
- package/dist/control-database.js.map +1 -1
- package/dist/control-formation-recorder.d.ts +46 -43
- package/dist/control-formation-recorder.js +77 -78
- package/dist/control-formation-recorder.js.map +1 -1
- package/dist/control-protocol-guard.d.ts +11 -4
- package/dist/control-protocol-guard.js +20 -5
- package/dist/control-protocol-guard.js.map +1 -1
- package/dist/control-schema-version.d.ts +97 -0
- package/dist/control-schema-version.js +225 -0
- package/dist/control-schema-version.js.map +1 -0
- package/dist/control-schema.d.ts +45 -5
- package/dist/control-schema.js +262 -78
- package/dist/control-schema.js.map +1 -1
- package/dist/control-write-retry.d.ts +45 -10
- package/dist/control-write-retry.js +92 -22
- package/dist/control-write-retry.js.map +1 -1
- package/dist/delegate-admission.d.ts +13 -0
- package/dist/delegate-admission.js +27 -0
- package/dist/delegate-admission.js.map +1 -1
- package/dist/ed25519-key.d.ts +10 -7
- package/dist/ed25519-key.js +23 -20
- package/dist/ed25519-key.js.map +1 -1
- package/dist/edge-node/config.d.ts +122 -0
- package/dist/edge-node/config.js +199 -0
- package/dist/edge-node/config.js.map +1 -0
- package/dist/edge-node/dissolve.d.ts +95 -0
- package/dist/edge-node/dissolve.js +184 -0
- package/dist/edge-node/dissolve.js.map +1 -0
- package/dist/edge-node/edge-join.d.ts +44 -0
- package/dist/edge-node/edge-join.js +227 -0
- package/dist/edge-node/edge-join.js.map +1 -0
- package/dist/edge-node/edge-node.d.ts +295 -0
- package/dist/edge-node/edge-node.js +704 -0
- package/dist/edge-node/edge-node.js.map +1 -0
- package/dist/edge-node/index.d.ts +18 -0
- package/dist/edge-node/index.js +18 -0
- package/dist/edge-node/index.js.map +1 -0
- package/dist/edge-node/join-credential.d.ts +11 -0
- package/dist/edge-node/join-credential.js +11 -0
- package/dist/edge-node/join-credential.js.map +1 -0
- package/dist/edge-node/lazy-raw-storage.d.ts +40 -0
- package/dist/edge-node/lazy-raw-storage.js +134 -0
- package/dist/edge-node/lazy-raw-storage.js.map +1 -0
- package/dist/edge-node/node-local.d.ts +60 -0
- package/dist/edge-node/node-local.js +58 -0
- package/dist/edge-node/node-local.js.map +1 -0
- package/dist/edge-node/options.d.ts +83 -0
- package/dist/edge-node/options.js +110 -0
- package/dist/edge-node/options.js.map +1 -0
- package/dist/edge-node/owner-grant.d.ts +41 -0
- package/dist/edge-node/owner-grant.js +38 -0
- package/dist/edge-node/owner-grant.js.map +1 -0
- package/dist/edge-node/platform.d.ts +140 -0
- package/dist/edge-node/platform.js +12 -0
- package/dist/edge-node/platform.js.map +1 -0
- package/dist/edge-node/strand-move.d.ts +115 -0
- package/dist/edge-node/strand-move.js +223 -0
- package/dist/edge-node/strand-move.js.map +1 -0
- package/dist/edge-node/strands.d.ts +28 -0
- package/dist/edge-node/strands.js +60 -0
- package/dist/edge-node/strands.js.map +1 -0
- package/dist/enrolled-machine-store.d.ts +3 -3
- package/dist/enrolled-machine-store.js +3 -3
- package/dist/formation-token.d.ts +48 -0
- package/dist/formation-token.js +26 -0
- package/dist/formation-token.js.map +1 -0
- package/dist/index.d.ts +27 -17
- package/dist/index.js +39 -17
- package/dist/index.js.map +1 -1
- package/dist/joined-strand-store.d.ts +29 -12
- package/dist/joined-strand-store.js +66 -27
- package/dist/joined-strand-store.js.map +1 -1
- package/dist/key-store.d.ts +9 -4
- package/dist/key-store.js +9 -4
- package/dist/key-store.js.map +1 -1
- package/dist/link-budget.d.ts +9 -7
- package/dist/link-budget.js +9 -7
- package/dist/link-budget.js.map +1 -1
- package/dist/machine-removal.d.ts +19 -39
- package/dist/machine-removal.js +24 -98
- package/dist/machine-removal.js.map +1 -1
- package/dist/member-redemption.d.ts +256 -0
- package/dist/member-redemption.js +490 -0
- package/dist/member-redemption.js.map +1 -0
- package/dist/membership-view.d.ts +91 -0
- package/dist/membership-view.js +110 -0
- package/dist/membership-view.js.map +1 -0
- package/dist/owner-anchor-sync.d.ts +4 -4
- package/dist/owner-anchor-sync.js +16 -15
- package/dist/owner-anchor-sync.js.map +1 -1
- package/dist/owner-grant-protocol.d.ts +251 -0
- package/dist/owner-grant-protocol.js +344 -0
- package/dist/owner-grant-protocol.js.map +1 -0
- package/dist/owner-key-export.d.ts +70 -0
- package/dist/owner-key-export.js +279 -0
- package/dist/owner-key-export.js.map +1 -0
- package/dist/owner-key-flows.d.ts +55 -0
- package/dist/owner-key-flows.js +60 -0
- package/dist/owner-key-flows.js.map +1 -0
- package/dist/owner-key-store.d.ts +31 -0
- package/dist/owner-key-store.js +81 -0
- package/dist/owner-key-store.js.map +1 -0
- package/dist/owner-keys.d.ts +78 -0
- package/dist/owner-keys.js +133 -0
- package/dist/owner-keys.js.map +1 -0
- package/dist/owner-signer.d.ts +54 -0
- package/dist/owner-signer.js +51 -0
- package/dist/owner-signer.js.map +1 -0
- package/dist/peer-addr-book.d.ts +10 -1
- package/dist/peer-addr-book.js +4 -3
- package/dist/peer-addr-book.js.map +1 -1
- package/dist/peer-authorization.d.ts +83 -18
- package/dist/peer-authorization.js +123 -53
- package/dist/peer-authorization.js.map +1 -1
- package/dist/peer-join-backfill.d.ts +89 -20
- package/dist/peer-join-backfill.js +265 -108
- package/dist/peer-join-backfill.js.map +1 -1
- package/dist/pending-join-runner.d.ts +48 -18
- package/dist/pending-join-runner.js +74 -56
- package/dist/pending-join-runner.js.map +1 -1
- package/dist/provider/rent-node.js +1 -1
- package/dist/provider/rent-node.js.map +1 -1
- package/dist/seed-bootstrap.d.ts +162 -133
- package/dist/seed-bootstrap.js +300 -283
- package/dist/seed-bootstrap.js.map +1 -1
- package/dist/seed-trust-policy.js +4 -4
- package/dist/strand-addr-protocol.d.ts +4 -1
- package/dist/strand-addr-protocol.js +8 -2
- package/dist/strand-addr-protocol.js.map +1 -1
- package/dist/strand-cohort.d.ts +3 -0
- package/dist/strand-cohort.js.map +1 -1
- package/dist/strand-database.d.ts +24 -2
- package/dist/strand-database.js +29 -6
- package/dist/strand-database.js.map +1 -1
- package/dist/strand-first-sync-gate.d.ts +176 -88
- package/dist/strand-first-sync-gate.js +288 -121
- package/dist/strand-first-sync-gate.js.map +1 -1
- package/dist/strand-formation-deadlines.d.ts +9 -9
- package/dist/strand-formation-deadlines.js +9 -9
- package/dist/strand-formation-manager.d.ts +23 -17
- package/dist/strand-formation-manager.js +46 -44
- package/dist/strand-formation-manager.js.map +1 -1
- package/dist/strand-formation-protocol.d.ts +5 -8
- package/dist/strand-formation-protocol.js +101 -16
- package/dist/strand-formation-protocol.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +27 -18
- package/dist/strand-instance-manager.js +119 -50
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-membership-reconciler.d.ts +16 -13
- package/dist/strand-membership-reconciler.js +30 -22
- package/dist/strand-membership-reconciler.js.map +1 -1
- package/dist/strand-membership-writer.d.ts +45 -22
- package/dist/strand-membership-writer.js +226 -131
- package/dist/strand-membership-writer.js.map +1 -1
- package/dist/strand-move.d.ts +6 -5
- package/dist/strand-move.js +36 -32
- package/dist/strand-move.js.map +1 -1
- package/dist/strand-peer-redial.js +2 -3
- package/dist/strand-peer-redial.js.map +1 -1
- package/dist/strand-revocation-enforcer.d.ts +134 -60
- package/dist/strand-revocation-enforcer.js +144 -71
- package/dist/strand-revocation-enforcer.js.map +1 -1
- package/dist/strand-solicitation.d.ts +50 -39
- package/dist/strand-solicitation.js +10 -3
- package/dist/strand-solicitation.js.map +1 -1
- package/dist/strand-watcher.d.ts +80 -13
- package/dist/strand-watcher.js +152 -48
- package/dist/strand-watcher.js.map +1 -1
- package/dist/table-change-watch.d.ts +63 -0
- package/dist/table-change-watch.js +209 -0
- package/dist/table-change-watch.js.map +1 -0
- package/dist/timeout-scheduler.d.ts +4 -3
- package/dist/timeout-scheduler.js +4 -3
- package/dist/timeout-scheduler.js.map +1 -1
- package/dist/types.d.ts +374 -150
- package/dist/types.js +4 -4
- package/dist/types.js.map +1 -1
- package/package.json +17 -8
- package/src/bootstrap-peer-store-file.ts +44 -44
- package/src/bootstrap-peer-store.ts +214 -214
- package/src/cadre-invite-protocol.ts +740 -1052
- package/src/cadre-join-request.ts +24 -3
- package/src/cadre-node.ts +2402 -1079
- package/src/control-authorization.ts +47 -14
- package/src/control-cohort.ts +204 -128
- package/src/control-database.ts +1749 -820
- package/src/control-formation-recorder.ts +359 -353
- package/src/control-protocol-guard.ts +23 -6
- package/src/control-schema-version.ts +301 -0
- package/src/control-schema.ts +273 -78
- package/src/control-write-retry.ts +641 -567
- package/src/delegate-admission.ts +351 -314
- package/src/ed25519-key.ts +174 -171
- package/src/edge-node/config.ts +277 -0
- package/src/edge-node/dissolve.ts +251 -0
- package/src/edge-node/edge-join.ts +319 -0
- package/src/edge-node/edge-node.ts +1045 -0
- package/src/edge-node/index.ts +59 -0
- package/src/edge-node/join-credential.ts +16 -0
- package/src/edge-node/lazy-raw-storage.ts +178 -0
- package/src/edge-node/node-local.ts +84 -0
- package/src/edge-node/options.ts +179 -0
- package/src/edge-node/owner-grant.ts +63 -0
- package/src/edge-node/platform.ts +151 -0
- package/src/edge-node/strand-move.ts +270 -0
- package/src/edge-node/strands.ts +72 -0
- package/src/enrolled-machine-store.ts +3 -3
- package/src/formation-token.ts +63 -0
- package/src/index.ts +899 -789
- package/src/joined-strand-store.ts +73 -28
- package/src/key-store.ts +10 -4
- package/src/link-budget.ts +9 -7
- package/src/machine-removal.ts +26 -111
- package/src/member-redemption.ts +649 -0
- package/src/membership-view.ts +144 -0
- package/src/owner-anchor-sync.ts +19 -18
- package/src/owner-grant-protocol.ts +547 -0
- package/src/owner-key-export.ts +348 -0
- package/src/owner-key-flows.ts +109 -0
- package/src/owner-key-store.ts +85 -0
- package/src/owner-keys.ts +178 -0
- package/src/owner-signer.ts +94 -0
- package/src/peer-addr-book.ts +4 -3
- package/src/peer-authorization.ts +558 -488
- package/src/peer-join-backfill.ts +971 -761
- package/src/pending-join-runner.ts +76 -53
- package/src/provider/rent-node.ts +1 -1
- package/src/seed-bootstrap.ts +343 -349
- package/src/seed-trust-policy.ts +4 -4
- package/src/strand-addr-protocol.ts +547 -538
- package/src/strand-cohort.ts +4 -0
- package/src/strand-database.ts +352 -319
- package/src/strand-first-sync-gate.ts +334 -133
- package/src/strand-formation-deadlines.ts +227 -227
- package/src/strand-formation-manager.ts +731 -725
- package/src/strand-formation-protocol.ts +122 -24
- package/src/strand-instance-manager.ts +2092 -2026
- package/src/strand-membership-reconciler.ts +33 -25
- package/src/strand-membership-writer.ts +2093 -1974
- package/src/strand-move.ts +50 -38
- package/src/strand-peer-redial.ts +2 -3
- package/src/strand-revocation-enforcer.ts +740 -654
- package/src/strand-solicitation.ts +61 -34
- package/src/strand-watcher.ts +175 -56
- package/src/table-change-watch.ts +285 -0
- package/src/timeout-scheduler.ts +29 -28
- package/src/types.ts +391 -152
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strand helpers every edge app needs around a running node, from sereus-chat's bring-up.
|
|
3
|
+
*/
|
|
4
|
+
import { StrandAwaitingFirstSyncError } from '../strand-first-sync-gate.js';
|
|
5
|
+
/** Default patience for {@link attachStrandWhenWritable}: generous enough that running out means something is wrong. */
|
|
6
|
+
export const DEFAULT_STRAND_PATIENCE_MS = 240000;
|
|
7
|
+
/**
|
|
8
|
+
* `addStrand`, then keep waiting when the first sync outlasts its budget.
|
|
9
|
+
*
|
|
10
|
+
* `addStrand` rejects with `StrandAwaitingFirstSyncError` when the first sync has not finished,
|
|
11
|
+
* and leaves the strand launched and syncing: the timeout is a progress report, not an outcome.
|
|
12
|
+
* Measured on a link with a 1.8 s round trip, a first sync completed at about 150 s against a
|
|
13
|
+
* 120 s budget. So this waits for the strand to become writable, and rejects only when it has not
|
|
14
|
+
* within `patienceMs`.
|
|
15
|
+
*/
|
|
16
|
+
export async function attachStrandWhenWritable(node, config, options = {}) {
|
|
17
|
+
try {
|
|
18
|
+
return await node.addStrand(config);
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
if (!(err instanceof StrandAwaitingFirstSyncError))
|
|
22
|
+
throw err;
|
|
23
|
+
const patienceMs = options.patienceMs ?? DEFAULT_STRAND_PATIENCE_MS;
|
|
24
|
+
console.info(`[cadre-core/edge-node] first sync of ${config.strandRow.Id} still arriving; ` +
|
|
25
|
+
`waiting up to ${patienceMs / 1000} s for it to become writable`);
|
|
26
|
+
return await node.whenStrandWritable(config.strandRow.Id, { timeoutMs: patienceMs });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Optimystic's cluster coordinator reports a write that could not gather enough approvals this
|
|
31
|
+
* way. It is transient right after a node restarts alone: its cohort has not reconnected yet.
|
|
32
|
+
*
|
|
33
|
+
* NOTE: matched on the message because Optimystic throws a plain `Error` here. If it gains a typed
|
|
34
|
+
* error, match on that instead — a reworded message would silently stop the retries.
|
|
35
|
+
*/
|
|
36
|
+
const SUPER_MAJORITY_FAILURE = /Failed to get super-majority/i;
|
|
37
|
+
/**
|
|
38
|
+
* Run a write, retrying only on the transient super-majority failure the first writes after a lone
|
|
39
|
+
* restart hit (v1.9 release notes): `attempts` tries, `delayMs` apart. Any other error, and the
|
|
40
|
+
* last attempt's, propagates.
|
|
41
|
+
*/
|
|
42
|
+
export async function retryAfterRestart(write, options = {}) {
|
|
43
|
+
const attempts = options.attempts ?? 5;
|
|
44
|
+
const delayMs = options.delayMs ?? 3000;
|
|
45
|
+
for (let attempt = 1;; attempt++) {
|
|
46
|
+
try {
|
|
47
|
+
return await write();
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
if (!isTransientWriteFailure(err) || attempt >= attempts)
|
|
51
|
+
throw err;
|
|
52
|
+
console.info(`[cadre-core/edge-node] write attempt ${attempt} lacked a super-majority; retrying in ${delayMs} ms`);
|
|
53
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function isTransientWriteFailure(err) {
|
|
58
|
+
return SUPER_MAJORITY_FAILURE.test(err instanceof Error ? err.message : String(err));
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=strands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strands.js","sourceRoot":"","sources":["../../src/edge-node/strands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAI5E,wHAAwH;AACxH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAO,CAAC;AAElD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC7C,IAAe,EACf,MAAoB,EACpB,UAAmC,EAAE;IAErC,IAAI,CAAC;QACJ,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,CAAC,GAAG,YAAY,4BAA4B,CAAC;YAAE,MAAM,GAAG,CAAC;QAC9D,MAAM,UAAU,GAAG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AC;AACtF,CAAC"}
|
|
@@ -65,9 +65,9 @@ export declare class PersistentEnrolledMachineStore implements EnrolledMachineSt
|
|
|
65
65
|
* Record the count: visible via {@link count} synchronously, then persisted.
|
|
66
66
|
*
|
|
67
67
|
* Writes are SKIPPED when the slot already holds this number, because the sole
|
|
68
|
-
* caller runs on every committed membership write
|
|
69
|
-
*
|
|
70
|
-
* integer forever. The skip is keyed off {@link persisted} rather than
|
|
68
|
+
* caller runs on every membership refresh — each committed membership write, each
|
|
69
|
+
* replicated membership change, and each reconcile pass down to its backstop — so a
|
|
70
|
+
* party whose membership is stable would otherwise rewrite the same integer forever. The skip is keyed off {@link persisted} rather than
|
|
71
71
|
* {@link current}, so a write that FAILED is retried by the next refresh instead
|
|
72
72
|
* of being suppressed as "unchanged".
|
|
73
73
|
*/
|
|
@@ -123,9 +123,9 @@ export class PersistentEnrolledMachineStore {
|
|
|
123
123
|
* Record the count: visible via {@link count} synchronously, then persisted.
|
|
124
124
|
*
|
|
125
125
|
* Writes are SKIPPED when the slot already holds this number, because the sole
|
|
126
|
-
* caller runs on every committed membership write
|
|
127
|
-
*
|
|
128
|
-
* integer forever. The skip is keyed off {@link persisted} rather than
|
|
126
|
+
* caller runs on every membership refresh — each committed membership write, each
|
|
127
|
+
* replicated membership change, and each reconcile pass down to its backstop — so a
|
|
128
|
+
* party whose membership is stable would otherwise rewrite the same integer forever. The skip is keyed off {@link persisted} rather than
|
|
129
129
|
* {@link current}, so a write that FAILED is retried by the next refresh instead
|
|
130
130
|
* of being suppressed as "unchanged".
|
|
131
131
|
*/
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { FormationRejectionCode } from './strand-formation-rejection.js';
|
|
2
|
+
/** The `FormationInvite` columns a formation session acts on. */
|
|
3
|
+
export interface FormationInviteFacts {
|
|
4
|
+
sAppId: string;
|
|
5
|
+
/** Epoch ms of the stored `ExpiresAt`; null when the invitation never expires. */
|
|
6
|
+
expiresAtMs: number | null;
|
|
7
|
+
/** Null is unlimited. */
|
|
8
|
+
totalUses: number | null;
|
|
9
|
+
/** A bound invitation's host strand; null on the responder-provisions path. */
|
|
10
|
+
strandId: string | null;
|
|
11
|
+
/** The outside approval hook; null when no approval is required. */
|
|
12
|
+
validationUrl: string | null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* One formation token as read once at the start of a responder session. Every later step of
|
|
16
|
+
* the session takes this value instead of reading the invite again.
|
|
17
|
+
*/
|
|
18
|
+
export interface FormationTokenRead {
|
|
19
|
+
token: string;
|
|
20
|
+
/** Null: no invite row here (it may not have replicated to this machine yet). */
|
|
21
|
+
invite: FormationInviteFacts | null;
|
|
22
|
+
/** Uses recorded so far; counted only for a metered, unexpired invite, else null. */
|
|
23
|
+
usesRecorded: number | null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* What the responder's token check yields; an invalid token names which way it failed. The
|
|
27
|
+
* valid arm carries the session's {@link FormationTokenRead}, absent only when the manager has
|
|
28
|
+
* no recorder and so accepts every token with nothing read.
|
|
29
|
+
*/
|
|
30
|
+
export type FormationTokenCheck = {
|
|
31
|
+
valid: true;
|
|
32
|
+
read?: FormationTokenRead;
|
|
33
|
+
} | {
|
|
34
|
+
valid: false;
|
|
35
|
+
code: Extract<FormationRejectionCode, 'token-unknown' | 'token-spent'>;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* `expiresAtMs <= nowMs` is expired: the same boundary `hasOutstandingFormationInvite` applies,
|
|
39
|
+
* so an invite the formation handler refuses can never hold the connection gate open.
|
|
40
|
+
*/
|
|
41
|
+
export declare function isInviteExpired(invite: FormationInviteFacts, nowMs: number): boolean;
|
|
42
|
+
/** Used up: a metered invite whose recorded uses reached `totalUses`. An unknown token is not used up. */
|
|
43
|
+
export declare function isTokenReadSpent(read: FormationTokenRead): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* No invite row is `'token-unknown'` (retryable: the row may not have replicated to this
|
|
46
|
+
* machine yet); an expired or used-up invite is `'token-spent'` (final).
|
|
47
|
+
*/
|
|
48
|
+
export declare function classifyTokenRead(read: FormationTokenRead, nowMs: number): FormationTokenCheck;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `expiresAtMs <= nowMs` is expired: the same boundary `hasOutstandingFormationInvite` applies,
|
|
3
|
+
* so an invite the formation handler refuses can never hold the connection gate open.
|
|
4
|
+
*/
|
|
5
|
+
export function isInviteExpired(invite, nowMs) {
|
|
6
|
+
return invite.expiresAtMs !== null && invite.expiresAtMs <= nowMs;
|
|
7
|
+
}
|
|
8
|
+
/** Used up: a metered invite whose recorded uses reached `totalUses`. An unknown token is not used up. */
|
|
9
|
+
export function isTokenReadSpent(read) {
|
|
10
|
+
const totalUses = read.invite?.totalUses ?? null;
|
|
11
|
+
return totalUses !== null && read.usesRecorded !== null && read.usesRecorded >= totalUses;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* No invite row is `'token-unknown'` (retryable: the row may not have replicated to this
|
|
15
|
+
* machine yet); an expired or used-up invite is `'token-spent'` (final).
|
|
16
|
+
*/
|
|
17
|
+
export function classifyTokenRead(read, nowMs) {
|
|
18
|
+
if (read.invite === null) {
|
|
19
|
+
return { valid: false, code: 'token-unknown' };
|
|
20
|
+
}
|
|
21
|
+
if (isInviteExpired(read.invite, nowMs) || isTokenReadSpent(read)) {
|
|
22
|
+
return { valid: false, code: 'token-spent' };
|
|
23
|
+
}
|
|
24
|
+
return { valid: true, read };
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=formation-token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formation-token.js","sourceRoot":"","sources":["../src/formation-token.ts"],"names":[],"mappings":"AAoCA;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,MAA4B,EAAE,KAAa;IACzE,OAAO,MAAM,CAAC,WAAW,KAAK,IAAI,IAAI,MAAM,CAAC,WAAW,IAAI,KAAK,CAAC;AACpE,CAAC;AAED,0GAA0G;AAC1G,MAAM,UAAU,gBAAgB,CAAC,IAAwB;IACvD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,IAAI,IAAI,CAAC;IACjD,OAAO,SAAS,KAAK,IAAI,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI,IAAI,IAAI,CAAC,YAAY,IAAI,SAAS,CAAC;AAC5F,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAwB,EAAE,KAAa;IACvE,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;QACzB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;IACjD,CAAC;IACD,IAAI,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;QAClE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;IAC/C,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC/B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
2
|
export { canonicalJson } from './canonical-json.js';
|
|
3
|
-
export { CadreNode,
|
|
3
|
+
export { CadreNode, CADRE_INVITATION_DEFAULT_TTL_MS, OWNER_GRANT_DEFAULT_TTL_MS } from './cadre-node.js';
|
|
4
4
|
export { MachineRemovalRefusedError } from './machine-removal.js';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
5
|
+
export { OwnerKeyAddRefusedError, OwnerKeyRemovalRefusedError } from './owner-keys.js';
|
|
6
|
+
export { ControlDatabase, parseNullableStoredDatetimeMs, MissingHostStrandError, InvitationExhaustedError, CadreInviteIssuerUnknownError, OwnerGrantIssuerUnknownError, IssuedRowNotHereYetError, buildAuthorizationMessage, registerPartyIdFunction, formationVouchMessage, formationConsentMessage, cadreInviteAddMessage, cadreInviteRedeemMessage, cadreInviteConsentMessage, ownerGrantAddMessage, ownerGrantRedeemMessage, ownerGrantConsentMessage, projectSeedPeers, REAPABLE_TABLES, type ReapableTable, type ControlDatabaseConfig, type ControlTable, type RevocableTable, type FormationUsageResult, type FormationInviteRow, type FoundingRows, type FoundingInvite, type MembershipChangeListener, type GuardedDeleteListener, type ControlWriteAbandonedListener, type RevokedRowRef, type ControlSign, type SelfRecordSigner, type CadrePeerRetouchMode, type CadrePeerRetouchOutcome, type OwnerGrantRedemptionFields } from './control-database.js';
|
|
7
|
+
export { CONTROL_SCHEMA_VERSION, CONTROL_SCHEMA_BASELINE_VERSION, CONTROL_SCHEMA_VERSION_TAG } from './control-schema.js';
|
|
8
|
+
export { ControlStoreIncompatibleError, type ControlStoreIncompatibility } from './control-schema-version.js';
|
|
9
|
+
export { CONTROL_WRITE_ATTEMPTS, CONTROL_WRITE_RETRY_BUDGET_MS, LOST_UPDATE_RETRY_POLICY, SCHEMA_INIT_ATTEMPTS, SCHEMA_INIT_RETRY_POLICY, isRetriableControlWriteFailure, isRetriableLostUpdateFailure, isRetriableSchemaInitFailure, retryControlWrite, type ControlWriteRetryOptions } from './control-write-retry.js';
|
|
7
10
|
export { CONTROL_READ_ATTEMPTS, CONTROL_READ_RETRY_DELAYS_MS, CONTROL_READ_RETRY_BUDGET_MS, isRetriableControlReadFailure, retryControlRead, type ControlReadRetryOptions } from './control-read-retry.js';
|
|
8
11
|
export type { ControlRetryAbandonment, ControlRetryAbandonReason, ControlRetryAbandonListener } from './control-retry.js';
|
|
9
|
-
export { controlAuthorizationFields, unboundAuthorizationFields, cadreInviteRowFields, type ControlDomain, type BoundControlDomain, type UnboundControlDomain, type ControlAction, type CadreInviteSignedFields } from './control-authorization.js';
|
|
10
|
-
export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, ed25519PublicKeyB64FromPeerId, requireEd25519PublicKeyB64, type Ed25519KeyPair } from './ed25519-key.js';
|
|
11
|
-
export { InMemoryKeyStore, KeyStoreAccessError, DEFAULT_IDENTITY_KEY_ID, type KeyStore, type KeyId } from './key-store.js';
|
|
12
|
+
export { controlAuthorizationFields, unboundAuthorizationFields, cadreInviteRowFields, ownerGrantRowFields, type ControlDomain, type BoundControlDomain, type UnboundControlDomain, type ControlAction, type CadreInviteSignedFields, type OwnerGrantSignedFields } from './control-authorization.js';
|
|
13
|
+
export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, ed25519PublicKeyB64FromPeerId, requireEd25519PublicKeyB64, requireEd25519PrivateKeyB64, type Ed25519KeyPair } from './ed25519-key.js';
|
|
14
|
+
export { InMemoryKeyStore, KeyStoreAccessError, DEFAULT_IDENTITY_KEY_ID, DEFAULT_OWNER_KEY_ID, type KeyStore, type KeyId } from './key-store.js';
|
|
12
15
|
export { encodeFileSafeComponent } from './file-safe-name.js';
|
|
13
16
|
export { loadOrCreateIdentityKey } from './identity-key.js';
|
|
17
|
+
export { softwareOwnerSigner, OwnerSigningDeclinedError, type OwnerSigner, type OwnerSign, type OwnerSigningRequest } from './owner-signer.js';
|
|
18
|
+
export { createOwnerKey, loadOwnerSigner, importOwnerKey, readOwnerPrivateKey, OwnerKeySlotOccupiedError } from './owner-key-store.js';
|
|
19
|
+
export { encodeOwnerKeyExport, decodeOwnerKeyExport, unlockOwnerKeyExport, OwnerKeyExportError, OWNER_KEY_EXPORT_PREFIX, LOCKED_OWNER_KEY_EXPORT_PREFIX, OWNER_KEY_MAX_LABEL, type OwnerKeyExportErrorCode, type OwnerKeyExportContents, type OwnerKeyExportInput, type DecodedOwnerKeyExport } from './owner-key-export.js';
|
|
20
|
+
export { exportOwnerKey, importOwnerKeyInto, type ExportedOwnerKey, type ImportedOwnerKey, type OwnerKeyExportOptions } from './owner-key-flows.js';
|
|
14
21
|
export { MemoryTrustedOwnerStore, PersistentTrustedOwnerStore, type TrustedOwnerStore, type TrustSource } from './trusted-owner-store.js';
|
|
15
22
|
export type { DurableSlot } from './node-local-snapshot.js';
|
|
16
23
|
export { MemoryBootstrapPeerStore, PersistentBootstrapPeerStore, type BootstrapPeerStore, type BootstrapPeerEntry } from './bootstrap-peer-store.js';
|
|
@@ -23,24 +30,24 @@ export { StrandDatabase, type StrandDatabaseConfig } from './strand-database.js'
|
|
|
23
30
|
export type { StrandCommitDurability, StrandCommitHeld } from './strand-commit-durability.js';
|
|
24
31
|
export { StrandWatcher, type StrandWatcherCallbacks, type StrandQueryable, type SAppIdLookup, type StrandRowWithApp } from './strand-watcher.js';
|
|
25
32
|
export { StrandInstanceManager, type StartStrandConfig, type ResumeStrandOverrides, getStrandStoragePath, isAwaitingFirstSync, liveStrandStatus } from './strand-instance-manager.js';
|
|
26
|
-
export { StrandAwaitingFirstSyncError, DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS,
|
|
33
|
+
export { StrandAwaitingFirstSyncError, DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS, DEFAULT_STRAND_FIRST_SYNC_BACKSTOP_MS, type StrandFirstSyncConfig } from './strand-first-sync-gate.js';
|
|
27
34
|
export { PeerJoinBackfill, DEFAULT_PEER_JOIN_BACKFILL, MAX_BLOCK_MESSAGE_BYTES, PEER_JOIN_BACKFILL_WARN_AFTER_FAILURES, type PeerJoinBackfillConfig, type PeerJoinBackfillDeps, type PeerJoinBackfillResult, type PeerJoinBackfillPushClient } from './peer-join-backfill.js';
|
|
28
35
|
export { strandCohortTopicOption, type StrandReactivityConfig } from './strand-reactivity.js';
|
|
29
|
-
export { StrandRevocationEnforcer, createRevocationConnectionGater, readStrandRevocationRows,
|
|
30
|
-
export { StrandMembershipReconciler, IDLE_PASSES_BEFORE_ESCALATION, INITIAL_JOIN_RETRY_INTERVAL_MS, type StrandMembershipReconcilerDeps, type StrandMembershipReconciliationConfig, type PendingMembershipInviteSource } from './strand-membership-reconciler.js';
|
|
36
|
+
export { StrandRevocationEnforcer, createRevocationConnectionGater, readStrandRevocationRows, DEFAULT_REVOCATION_BACKSTOP_MS, REVOCATION_REFRESH_RETRY_MS, REVOCATION_WIDE_STRAND_REFRESH_MS, type StrandRevocationEnforcementConfig, type StrandRevocationEnforcerDeps, type StrandRevocationRows, type StrandMemberPeerBinding, type StrandRevocationJudge, type StrandRevocationNetwork } from './strand-revocation-enforcer.js';
|
|
37
|
+
export { StrandMembershipReconciler, DEFAULT_MEMBERSHIP_RECONCILE_INTERVAL_MS, IDLE_PASSES_BEFORE_ESCALATION, INITIAL_JOIN_RETRY_INTERVAL_MS, type StrandMembershipReconcilerDeps, type StrandMembershipReconciliationConfig, type PendingMembershipInviteSource } from './strand-membership-reconciler.js';
|
|
31
38
|
export { defaultTimeoutScheduler, type TimeoutScheduler } from './timeout-scheduler.js';
|
|
32
39
|
export { HibernationManager, type HibernationCallbacks } from './hibernation-manager.js';
|
|
33
40
|
export { ArachnodeStub, createArachnodeStub, type RingConfig } from './arachnode-stub.js';
|
|
34
41
|
export { EnrollmentService, type MemberVerifier, type MemberRegistry } from './enrollment.js';
|
|
35
|
-
export { StrandSolicitationService, createDefaultFormationResponseValidator, type DisclosureValidator, type FormationUsageRecorder, type FormationUsageParams, type AuthorizedFormationUsage, type ResolvedHostStrand, type StrandProvisioner, type FormationResponseValidator, type StrandSolicitationServiceOptions } from './strand-solicitation.js';
|
|
42
|
+
export { StrandSolicitationService, createDefaultFormationResponseValidator, type DisclosureValidator, type FormationUsageRecorder, type FormationUsageParams, type AuthorizedFormationUsage, type BoundHostStrand, type ResolvedHostStrand, type StrandProvisioner, type FormationResponseValidator, type StrandSolicitationServiceOptions } from './strand-solicitation.js';
|
|
36
43
|
export { createHttpFormationApprover, signFormationApproval, verifyFormationApproval, FormationApprovalError, type FormationApprovalRequest, type FormationVouchFields, type FormationApproval, type FormationApprover, type FormationApprovalFailure } from './formation-approval.js';
|
|
37
44
|
export { ControlFormationUsageRecorder } from './control-formation-recorder.js';
|
|
38
45
|
export { generateStrandMemberKey, strandMemberKeyPair } from './strand-member-key.js';
|
|
39
46
|
export { signStrandPayload, verifyStrandPayload, signStrandApproval, generateStrandStampId, bootstrapFounderMembership, PreSplitStrandIdentityError, issueInvite, consumeInvite, burnInvite, isStrandMember, cancelInvite, listOutstandingInvites, addMemberByManager, revokeMember, leaveStrand, registerMemberPeer, listMemberPeers, removeMemberPeer, addManager, admitManager, removeManager, sealStrand, isStrandSealed, StrandTransactionBusyError, STRAND_ENGINE, STRAND_ENGINE_VERSION, type FounderBootstrapParams, type IssueInviteParams, type IssuedInvite, type ConsumeInviteParams, type CancelInviteParams, type OutstandingInvite, type AddMemberByManagerParams, type RevokeMemberParams, type LeaveStrandParams, type RegisterMemberPeerParams, type RemoveOwnPeerParams, type RemoveMemberPeerByManagerParams, type RemoveMemberPeerParams, type AddManagerParams, type AdmitManagerParams, type RemoveManagerParams, type SealStrandParams, type StrandWriteOptions } from './strand-membership-writer.js';
|
|
40
47
|
export { canonicalDatetime } from './canonical-datetime.js';
|
|
41
48
|
export { StrandMemberRegistry, StrandMemberVerifier, memberRegistrationPayload, type StrandAdmission } from './strand-member-registry.js';
|
|
42
|
-
export { SeedBootstrapService, SEED_PROTOCOL, mergeSeedPeers, seedDigest, type SeedBootstrapConfig, type SeedEventCallbacks } from './seed-bootstrap.js';
|
|
43
|
-
export { peerAuthorizationDigest, cadrePeerVoucherDigest, cadrePeerRemoveDigest, deviceTokenAddDigest, deviceTokenRemoveDigest, formationConsentDigest, cadreInviteAddDigest, cadreInviteRedeemDigest, cadreInviteConsentDigest, ownerKeyAddDigest, verifyPeerAuthorization, verifyCadrePeerVoucher, verifyOwnerKeyVoucher, verifyRevocationSigner, verifyFormationConsent, verifyInvitationAdmission,
|
|
49
|
+
export { SeedBootstrapService, SEED_PROTOCOL, mergeSeedPeers, seedDialTargets, seedDigest, type SeedBootstrapConfig, type SeedEventCallbacks } from './seed-bootstrap.js';
|
|
50
|
+
export { peerAuthorizationDigest, cadrePeerVoucherDigest, cadrePeerRemoveDigest, deviceTokenAddDigest, deviceTokenRemoveDigest, formationConsentDigest, cadreInviteAddDigest, cadreInviteRedeemDigest, cadreInviteConsentDigest, ownerKeyAddDigest, verifyPeerAuthorization, verifyCadrePeerVoucher, verifyOwnerKeyVoucher, verifyRevocationSigner, verifyFormationConsent, verifyInvitationAdmission, verifyCadreInviteRow, verifyCadreInviteRedemption, ownerGrantAddDigest, ownerGrantRedeemDigest, ownerGrantConsentDigest, verifyOwnerGrantRow, verifyOwnerGrantRedemption, verifyOwnerGrantAdmission, type DeviceTokenAuthorizedRow } from './peer-authorization.js';
|
|
44
51
|
export { deriveOwnerAnchor, type OwnerAnchorInputs, type OwnerAnchorDerivation } from './owner-anchor-sync.js';
|
|
45
52
|
export { StrandWakeService, dialWake, WAKE_PROTOCOL, DEFAULT_WAKE_DIAL_BUDGET_MS, type StrandWakeServiceOptions, type DialWakeOptions } from './strand-wake-protocol.js';
|
|
46
53
|
export { StrandAddrService, collectStrandAddrs, STRAND_ADDR_PROTOCOL, type StrandAddrServiceOptions, type StrandAddrPeer, type CollectStrandAddrsOptions, type StrandAddrOutcome, type StrandAddrCollection } from './strand-addr-protocol.js';
|
|
@@ -50,22 +57,25 @@ export { STRAND_WAKE_TYPE, type StrandWakePayload } from './strand-wake-payload.
|
|
|
50
57
|
export type { PushNotifier, PushMessage, PushSendResult } from './push-notifier.js';
|
|
51
58
|
export { validatePushCredentials, redactPushCredentials, REDACTED } from './push-credentials.js';
|
|
52
59
|
export { PushFanoutService, DEFAULT_PUSH_COOLDOWN_MS, DEFAULT_PUSH_DEBOUNCE_MS, type PushFanoutOptions, type FanoutMember } from './push-fanout.js';
|
|
53
|
-
export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE, type ControlCohortSelection, type ControlCohortReconcileResult } from './control-cohort.js';
|
|
60
|
+
export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE, CONTROL_COHORT_REDIAL_MS, type ControlCohortSelection, type ControlCohortReconcileResult } from './control-cohort.js';
|
|
54
61
|
export { dialAddr, withTrailingPeerId, dialPeerAddrs, SelfRelayOnlyError, PeerUnreachableError, tryAddrsInTurn, directBeforeRelayed, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS, CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS, DEFAULT_PEER_DIAL_BUDGET, type PeerDialBudget, type AddrDialer } from './peer-dial.js';
|
|
55
62
|
export { DECLARED_LINK_ROUND_TRIP_MS, CIRCUIT_DIAL_ROUND_TRIPS, RELAY_DIAL_ROUND_TRIPS, RELAYED_DIAL_ROUND_TRIPS, RELAY_RESERVATION_ROUND_TRIPS, CIRCUIT_REQUEST_ROUND_TRIPS, RELAYED_REQUEST_ROUND_TRIPS, PUSH_TRANSFER_ALLOWANCE_MS, ADMISSION_DECISION_TIMEOUT_MS, resolveLinkRoundTripMs, relayedDialBudgetMs, relayReservationBudgetMs, circuitRequestBudgetMs, relayedRequestBudgetMs, peerJoinPushBudget, type PeerJoinPushBudget, DIAL_ADMISSION_DECISIONS, optimysticDialLimits, type OptimysticDialLimits } from './link-budget.js';
|
|
56
63
|
export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy, claimSecretTrustPolicy, type SeedTrustPolicy, type SeedTrustContext, type SeedTrustDecision, type ClaimSecretTrustPolicyOptions } from './seed-trust-policy.js';
|
|
57
64
|
export { parseClaimSecret, claimProof, verifyClaimProof, ClaimRefusedError, CLAIM_SECRET_BYTES } from './claim-proof.js';
|
|
58
65
|
export { encodeNodeClaimPayload, decodeNodeClaimPayload, selectNodeClaimAddresses, withClaimDestination, destinationPeerIdOf, classifyDialAddress, NODE_CLAIM_PAYLOAD_PREFIX, type NodeClaimPayload, type NodeClaimAddressOptions, type DialAddressKind } from './node-claim-payload.js';
|
|
59
66
|
export { exportStrandBundle, adoptStrandBundle, readStrandHoldings, unheldBundleContent, StrandMoveNotOwnerError, StrandMoveSamePartyError, type StrandHoldings, type StrandBundle, type StrandBundleEntry, type FormationInviteEntry, type StrandMoveReport, type StrandMoveFailure } from './strand-move.js';
|
|
60
|
-
export { encodeCadreJoinRequest, decodeCadreJoinRequest, requireCadreJoinReply, CADRE_JOIN_REQUEST_PREFIX, CADRE_INVITATION_PREFIX, CADRE_JOIN_REQUEST_MAX_APP_NAME, type CadreJoinReply, type CadreJoinRequest } from './cadre-join-request.js';
|
|
67
|
+
export { encodeCadreJoinRequest, decodeCadreJoinRequest, requireCadreJoinReply, CADRE_JOIN_REQUEST_PREFIX, CADRE_INVITATION_PREFIX, OWNER_KEY_EXPORT_STEM, OWNER_GRANT_PREFIX, CADRE_JOIN_REQUEST_MAX_APP_NAME, type CadreJoinReply, type CadreJoinRequest } from './cadre-join-request.js';
|
|
61
68
|
export * from './provider/index.js';
|
|
62
69
|
export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
|
|
63
|
-
export { FormationListener, dialFormation, dialFormationByMachine, isValidResponderCreatesResult, isWellFormedMembershipInvite, sanitizeStrandAddrs, FORMATION_PROTOCOL, type FormationParty, type FormationContactMessage, type FormationResultMessage, type FormationProvisionResult, type FormationStrandInfo, type FormationDbConnectionInfo, type FormationListenerOptions, type FormationDialOptions, type FormationDialResult, type FormationRejection, type
|
|
70
|
+
export { FormationListener, dialFormation, dialFormationByMachine, isValidResponderCreatesResult, isWellFormedMembershipInvite, sanitizeStrandAddrs, FORMATION_PROTOCOL, type FormationParty, type FormationContactMessage, type FormationResultMessage, type FormationProvisionResult, type FormationStrandInfo, type FormationDbConnectionInfo, type FormationListenerOptions, type FormationDialOptions, type FormationDialResult, type FormationRejection, type ResponderProvisionOutcome } from './strand-formation-protocol.js';
|
|
71
|
+
export { classifyTokenRead, isTokenReadSpent, type FormationInviteFacts, type FormationTokenRead, type FormationTokenCheck } from './formation-token.js';
|
|
64
72
|
export { FormationRejectedError, FormationUnreachableError, FormationPostApprovalError, FORMATION_REJECTION_RETRYABLE, isFormationRejectionCode, type FormationRejectionCode } from './strand-formation-rejection.js';
|
|
65
73
|
export { formationDeadlines, type FormationDeadlines } from './strand-formation-deadlines.js';
|
|
66
|
-
export { CadreInviteHandler, redeemAtMembers, redeemInPasses, signRedeemRequest, verifyRedeemReply, encodeCadreInvitation, decodeCadreInvitation, isWellFormedCadreInviteRow, sanitizeAddrs, CadreInviteRejectedError, CadreInviteUnreachableError, CadreInviteReplyInvalidError, CADRE_INVITE_PROTOCOL, CADRE_INVITE_REJECTION_RETRYABLE, isCadreInviteRejectionCode, type CadreInvitation, type CadreInviteRedeemRequest, type CadreInviteRedeemReply, type CadreInviteAccepted, type CadreInviteRejectionCode, type CadreInviteAddressOutcome, type CadreInviteHandlerOptions, type CadreInviteStore, type RedeemAtMembersOptions, type RedeemInPassesOptions, type RedeemSigner, type CadreInviteRedemption } from './cadre-invite-protocol.js';
|
|
74
|
+
export { CadreInviteHandler, redeemAtMembers, redeemInPasses, signRedeemRequest, verifyRedeemReply, encodeCadreInvitation, decodeCadreInvitation, isWellFormedCadreInviteRow, sanitizeAddrs, CadreInviteRejectedError, CadreInviteUnreachableError, CadreInviteReplyInvalidError, CADRE_INVITE_PROTOCOL, CADRE_INVITE_REJECTION_RETRYABLE, isCadreInviteRejectionCode, type CadreInvitation, type CadreInviteRedeemRequest, type CadreInviteRedeemReply, type CadreInviteAccepted, type CadreInviteRejectionCode, type CadreInviteAddressOutcome, type CadreInviteHandlerOptions, type CadreInviteStore, type RedeemAtMembersOptions, type RedeemInPassesOptions, type RedeemSigner, type RedeemSelfRecord, type CadreInviteRedemption } from './cadre-invite-protocol.js';
|
|
75
|
+
export { OwnerGrantHandler, redeemOwnerGrantAtMembers, redeemOwnerGrantInPasses, signOwnerGrantRequest, verifyOwnerGrantReply, encodeOwnerGrant, decodeOwnerGrant, isWellFormedOwnerGrantRow, OwnerGrantRejectedError, OwnerGrantUnreachableError, OwnerGrantReplyInvalidError, OWNER_GRANT_PROTOCOL, OWNER_GRANT_REJECTION_RETRYABLE, isOwnerGrantRejectionCode, type OwnerGrantBundle, type OwnerGrantRedeemRequest, type OwnerGrantRedeemReply, type OwnerGrantAccepted, type OwnerGrantRejectionCode, type OwnerGrantHandlerOptions, type OwnerGrantStore, type RedeemOwnerGrantAtMembersOptions, type RedeemOwnerGrantInPassesOptions, type OwnerGrantRedemption } from './owner-grant-protocol.js';
|
|
76
|
+
export { MemberRedemptionHandler, dialRedemption, dialRedemptionInPasses, MAX_REDEMPTION_FRAME_BYTES, type MemberRedemptionHandlerOptions, type MemberRedemptionOptions, type MemberRedemptionPassOptions, type MemberRedemption, type RedemptionAddressOutcome, type RedemptionRejection, type RedemptionRefusalFrame } from './member-redemption.js';
|
|
67
77
|
export { selectCadreInvitationMembers, cadreInvitationReach, CADRE_INVITATION_MAX_ADDRS, CADRE_INVITATION_ADDRS_PER_SIBLING } from './invitation-bootstrap.js';
|
|
68
|
-
export {
|
|
78
|
+
export { PENDING_JOIN_BACKSTOP_MS, PENDING_JOIN_MAX_BACKOFF_MS, MAX_PENDING_JOIN_MS } from './pending-join-runner.js';
|
|
69
79
|
export { StrandFormationManager, createStrandFormationManager, MEMBERSHIP_INVITE_TTL_MS, MEMBERSHIP_INVITE_UNAVAILABLE_REASON, HOST_STRAND_MUST_BE_RECREATED_REASON, type CadrePeerAddrsSource, type MembershipInviteIssuer, type StrandFormationManagerConfig, type StrandFormationManagerOptions } from './strand-formation-manager.js';
|
|
70
80
|
export { controlProtocolClasses, type ControlProtocolClass } from './control-protocol-guard.js';
|
|
71
81
|
export { createMembershipConnectionGater, PROVISIONAL_ADMISSION_DEADLINE_MS, PROVISIONAL_ADMISSION_CLOSE_TIMEOUT_MS, MAX_UNAUTHORIZED_RELAY_RESERVATIONS, UnauthorizedReservationBudget, type InboundAdmissionPolicy, type InboundConnectionVerdict } from './membership-connection-gater.js';
|
package/dist/index.js
CHANGED
|
@@ -3,35 +3,50 @@ export * from './types.js';
|
|
|
3
3
|
// Canonical JSON serialization (shared signing payload format)
|
|
4
4
|
export { canonicalJson } from './canonical-json.js';
|
|
5
5
|
// Main CadreNode class
|
|
6
|
-
export { CadreNode,
|
|
6
|
+
export { CadreNode, CADRE_INVITATION_DEFAULT_TTL_MS, OWNER_GRANT_DEFAULT_TTL_MS } from './cadre-node.js';
|
|
7
7
|
// Removing a machine from a cadre: the by-name refusal `CadreNode.removeMachine` throws
|
|
8
8
|
// (the listing, plan and result types are in types.ts)
|
|
9
9
|
export { MachineRemovalRefusedError } from './machine-removal.js';
|
|
10
|
+
// Adding and removing an owner key: the by-name refusals `CadreNode.addOwner` and
|
|
11
|
+
// `CadreNode.removeOwner` throw (the listing, plan and result types are in types.ts)
|
|
12
|
+
export { OwnerKeyAddRefusedError, OwnerKeyRemovalRefusedError } from './owner-keys.js';
|
|
10
13
|
// Control database
|
|
11
|
-
export { ControlDatabase, parseNullableStoredDatetimeMs, MissingHostStrandError, InvitationExhaustedError, CadreInviteIssuerUnknownError, buildAuthorizationMessage, registerPartyIdFunction, formationVouchMessage, formationConsentMessage, cadreInviteAddMessage, cadreInviteRedeemMessage, cadreInviteConsentMessage, projectSeedPeers, REAPABLE_TABLES } from './control-database.js';
|
|
14
|
+
export { ControlDatabase, parseNullableStoredDatetimeMs, MissingHostStrandError, InvitationExhaustedError, CadreInviteIssuerUnknownError, OwnerGrantIssuerUnknownError, IssuedRowNotHereYetError, buildAuthorizationMessage, registerPartyIdFunction, formationVouchMessage, formationConsentMessage, cadreInviteAddMessage, cadreInviteRedeemMessage, cadreInviteConsentMessage, ownerGrantAddMessage, ownerGrantRedeemMessage, ownerGrantConsentMessage, projectSeedPeers, REAPABLE_TABLES } from './control-database.js';
|
|
15
|
+
// The control schema version a store is migrated to on start, and what `start()` throws, with a
|
|
16
|
+
// reason, when the store must not be migrated (docs/architecture.md → "Control schema versions and
|
|
17
|
+
// migrations")
|
|
18
|
+
export { CONTROL_SCHEMA_VERSION, CONTROL_SCHEMA_BASELINE_VERSION, CONTROL_SCHEMA_VERSION_TAG } from './control-schema.js';
|
|
19
|
+
export { ControlStoreIncompatibleError } from './control-schema-version.js';
|
|
12
20
|
// Bounded retry for transient control-write failures (classifier + loop behind
|
|
13
21
|
// ControlDatabase.lockedWithRetry; exported so the integration package can drive the
|
|
14
22
|
// classifier against real engine errors)
|
|
15
|
-
export { CONTROL_WRITE_ATTEMPTS, CONTROL_WRITE_RETRY_BUDGET_MS, SCHEMA_INIT_ATTEMPTS, SCHEMA_INIT_RETRY_POLICY, isRetriableControlWriteFailure, isRetriableSchemaInitFailure, retryControlWrite } from './control-write-retry.js';
|
|
23
|
+
export { CONTROL_WRITE_ATTEMPTS, CONTROL_WRITE_RETRY_BUDGET_MS, LOST_UPDATE_RETRY_POLICY, SCHEMA_INIT_ATTEMPTS, SCHEMA_INIT_RETRY_POLICY, isRetriableControlWriteFailure, isRetriableLostUpdateFailure, isRetriableSchemaInitFailure, retryControlWrite } from './control-write-retry.js';
|
|
16
24
|
// Bounded retry for transient control-read failures (classifier + policy behind
|
|
17
25
|
// ControlDatabase.readRows; the loop is shared with the write side via control-retry.ts)
|
|
18
26
|
export { CONTROL_READ_ATTEMPTS, CONTROL_READ_RETRY_DELAYS_MS, CONTROL_READ_RETRY_BUDGET_MS, isRetriableControlReadFailure, retryControlRead } from './control-read-retry.js';
|
|
19
27
|
// Control-plane authorization field vector (the domain/action tagging every signer shares)
|
|
20
|
-
export { controlAuthorizationFields, unboundAuthorizationFields, cadreInviteRowFields } from './control-authorization.js';
|
|
28
|
+
export { controlAuthorizationFields, unboundAuthorizationFields, cadreInviteRowFields, ownerGrantRowFields } from './control-authorization.js';
|
|
21
29
|
// Ed25519 key bridge (libp2p Ed25519 -> base64url keypair)
|
|
22
|
-
export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, ed25519PublicKeyB64FromPeerId, requireEd25519PublicKeyB64 } from './ed25519-key.js';
|
|
30
|
+
export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, ed25519PublicKeyB64FromPeerId, requireEd25519PublicKeyB64, requireEd25519PrivateKeyB64 } from './ed25519-key.js';
|
|
23
31
|
// Pluggable key store (backend-agnostic identity/owner key material seam).
|
|
24
32
|
// Dependency-free: the interface, error, default slot id, and in-memory backend
|
|
25
33
|
// are safe in every (RN/browser/Node) entry graph. The Node FileKeyStore is a
|
|
26
34
|
// separate subpath module ('@serfab/cadre-core/key-store-file') so its node:fs
|
|
27
35
|
// import never lands here.
|
|
28
|
-
export { InMemoryKeyStore, KeyStoreAccessError, DEFAULT_IDENTITY_KEY_ID } from './key-store.js';
|
|
36
|
+
export { InMemoryKeyStore, KeyStoreAccessError, DEFAULT_IDENTITY_KEY_ID, DEFAULT_OWNER_KEY_ID } from './key-store.js';
|
|
29
37
|
// The filename-safe form of an id that every Node-only per-party file store names its file
|
|
30
38
|
// with (`<name>.<encoded party>.json`), for an embedder keeping its own file beside theirs.
|
|
31
39
|
export { encodeFileSafeComponent } from './file-safe-name.js';
|
|
32
40
|
// The KeyStore-backed identity rule, shared with embedding apps that need the
|
|
33
41
|
// node key BEFORE `CadreNode` exists.
|
|
34
42
|
export { loadOrCreateIdentityKey } from './identity-key.js';
|
|
43
|
+
// Owner keys (`docs/architecture.md` → Owner Keys): the one interface owner signatures go
|
|
44
|
+
// through, the key-store slot an owner key lives in apart from the identity slot, and the
|
|
45
|
+
// text form a key is exported and imported in. Cross-platform: pure JS crypto only.
|
|
46
|
+
export { softwareOwnerSigner, OwnerSigningDeclinedError } from './owner-signer.js';
|
|
47
|
+
export { createOwnerKey, loadOwnerSigner, importOwnerKey, readOwnerPrivateKey, OwnerKeySlotOccupiedError } from './owner-key-store.js';
|
|
48
|
+
export { encodeOwnerKeyExport, decodeOwnerKeyExport, unlockOwnerKeyExport, OwnerKeyExportError, OWNER_KEY_EXPORT_PREFIX, LOCKED_OWNER_KEY_EXPORT_PREFIX, OWNER_KEY_MAX_LABEL } from './owner-key-export.js';
|
|
49
|
+
export { exportOwnerKey, importOwnerKeyInto } from './owner-key-flows.js';
|
|
35
50
|
// Node-local trusted-owner anchor: the NON-replicated, per-party record of
|
|
36
51
|
// out-of-band-established owner keys (the trust anchor the replicated OwnerKey
|
|
37
52
|
// table cannot be). Cross-platform: interface + in-memory store only — the
|
|
@@ -84,7 +99,7 @@ export { StrandInstanceManager, getStrandStoragePath, isAwaitingFirstSync, liveS
|
|
|
84
99
|
// The joining machine's first-sync write gate: a non-founder launch withholds its
|
|
85
100
|
// database (status 'syncing') until the strand's Header has arrived from a peer, so a
|
|
86
101
|
// write before the first sync can never fork the strand's tables.
|
|
87
|
-
export { StrandAwaitingFirstSyncError, DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS,
|
|
102
|
+
export { StrandAwaitingFirstSyncError, DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS, DEFAULT_STRAND_FIRST_SYNC_BACKSTOP_MS } from './strand-first-sync-gate.js';
|
|
88
103
|
// Peer-join block catch-up (push this network's own blocks to each newly
|
|
89
104
|
// connected peer, so a late joiner physically holds pre-join blocks). Shared
|
|
90
105
|
// by the strand networks (ungated) and the control network (membership-gated).
|
|
@@ -96,14 +111,14 @@ export { strandCohortTopicOption } from './strand-reactivity.js';
|
|
|
96
111
|
// members at the stream and connection layers, and hang up the sessions they
|
|
97
112
|
// already hold — see the module doc for the settled deny-list design, the
|
|
98
113
|
// teardown seam, and the fail directions).
|
|
99
|
-
export { StrandRevocationEnforcer, createRevocationConnectionGater, readStrandRevocationRows,
|
|
114
|
+
export { StrandRevocationEnforcer, createRevocationConnectionGater, readStrandRevocationRows, DEFAULT_REVOCATION_BACKSTOP_MS, REVOCATION_REFRESH_RETRY_MS, REVOCATION_WIDE_STRAND_REFRESH_MS } from './strand-revocation-enforcer.js';
|
|
100
115
|
// Closed-strand membership reconciliation: the bring-up loop that finishes a
|
|
101
116
|
// party's join on every machine — redeem the staged formation invitation, then
|
|
102
117
|
// write the durable machine→party MemberPeer binding — without ever blocking
|
|
103
118
|
// bring-up (see the module doc for the pass ladder and terminal states).
|
|
104
|
-
export { StrandMembershipReconciler, IDLE_PASSES_BEFORE_ESCALATION, INITIAL_JOIN_RETRY_INTERVAL_MS } from './strand-membership-reconciler.js';
|
|
105
|
-
// The timer seam the self-rescheduling
|
|
106
|
-
//
|
|
119
|
+
export { StrandMembershipReconciler, DEFAULT_MEMBERSHIP_RECONCILE_INTERVAL_MS, IDLE_PASSES_BEFORE_ESCALATION, INITIAL_JOIN_RETRY_INTERVAL_MS } from './strand-membership-reconciler.js';
|
|
120
|
+
// The timer seam the self-rescheduling loops share (membership retry ladder, the table
|
|
121
|
+
// change schedule the first-sync gate probes on) — injected by tests as a hand-cranked clock.
|
|
107
122
|
export { defaultTimeoutScheduler } from './timeout-scheduler.js';
|
|
108
123
|
// Hibernation
|
|
109
124
|
export { HibernationManager } from './hibernation-manager.js';
|
|
@@ -133,9 +148,9 @@ export { canonicalDatetime } from './canonical-datetime.js';
|
|
|
133
148
|
// MemberVerifier that write/read the real Strand.* membership tables.
|
|
134
149
|
export { StrandMemberRegistry, StrandMemberVerifier, memberRegistrationPayload } from './strand-member-registry.js';
|
|
135
150
|
// Seed Bootstrap
|
|
136
|
-
export { SeedBootstrapService, SEED_PROTOCOL, mergeSeedPeers, seedDigest } from './seed-bootstrap.js';
|
|
151
|
+
export { SeedBootstrapService, SEED_PROTOCOL, mergeSeedPeers, seedDialTargets, seedDigest } from './seed-bootstrap.js';
|
|
137
152
|
// Peer Authorization (shared owner-signature digest + offline verifier)
|
|
138
|
-
export { peerAuthorizationDigest, cadrePeerVoucherDigest, cadrePeerRemoveDigest, deviceTokenAddDigest, deviceTokenRemoveDigest, formationConsentDigest, cadreInviteAddDigest, cadreInviteRedeemDigest, cadreInviteConsentDigest, ownerKeyAddDigest, verifyPeerAuthorization, verifyCadrePeerVoucher, verifyOwnerKeyVoucher, verifyRevocationSigner, verifyFormationConsent, verifyInvitationAdmission,
|
|
153
|
+
export { peerAuthorizationDigest, cadrePeerVoucherDigest, cadrePeerRemoveDigest, deviceTokenAddDigest, deviceTokenRemoveDigest, formationConsentDigest, cadreInviteAddDigest, cadreInviteRedeemDigest, cadreInviteConsentDigest, ownerKeyAddDigest, verifyPeerAuthorization, verifyCadrePeerVoucher, verifyOwnerKeyVoucher, verifyRevocationSigner, verifyFormationConsent, verifyInvitationAdmission, verifyCadreInviteRow, verifyCadreInviteRedemption, ownerGrantAddDigest, ownerGrantRedeemDigest, ownerGrantConsentDigest, verifyOwnerGrantRow, verifyOwnerGrantRedemption, verifyOwnerGrantAdmission } from './peer-authorization.js';
|
|
139
154
|
// How the trusted-owner anchor follows the replicated OwnerKey table along verifiable
|
|
140
155
|
// chains: the pure derivation rule `CadreNode.syncOwnerAnchor` applies on every membership
|
|
141
156
|
// refresh (owner-anchor-sync.ts).
|
|
@@ -160,8 +175,8 @@ export { validatePushCredentials, redactPushCredentials, REDACTED } from './push
|
|
|
160
175
|
// value pulls no node:http2/node:crypto edge into the RN/browser graph.
|
|
161
176
|
export { PushFanoutService, DEFAULT_PUSH_COOLDOWN_MS, DEFAULT_PUSH_DEBOUNCE_MS } from './push-fanout.js';
|
|
162
177
|
// Control-cohort dial selection (backbone-preferential, bounded out-degree) +
|
|
163
|
-
// the
|
|
164
|
-
export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE } from './control-cohort.js';
|
|
178
|
+
// the backstop, redial and degree defaults the proactive reconcile routine reads.
|
|
179
|
+
export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE, CONTROL_COHORT_REDIAL_MS } from './control-cohort.js';
|
|
165
180
|
// Dialing one peer from several candidate addresses, each under its own time
|
|
166
181
|
// limit, so an address that never answers cannot starve the rest. Each address is
|
|
167
182
|
// bound to the peer expected and dialed outside libp2p's dial queue (`dialAddr`),
|
|
@@ -188,7 +203,7 @@ export { encodeNodeClaimPayload, decodeNodeClaimPayload, selectNodeClaimAddresse
|
|
|
188
203
|
export { exportStrandBundle, adoptStrandBundle, readStrandHoldings, unheldBundleContent, StrandMoveNotOwnerError, StrandMoveSamePartyError } from './strand-move.js';
|
|
189
204
|
// The join request: what an app that wants to join a cadre copies to the app that manages it,
|
|
190
205
|
// which mints an invitation targeted at the request's peer id. Both paste-text prefixes live here.
|
|
191
|
-
export { encodeCadreJoinRequest, decodeCadreJoinRequest, requireCadreJoinReply, CADRE_JOIN_REQUEST_PREFIX, CADRE_INVITATION_PREFIX, CADRE_JOIN_REQUEST_MAX_APP_NAME } from './cadre-join-request.js';
|
|
206
|
+
export { encodeCadreJoinRequest, decodeCadreJoinRequest, requireCadreJoinReply, CADRE_JOIN_REQUEST_PREFIX, CADRE_INVITATION_PREFIX, OWNER_KEY_EXPORT_STEM, OWNER_GRANT_PREFIX, CADRE_JOIN_REQUEST_MAX_APP_NAME } from './cadre-join-request.js';
|
|
192
207
|
// Renting a node from a hosting provider: the provider's descriptor, the app's side of the
|
|
193
208
|
// OAuth 2 + PKCE sign-in, the typed client for its container API, and `rentNode` /
|
|
194
209
|
// `finishRental`, which add the rented container to this node's cadre by invitation or by
|
|
@@ -200,16 +215,23 @@ export * from './provider/index.js';
|
|
|
200
215
|
export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
|
|
201
216
|
// Strand Formation transport (native cadre-core protocol)
|
|
202
217
|
export { FormationListener, dialFormation, dialFormationByMachine, isValidResponderCreatesResult, isWellFormedMembershipInvite, sanitizeStrandAddrs, FORMATION_PROTOCOL } from './strand-formation-protocol.js';
|
|
218
|
+
// A responder session's one read of its formation token, and the check made from it
|
|
219
|
+
export { classifyTokenRead, isTokenReadSpent } from './formation-token.js';
|
|
203
220
|
// How a formation dial fails: a typed refusal (with a fixed code) or no answer at all
|
|
204
221
|
export { FormationRejectedError, FormationUnreachableError, FormationPostApprovalError, FORMATION_REJECTION_RETRYABLE, isFormationRejectionCode } from './strand-formation-rejection.js';
|
|
205
222
|
export { formationDeadlines } from './strand-formation-deadlines.js';
|
|
206
223
|
// Cadre invitation redemption transport: the bundle an owner hands out, the wire messages, the
|
|
207
224
|
// member-side handler and the device-side dialer, and how a redemption fails
|
|
208
225
|
export { CadreInviteHandler, redeemAtMembers, redeemInPasses, signRedeemRequest, verifyRedeemReply, encodeCadreInvitation, decodeCadreInvitation, isWellFormedCadreInviteRow, sanitizeAddrs, CadreInviteRejectedError, CadreInviteUnreachableError, CadreInviteReplyInvalidError, CADRE_INVITE_PROTOCOL, CADRE_INVITE_REJECTION_RETRYABLE, isCadreInviteRejectionCode } from './cadre-invite-protocol.js';
|
|
226
|
+
// Owner grant redemption transport: the bundle an owner hands out, the wire messages, the
|
|
227
|
+
// member-side handler and the holder-side dialer, and how a redemption fails
|
|
228
|
+
export { OwnerGrantHandler, redeemOwnerGrantAtMembers, redeemOwnerGrantInPasses, signOwnerGrantRequest, verifyOwnerGrantReply, encodeOwnerGrant, decodeOwnerGrant, isWellFormedOwnerGrantRow, OwnerGrantRejectedError, OwnerGrantUnreachableError, OwnerGrantReplyInvalidError, OWNER_GRANT_PROTOCOL, OWNER_GRANT_REJECTION_RETRYABLE, isOwnerGrantRejectionCode } from './owner-grant-protocol.js';
|
|
229
|
+
// The exchange shape both redemption protocols are built on
|
|
230
|
+
export { MemberRedemptionHandler, dialRedemption, dialRedemptionInPasses, MAX_REDEMPTION_FRAME_BYTES } from './member-redemption.js';
|
|
209
231
|
// Which machines, and how many addresses of each, an invitation names; how far a cadre invitation reaches
|
|
210
232
|
export { selectCadreInvitationMembers, cadreInvitationReach, CADRE_INVITATION_MAX_ADDRS, CADRE_INVITATION_ADDRS_PER_SIBLING } from './invitation-bootstrap.js';
|
|
211
233
|
// The pending-join retry loop behind CadreNode.requestJoin (PendingJoinStatus is in types.ts)
|
|
212
|
-
export {
|
|
234
|
+
export { PENDING_JOIN_BACKSTOP_MS, PENDING_JOIN_MAX_BACKOFF_MS, MAX_PENDING_JOIN_MS } from './pending-join-runner.js';
|
|
213
235
|
// Strand Formation manager (drives the native transport)
|
|
214
236
|
export { StrandFormationManager, createStrandFormationManager, MEMBERSHIP_INVITE_TTL_MS, MEMBERSHIP_INVITE_UNAVAILABLE_REASON, HOST_STRAND_MUST_BE_RECREATED_REASON } from './strand-formation-manager.js';
|
|
215
237
|
// Control-network per-stream protocol guard (which peers may open which protocol)
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,cAAc,YAAY,CAAC;AAE3B,+DAA+D;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,uBAAuB;AACvB,OAAO,EAAE,SAAS,EAAE,+BAA+B,EAAE
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,cAAc,YAAY,CAAC;AAE3B,+DAA+D;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,uBAAuB;AACvB,OAAO,EAAE,SAAS,EAAE,+BAA+B,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAEzG,wFAAwF;AACxF,uDAAuD;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,kFAAkF;AAClF,qFAAqF;AACrF,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAEvF,mBAAmB;AACnB,OAAO,EAAE,eAAe,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,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ACF,qFAAqF;AACrF,qFAAqF;AACrF,uFAAuF;AACvF,wFAAwF;AACxF,wFAAwF;AACxF,YAAY;AACZ,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAwB,MAAM,4BAA4B,CAAC;AACnF,yFAAyF;AACzF,8DAA8D;AAC9D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAmB,MAAM,iBAAiB,CAAC;AACrG,2FAA2F;AAC3F,8FAA8F;AAC9F,+EAA+E;AAC/E,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC5B,8BAA8B,EAG/B,MAAM,mBAAmB,CAAC;AAE3B,gFAAgF;AAChF,0EAA0E;AAC1E,6BAA6B;AAC7B,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,gCAAgC,EAChC,6BAA6B,EAC7B,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAM7B,MAAM,wBAAwB,CAAC;AAEhC,2EAA2E;AAC3E,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EAMzB,MAAM,kCAAkC,CAAC"}
|
|
@@ -22,8 +22,8 @@ export interface JoinedStrandStore {
|
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* The {@link StrandRow} a record stands for — the shape `addStrand` and `strand:discovered`
|
|
25
|
-
* carry.
|
|
26
|
-
* reads null as "not mine" and joins.
|
|
25
|
+
* carry. The founder columns are null because a joiner never founds; `CadreNode.launchStrand`
|
|
26
|
+
* reads a null `FounderPeerId` as "not mine" and joins.
|
|
27
27
|
*/
|
|
28
28
|
export declare function joinedStrandRow(record: JoinedStrandRecord): StrandRow;
|
|
29
29
|
/**
|
|
@@ -49,9 +49,9 @@ export declare class MemoryJoinedStrandStore implements JoinedStrandStore {
|
|
|
49
49
|
* arbitrary text, and base64url never contains the `/` that ends the segment.
|
|
50
50
|
*
|
|
51
51
|
* Loads every slot once, at the first {@link list}, then answers from memory and writes
|
|
52
|
-
* through, so
|
|
53
|
-
*
|
|
54
|
-
*
|
|
52
|
+
* through, so a strand watcher run does not read the enclave each time. A load that
|
|
53
|
+
* fails — `KeyStoreAccessError` from a refused unlock prompt, say — is rethrown rather
|
|
54
|
+
* than read as "no joins" and retried at the next call, exactly as
|
|
55
55
|
* `loadOrCreateIdentityKey` treats the identity slot. A slot that does not parse as a
|
|
56
56
|
* record for its own id is dropped with a log and its siblings kept: refusing to start
|
|
57
57
|
* repairs nothing, and the other joins are still good.
|
|
@@ -79,7 +79,7 @@ export declare class KeyStoreJoinedStrandStore implements JoinedStrandStore {
|
|
|
79
79
|
* key; this module sees only the seam, so it stays free of the runtime.
|
|
80
80
|
*/
|
|
81
81
|
export interface PartyJoinedStrandLedger {
|
|
82
|
-
/** Every party-wide join, as offerable rows (
|
|
82
|
+
/** Every party-wide join, as offerable rows (null founder columns). */
|
|
83
83
|
list(): Promise<StrandRow[]>;
|
|
84
84
|
/** Whether this party's control database names `strandId`, as its own strand or as a party-wide join. */
|
|
85
85
|
names(strandId: string): Promise<boolean>;
|
|
@@ -95,7 +95,7 @@ export interface PartyJoinedStrandLedger {
|
|
|
95
95
|
* the moves between them. Rebuilt at every start, which is what ends the per-session state
|
|
96
96
|
* below.
|
|
97
97
|
*
|
|
98
|
-
* The watcher reads a row missing from a
|
|
98
|
+
* The watcher reads a row missing from a run's read as a removal and detaches the strand, so this
|
|
99
99
|
* holds the state a plain union would get wrong:
|
|
100
100
|
* - the last list each record answered, reused when a later read fails, so a failed read
|
|
101
101
|
* is not "every join was forgotten";
|
|
@@ -106,8 +106,11 @@ export interface PartyJoinedStrandLedger {
|
|
|
106
106
|
export declare class JoinedStrandSession {
|
|
107
107
|
private readonly store;
|
|
108
108
|
private readonly ledger;
|
|
109
|
+
private readonly onLocalChange;
|
|
109
110
|
private lastUnpublished;
|
|
110
111
|
private lastPartyWide;
|
|
112
|
+
/** Whether the last party-wide read in {@link withControlRows} succeeded; see {@link lastReadPartial}. */
|
|
113
|
+
private lastPartyWideFresh;
|
|
111
114
|
private readonly keptForSession;
|
|
112
115
|
/** Strands whose party-wide row {@link syncWithParty} removes, queued by a self-revocation. */
|
|
113
116
|
private readonly pendingRemovals;
|
|
@@ -117,21 +120,32 @@ export declare class JoinedStrandSession {
|
|
|
117
120
|
* would leave the party holding a strand the app just left.
|
|
118
121
|
*/
|
|
119
122
|
private exclusive;
|
|
120
|
-
|
|
123
|
+
/**
|
|
124
|
+
* @param onLocalChange - Called after a move changes what {@link withControlRows} merges in
|
|
125
|
+
* from outside the control database (this machine's unpublished joins, the joins kept for
|
|
126
|
+
* this session), which no control-table change event reports. `CadreNode` wakes its strand
|
|
127
|
+
* watcher with it.
|
|
128
|
+
*/
|
|
129
|
+
constructor(store: JoinedStrandStore, ledger: PartyJoinedStrandLedger, onLocalChange?: () => void);
|
|
121
130
|
/**
|
|
122
131
|
* `control` plus every join, one row per id, in this precedence: the control rows (the
|
|
123
132
|
* party's own strands), then the party-wide joins, then this machine's unpublished joins
|
|
124
133
|
* and the joins kept for this session. A local record named by either of the first two in
|
|
125
|
-
* a read that succeeded this
|
|
134
|
+
* a read that succeeded this run is stale — published, or the strand is the party's own
|
|
126
135
|
* now — so it is forgotten here; this also cleans up after a crash between a publish and
|
|
127
136
|
* its local forget. One named only by the last-good party-wide list is kept: that list may
|
|
128
137
|
* predate a leave the record re-joined after.
|
|
129
138
|
*/
|
|
130
139
|
withControlRows(control: readonly StrandRow[]): Promise<StrandRow[]>;
|
|
140
|
+
/**
|
|
141
|
+
* True when the last {@link withControlRows} offered the party-wide joins from the last
|
|
142
|
+
* list that answered, because its read of `JoinedStrand` failed.
|
|
143
|
+
*/
|
|
144
|
+
lastReadPartial(): boolean;
|
|
131
145
|
/**
|
|
132
146
|
* This machine's unpublished joins, straight from the store (never the last-good list a
|
|
133
147
|
* failed read stands in with). What a strand move exports beside the `JoinedStrand`
|
|
134
|
-
* table: a machine publishes only while
|
|
148
|
+
* table: a machine publishes only while a sibling is reachable, so until then its
|
|
135
149
|
* joins live only here.
|
|
136
150
|
*/
|
|
137
151
|
unpublishedRecords(): Promise<JoinedStrandRecord[]>;
|
|
@@ -140,7 +154,9 @@ export declare class JoinedStrandSession {
|
|
|
140
154
|
/**
|
|
141
155
|
* Record `row`, joined by `addStrand`, unless this party's control database already names
|
|
142
156
|
* it (its own strand, or a join already published) or an identical record is already here
|
|
143
|
-
* (an app re-claiming a remembered join on every start
|
|
157
|
+
* (an app re-claiming a remembered join on every start, or `addStrand` right after
|
|
158
|
+
* `formStrand`). The store is asked first: it answers from memory once loaded, so the
|
|
159
|
+
* common re-claim reads no control row. Keeps the first `joinedAt`. Like
|
|
144
160
|
* {@link remember}, cancels a queued removal.
|
|
145
161
|
*/
|
|
146
162
|
rememberForeign(row: StrandRow): Promise<void>;
|
|
@@ -174,9 +190,10 @@ export declare class JoinedStrandSession {
|
|
|
174
190
|
* {@link PartyJoinedStrandLedger.names}, answering false when the control database cannot
|
|
175
191
|
* be read (a machine cut off from its party before it received the `JoinedStrand` block).
|
|
176
192
|
* Recording is the safe side: a local record the party turns out to name is forgotten by
|
|
177
|
-
* the next
|
|
193
|
+
* the next watcher run that reads it, while a join with no record is not offered after a restart.
|
|
178
194
|
*/
|
|
179
195
|
private namedByParty;
|
|
196
|
+
private storedRecord;
|
|
180
197
|
/** Run `work` after every earlier serialized move settles; see {@link exclusive}. */
|
|
181
198
|
private serialized;
|
|
182
199
|
private unpublished;
|