@serfab/cadre-core 1.21.0 → 1.23.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.
Files changed (109) hide show
  1. package/README.md +294 -294
  2. package/dist/cadre-node.d.ts +334 -53
  3. package/dist/cadre-node.js +794 -85
  4. package/dist/cadre-node.js.map +1 -1
  5. package/dist/control-authorization.d.ts +32 -2
  6. package/dist/control-authorization.js +19 -0
  7. package/dist/control-authorization.js.map +1 -1
  8. package/dist/control-database.d.ts +236 -23
  9. package/dist/control-database.js +587 -173
  10. package/dist/control-database.js.map +1 -1
  11. package/dist/control-schema.d.ts +3 -3
  12. package/dist/control-schema.js +71 -7
  13. package/dist/control-schema.js.map +1 -1
  14. package/dist/ed25519-key.d.ts +8 -0
  15. package/dist/ed25519-key.js +11 -1
  16. package/dist/ed25519-key.js.map +1 -1
  17. package/dist/index.d.ts +5 -1
  18. package/dist/index.js +13 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/machine-removal.d.ts +51 -1
  21. package/dist/machine-removal.js +42 -1
  22. package/dist/machine-removal.js.map +1 -1
  23. package/dist/membership-connection-gater.d.ts +8 -0
  24. package/dist/membership-connection-gater.js +13 -1
  25. package/dist/membership-connection-gater.js.map +1 -1
  26. package/dist/membership-view.js +4 -1
  27. package/dist/membership-view.js.map +1 -1
  28. package/dist/owner-keys.js +2 -1
  29. package/dist/owner-keys.js.map +1 -1
  30. package/dist/owner-signer.js +3 -4
  31. package/dist/owner-signer.js.map +1 -1
  32. package/dist/peer-authorization.d.ts +14 -2
  33. package/dist/peer-authorization.js +24 -1
  34. package/dist/peer-authorization.js.map +1 -1
  35. package/dist/sealed-party-key.d.ts +32 -0
  36. package/dist/sealed-party-key.js +162 -0
  37. package/dist/sealed-party-key.js.map +1 -0
  38. package/dist/seed-bootstrap.d.ts +10 -3
  39. package/dist/seed-bootstrap.js +12 -0
  40. package/dist/seed-bootstrap.js.map +1 -1
  41. package/dist/strand-addr-protocol.d.ts +56 -6
  42. package/dist/strand-addr-protocol.js +57 -5
  43. package/dist/strand-addr-protocol.js.map +1 -1
  44. package/dist/strand-commit-durability.d.ts +33 -2
  45. package/dist/strand-commit-durability.js +44 -4
  46. package/dist/strand-commit-durability.js.map +1 -1
  47. package/dist/strand-database.d.ts +35 -5
  48. package/dist/strand-database.js +34 -10
  49. package/dist/strand-database.js.map +1 -1
  50. package/dist/strand-instance-manager.d.ts +200 -18
  51. package/dist/strand-instance-manager.js +434 -64
  52. package/dist/strand-instance-manager.js.map +1 -1
  53. package/dist/strand-membership-reconciler.d.ts +250 -51
  54. package/dist/strand-membership-reconciler.js +410 -66
  55. package/dist/strand-membership-reconciler.js.map +1 -1
  56. package/dist/strand-membership-writer.d.ts +7 -0
  57. package/dist/strand-membership-writer.js +9 -0
  58. package/dist/strand-membership-writer.js.map +1 -1
  59. package/dist/strand-party-key-rotation.d.ts +177 -0
  60. package/dist/strand-party-key-rotation.js +340 -0
  61. package/dist/strand-party-key-rotation.js.map +1 -0
  62. package/dist/strand-party-machines.d.ts +111 -0
  63. package/dist/strand-party-machines.js +258 -0
  64. package/dist/strand-party-machines.js.map +1 -0
  65. package/dist/strand-party-peers.d.ts +101 -0
  66. package/dist/strand-party-peers.js +49 -0
  67. package/dist/strand-party-peers.js.map +1 -0
  68. package/dist/strand-peer-redial.d.ts +34 -7
  69. package/dist/strand-peer-redial.js +46 -13
  70. package/dist/strand-peer-redial.js.map +1 -1
  71. package/dist/strand-revocation-enforcer.d.ts +15 -1
  72. package/dist/strand-revocation-enforcer.js +16 -9
  73. package/dist/strand-revocation-enforcer.js.map +1 -1
  74. package/dist/strand-transport-key.js +3 -0
  75. package/dist/strand-transport-key.js.map +1 -1
  76. package/dist/strand-watcher.d.ts +7 -4
  77. package/dist/strand-watcher.js +12 -7
  78. package/dist/strand-watcher.js.map +1 -1
  79. package/dist/types.d.ts +169 -13
  80. package/dist/types.js.map +1 -1
  81. package/package.json +9 -8
  82. package/src/cadre-node.ts +12280 -11528
  83. package/src/control-authorization.ts +41 -1
  84. package/src/control-database.ts +6123 -5603
  85. package/src/control-schema.ts +71 -7
  86. package/src/ed25519-key.ts +12 -1
  87. package/src/index.ts +957 -924
  88. package/src/machine-removal.ts +80 -1
  89. package/src/membership-connection-gater.ts +13 -1
  90. package/src/membership-view.ts +4 -1
  91. package/src/owner-keys.ts +2 -1
  92. package/src/owner-signer.ts +92 -94
  93. package/src/peer-authorization.ts +27 -3
  94. package/src/sealed-party-key.ts +190 -0
  95. package/src/seed-bootstrap.ts +17 -3
  96. package/src/strand-addr-protocol.ts +67 -6
  97. package/src/strand-commit-durability.ts +54 -5
  98. package/src/strand-database.ts +47 -11
  99. package/src/strand-instance-manager.ts +524 -65
  100. package/src/strand-membership-reconciler.ts +1310 -942
  101. package/src/strand-membership-writer.ts +10 -0
  102. package/src/strand-party-key-rotation.ts +436 -0
  103. package/src/strand-party-machines.ts +293 -0
  104. package/src/strand-party-peers.ts +129 -0
  105. package/src/strand-peer-redial.ts +61 -14
  106. package/src/strand-revocation-enforcer.ts +27 -9
  107. package/src/strand-transport-key.ts +3 -0
  108. package/src/strand-watcher.ts +12 -7
  109. package/src/types.ts +3121 -2963
package/src/index.ts CHANGED
@@ -1,924 +1,957 @@
1
- // Core types
2
- export * from './types.js';
3
-
4
- // Canonical JSON serialization (shared signing payload format)
5
- export { canonicalJson } from './canonical-json.js';
6
-
7
- // Text for a caught value that may not be an Error (every package that turns one into a message
8
- // uses this; `yarn lint` flags the `String(err)` fallback it replaces)
9
- export { describeThrown } from './describe-thrown.js';
10
-
11
- // Main CadreNode class
12
- export { CadreNode, CADRE_INVITATION_DEFAULT_TTL_MS, OWNER_GRANT_DEFAULT_TTL_MS } from './cadre-node.js';
13
-
14
- // Removing a machine from a cadre: the by-name refusal `CadreNode.removeMachine` throws
15
- // (the listing, plan and result types are in types.ts)
16
- export { MachineRemovalRefusedError } from './machine-removal.js';
17
-
18
- // Adding and removing an owner key: the by-name refusals `CadreNode.addOwner` and
19
- // `CadreNode.removeOwner` throw (the listing, plan and result types are in types.ts)
20
- export { OwnerKeyAddRefusedError, OwnerKeyRemovalRefusedError } from './owner-keys.js';
21
-
22
- // Control database
23
- 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';
24
-
25
- // The control schema version a store is migrated to on start, and what `start()` throws, with a
26
- // reason, when the store must not be migrated (docs/architecture.md → "Control schema versions and
27
- // migrations")
28
- export { CONTROL_SCHEMA_VERSION, CONTROL_SCHEMA_BASELINE_VERSION, CONTROL_SCHEMA_VERSION_TAG } from './control-schema.js';
29
- export { ControlStoreIncompatibleError, type ControlStoreIncompatibility } from './control-schema-version.js';
30
-
31
- // Bounded retry for transient control-write failures (classifier + loop behind
32
- // ControlDatabase.lockedWithRetry; exported so the integration package can drive the
33
- // classifier against real engine errors)
34
- export {
35
- CONTROL_WRITE_ATTEMPTS,
36
- CONTROL_WRITE_RETRY_BUDGET_MS,
37
- LOST_UPDATE_RETRY_POLICY,
38
- SCHEMA_INIT_ATTEMPTS,
39
- SCHEMA_INIT_RETRY_POLICY,
40
- isRetriableControlWriteFailure,
41
- isRetriableLostUpdateFailure,
42
- isRetriableSchemaInitFailure,
43
- retryControlWrite,
44
- type ControlWriteRetryOptions
45
- } from './control-write-retry.js';
46
-
47
- // Bounded retry for transient control-read failures (classifier + policy behind
48
- // ControlDatabase.readRows; the loop is shared with the write side via control-retry.ts)
49
- export {
50
- CONTROL_READ_ATTEMPTS,
51
- CONTROL_READ_RETRY_DELAYS_MS,
52
- CONTROL_READ_RETRY_BUDGET_MS,
53
- isRetriableControlReadFailure,
54
- retryControlRead,
55
- type ControlReadRetryOptions
56
- } from './control-read-retry.js';
57
-
58
- // The bounded retry loop both control policies share. Only the abandonment record leaves
59
- // this package: it is the payload of the `control:write-abandoned` node event, so an
60
- // embedding app can type a handler for it.
61
- export type {
62
- ControlRetryAbandonment,
63
- ControlRetryAbandonReason,
64
- ControlRetryAbandonListener
65
- } from './control-retry.js';
66
-
67
- // Control-plane authorization field vector (the domain/action tagging every signer shares)
68
- export { controlAuthorizationFields, unboundAuthorizationFields, cadreInviteRowFields, ownerGrantRowFields, type ControlDomain, type BoundControlDomain, type UnboundControlDomain, type ControlAction, type CadreInviteSignedFields, type OwnerGrantSignedFields } from './control-authorization.js';
69
-
70
- // Ed25519 key bridge (libp2p Ed25519 -> base64url keypair)
71
- export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, ed25519PublicKeyB64FromPeerId, requireEd25519PublicKeyB64, requireEd25519PrivateKeyB64, type Ed25519KeyPair } from './ed25519-key.js';
72
-
73
- // Pluggable key store (backend-agnostic identity/owner key material seam).
74
- // Dependency-free: the interface, error, default slot id, and in-memory backend
75
- // are safe in every (RN/browser/Node) entry graph. The Node FileKeyStore is a
76
- // separate subpath module ('@serfab/cadre-core/key-store-file') so its node:fs
77
- // import never lands here.
78
- export {
79
- InMemoryKeyStore,
80
- KeyStoreAccessError,
81
- DEFAULT_IDENTITY_KEY_ID,
82
- DEFAULT_OWNER_KEY_ID,
83
- type KeyStore,
84
- type KeyId
85
- } from './key-store.js';
86
-
87
- // The filename-safe form of an id that every Node-only per-party file store names its file
88
- // with (`<name>.<encoded party>.json`), for an embedder keeping its own file beside theirs.
89
- export { encodeFileSafeComponent } from './file-safe-name.js';
90
-
91
- // The KeyStore-backed identity rule, shared with embedding apps that need the
92
- // node key BEFORE `CadreNode` exists.
93
- export { loadOrCreateIdentityKey } from './identity-key.js';
94
-
95
- // Owner keys (`docs/architecture.md` → Owner Keys): the one interface owner signatures go
96
- // through, the key-store slot an owner key lives in apart from the identity slot, and the
97
- // text form a key is exported and imported in. Cross-platform: pure JS crypto only.
98
- export {
99
- softwareOwnerSigner,
100
- OwnerSigningDeclinedError,
101
- type OwnerSigner,
102
- type OwnerSign,
103
- type OwnerSigningRequest
104
- } from './owner-signer.js';
105
- export {
106
- createOwnerKey,
107
- loadOwnerSigner,
108
- importOwnerKey,
109
- readOwnerPrivateKey,
110
- OwnerKeySlotOccupiedError
111
- } from './owner-key-store.js';
112
- export {
113
- encodeOwnerKeyExport,
114
- decodeOwnerKeyExport,
115
- unlockOwnerKeyExport,
116
- OwnerKeyExportError,
117
- OWNER_KEY_EXPORT_PREFIX,
118
- LOCKED_OWNER_KEY_EXPORT_PREFIX,
119
- OWNER_KEY_MAX_LABEL,
120
- type OwnerKeyExportErrorCode,
121
- type OwnerKeyExportContents,
122
- type OwnerKeyExportInput,
123
- type DecodedOwnerKeyExport
124
- } from './owner-key-export.js';
125
- export {
126
- exportOwnerKey,
127
- importOwnerKeyInto,
128
- type ExportedOwnerKey,
129
- type ImportedOwnerKey,
130
- type OwnerKeyExportOptions
131
- } from './owner-key-flows.js';
132
-
133
- // Node-local trusted-owner anchor: the NON-replicated, per-party record of
134
- // out-of-band-established owner keys (the trust anchor the replicated OwnerKey
135
- // table cannot be). Cross-platform: interface + in-memory store only — the
136
- // file-backed store is the Node-only subpath
137
- // '@serfab/cadre-core/trusted-owner-store-file' (same isolation as
138
- // key-store-file) so node:fs never lands in this graph.
139
- export {
140
- MemoryTrustedOwnerStore,
141
- PersistentTrustedOwnerStore,
142
- type TrustedOwnerStore,
143
- type TrustSource
144
- } from './trusted-owner-store.js';
145
-
146
- // The one platform-specific piece of a persistent node-local store: a single
147
- // durable text slot the embedding app supplies (IndexedDB / SecureStore /
148
- // SQLite / a file). Everything else — envelope, load policy, snapshot write
149
- // chain — is cross-platform in node-local-snapshot.ts.
150
- export type { DurableSlot } from './node-local-snapshot.js';
151
-
152
- // Node-local cold-start bootstrap-peer store: the dial targets retained from an
153
- // applied seed so a node that could not connect on its first try keeps retrying
154
- // across restarts. Same cross-platform split as the trusted-owner anchor above —
155
- // interface + in-memory store here, Node-only file backend behind the subpath
156
- // '@serfab/cadre-core/bootstrap-peer-store-file'.
157
- export {
158
- MemoryBootstrapPeerStore,
159
- PersistentBootstrapPeerStore,
160
- type BootstrapPeerStore,
161
- type BootstrapPeerEntry
162
- } from './bootstrap-peer-store.js';
163
-
164
- // Node-local enrolled-machine count: the machines this party had enrolled the
165
- // last time this node looked, remembered across restarts so the CONTROL node can
166
- // declare a block-repair yardstick at bring-up — which is before the database
167
- // holding the membership rows exists. Same cross-platform split as the two
168
- // records above; Node-only file backend behind the subpath
169
- // '@serfab/cadre-core/enrolled-machine-store-file'. Its load policy deliberately
170
- // DIVERGES from theirs (an unreadable slot cold-starts rather than throwing) —
171
- // see the module comment before unifying the three.
172
- export {
173
- MemoryEnrolledMachineStore,
174
- PersistentEnrolledMachineStore,
175
- type EnrolledMachineStore
176
- } from './enrolled-machine-store.js';
177
-
178
- // Node-local record of the strands this node joined from ANOTHER party and has not yet
179
- // published party-wide, re-offered on every start as `strand:discovered`.
180
- // Cross-platform: its durable form rides the KeyStore seam above (the record carries a
181
- // closed strand's read secret), so there is no file-backed subpath.
182
- export {
183
- MemoryJoinedStrandStore,
184
- KeyStoreJoinedStrandStore,
185
- type JoinedStrandStore,
186
- type JoinedStrandRecord
187
- } from './joined-strand-store.js';
188
-
189
- // Node-local strand network state: per strand, the state Optimystic's db-p2p saves for
190
- // the strand node (its FRET routing table with each peer's signed address record), so a
191
- // restarted strand node re-imports the peers it was talking to. Same cross-platform
192
- // split as the bootstrap-peer store above — interface + in-memory + slot-backed stores
193
- // here, Node-only file backend behind '@serfab/cadre-core/strand-network-state-file'.
194
- export {
195
- MemoryStrandNetworkStateStore,
196
- PersistentStrandNetworkStateStore,
197
- strandNetworkStatePersistence,
198
- type StrandNetworkStateStore
199
- } from './strand-network-state.js';
200
- // The signed address records a running strand node's FRET table holds, as per-peer dial
201
- // addresses: what the periodic refresh re-merges into the node's address book, and a
202
- // diagnostic for "whom could this strand node redial right now?".
203
- export { strandFretPeerAddrs, type FretAddrHost, type FretPeerAddrs } from './strand-fret-addrs.js';
204
-
205
- // Storage scope keys — what `CadreNodeConfig.storage.provider` is called with. A
206
- // strand's key is its strand id; the control database's key carries the party id,
207
- // so two parties on one device never share a control store. Every key stays within
208
- // `[a-z0-9._-]` — lowercase, so distinct keys stay distinct on a case-insensitive
209
- // filesystem: the control key by lowercase hex encoding, a strand's by
210
- // `assertStrandScopeKey`, which every strand launch runs.
211
- export {
212
- controlStorageScope,
213
- isControlStorageScope,
214
- isValidStrandScopeKey,
215
- assertStrandScopeKey,
216
- InvalidStrandIdError
217
- } from './storage-scope.js';
218
-
219
- // Strand database
220
- export { StrandDatabase, type StrandDatabaseConfig, type StrandDatabaseOffline } from './strand-database.js';
221
- export type { StrandCommitDurability, StrandCommitHeld } from './strand-commit-durability.js';
222
-
223
- // Offline mode on strands (`CadreNodeConfig.strandOffline`, `CadreNode.setStrandOfflineMode`,
224
- // `StrandDatabase.offline`): a commit resolves once the transaction is queued on this machine.
225
- export {
226
- StrandOfflineUnavailableError,
227
- StrandQueueNotEmptyError,
228
- type StrandLeaveOptions,
229
- type StrandOfflineConfig,
230
- type StrandOfflineMode,
231
- type StrandOfflineQueue,
232
- type StrandOfflineListeners,
233
- type StrandOfflineStatus,
234
- type StrandQueueState
235
- } from './strand-offline.js';
236
- export {
237
- type StrandAppSchemaState,
238
- type StrandAppSchemaDeferred,
239
- type StrandAppSchemaListeners
240
- } from './strand-app-schema-report.js';
241
- // What `StrandOfflineQueue.discard` throws, so an app need not depend on Optimystic to tell them apart.
242
- export { EntryNotDiscardableError, UnknownEntryError } from '@optimystic/db-core';
243
-
244
- // Strand management
245
- export {
246
- StrandWatcher,
247
- type StrandWatcherCallbacks,
248
- type StrandQueryable,
249
- type SAppIdLookup,
250
- type StrandRowWithApp
251
- } from './strand-watcher.js';
252
- export {
253
- StrandInstanceManager,
254
- type StartStrandConfig,
255
- type ResumeStrandOverrides,
256
- getStrandStoragePath,
257
- isAwaitingFirstSync,
258
- liveStrandStatus
259
- } from './strand-instance-manager.js';
260
-
261
- // The joining machine's first-sync write gate: a non-founder launch withholds its
262
- // database (status 'syncing') until the strand's Header has arrived from a peer, so a
263
- // write before the first sync can never fork the strand's tables.
264
- export {
265
- StrandAwaitingFirstSyncError,
266
- DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS,
267
- DEFAULT_STRAND_FIRST_SYNC_BACKSTOP_MS,
268
- type StrandFirstSyncConfig
269
- } from './strand-first-sync-gate.js';
270
-
271
- // Peer-join block catch-up (push this network's own blocks to each newly
272
- // connected peer, so a late joiner physically holds pre-join blocks). Shared
273
- // by the strand networks (ungated) and the control network (membership-gated).
274
- export {
275
- PeerJoinBackfill,
276
- DEFAULT_PEER_JOIN_BACKFILL,
277
- PEER_JOIN_BACKFILL_WARN_AFTER_FAILURES,
278
- type PeerJoinBackfillConfig,
279
- type PeerJoinBackfillDeps,
280
- type PeerJoinBackfillResult,
281
- type PeerJoinBackfillPushClient
282
- } from './peer-join-backfill.js';
283
-
284
- // Operator opt-in to Optimystic change notifications on chosen strand nodes
285
- // (`CadreNodeConfig.strandReactivity`).
286
- export { strandCohortTopicOption, type StrandReactivityConfig } from './strand-reactivity.js';
287
-
288
- // Closed-strand revoked-peer enforcement (deny the network nodes of removed
289
- // members at the stream and connection layers, and hang up the sessions they
290
- // already hold — see the module doc for the settled deny-list design, the
291
- // teardown seam, and the fail directions).
292
- export {
293
- StrandRevocationEnforcer,
294
- createRevocationConnectionGater,
295
- readStrandRevocationRows,
296
- DEFAULT_REVOCATION_BACKSTOP_MS,
297
- REVOCATION_REFRESH_RETRY_MS,
298
- REVOCATION_WIDE_STRAND_REFRESH_MS,
299
- type StrandRevocationEnforcementConfig,
300
- type StrandRevocationEnforcerDeps,
301
- type StrandRevocationRows,
302
- type StrandMemberPeerBinding,
303
- type StrandRevocationJudge,
304
- type StrandRevocationNetwork
305
- } from './strand-revocation-enforcer.js';
306
-
307
- // Closed-strand membership reconciliation: the bring-up loop that finishes a
308
- // party's join on every machine — redeem the staged formation invitation, then
309
- // write the durable machine→party MemberPeer binding — without ever blocking
310
- // bring-up (see the module doc for the pass ladder and terminal states).
311
- export {
312
- StrandMembershipReconciler,
313
- DEFAULT_MEMBERSHIP_RECONCILE_INTERVAL_MS,
314
- IDLE_PASSES_BEFORE_ESCALATION,
315
- INITIAL_JOIN_RETRY_INTERVAL_MS,
316
- type StrandMembershipReconcilerDeps,
317
- type StrandMembershipReconciliationConfig,
318
- type PendingMembershipInviteSource
319
- } from './strand-membership-reconciler.js';
320
-
321
- // The timer seam the self-rescheduling loops share (membership retry ladder, the table
322
- // change schedule the first-sync gate probes on) — injected by tests as a hand-cranked clock.
323
- export { defaultTimeoutScheduler, type TimeoutScheduler } from './timeout-scheduler.js';
324
-
325
- // Hibernation
326
- export {
327
- HibernationManager,
328
- type HibernationCallbacks
329
- } from './hibernation-manager.js';
330
-
331
- // Arachnode (stub)
332
- export {
333
- ArachnodeStub,
334
- createArachnodeStub,
335
- type RingConfig
336
- } from './arachnode-stub.js';
337
-
338
- // Enrollment
339
- export {
340
- EnrollmentService,
341
- type MemberVerifier,
342
- type MemberRegistry
343
- } from './enrollment.js';
344
-
345
- // Strand Solicitation
346
- export {
347
- StrandSolicitationService,
348
- createDefaultFormationResponseValidator,
349
- type DisclosureValidator,
350
- type FormationUsageRecorder,
351
- type FormationUsageParams,
352
- type AuthorizedFormationUsage,
353
- type BoundHostStrand,
354
- type ResolvedHostStrand,
355
- type StrandProvisioner,
356
- type FormationResponseValidator,
357
- type StrandSolicitationServiceOptions
358
- } from './strand-solicitation.js';
359
-
360
- // Formation approval client: asks an invite's ValidationUrl hook whether ONE redemption
361
- // may proceed, and checks the answer against the bytes the control database will verify.
362
- export {
363
- createHttpFormationApprover,
364
- signFormationApproval,
365
- verifyFormationApproval,
366
- FormationApprovalError,
367
- type FormationApprovalRequest,
368
- type FormationVouchFields,
369
- type FormationApproval,
370
- type FormationApprover,
371
- type FormationApprovalFailure
372
- } from './formation-approval.js';
373
-
374
- // DB-backed FormationUsageRecorder (reads/writes the real CadreControl tables)
375
- export { ControlFormationUsageRecorder } from './control-formation-recorder.js';
376
-
377
- // Closed-strand member key generation (ed25519 protobuf, base64) + the
378
- // protobuf->base64url bridge that derives the founding Member/Manager key.
379
- export { generateStrandMemberKey, strandMemberKeyPair } from './strand-member-key.js';
380
-
381
- // Strand membership writer (founder bootstrap, invite issuance/consumption,
382
- // manager-admit, member-peer registration, manager rotation, sealing — the sole
383
- // manager permanently freezing admission — + shared signing primitives reused
384
- // across the flows).
385
- export {
386
- signStrandPayload,
387
- verifyStrandPayload,
388
- signStrandApproval,
389
- generateStrandStampId,
390
- bootstrapFounderMembership,
391
- PreSplitStrandIdentityError,
392
- issueInvite,
393
- consumeInvite,
394
- burnInvite,
395
- isStrandMember,
396
- cancelInvite,
397
- listOutstandingInvites,
398
- addMemberByManager,
399
- revokeMember,
400
- leaveStrand,
401
- registerMemberPeer,
402
- listMemberPeers,
403
- removeMemberPeer,
404
- addManager,
405
- admitManager,
406
- removeManager,
407
- sealStrand,
408
- isStrandSealed,
409
- StrandTransactionBusyError,
410
- StrandOfflineQueueBusyError,
411
- STRAND_ENGINE,
412
- STRAND_ENGINE_VERSION,
413
- type FounderBootstrapParams,
414
- type IssueInviteParams,
415
- type IssuedInvite,
416
- type ConsumeInviteParams,
417
- type CancelInviteParams,
418
- type OutstandingInvite,
419
- type AddMemberByManagerParams,
420
- type RevokeMemberParams,
421
- type LeaveStrandParams,
422
- type RegisterMemberPeerParams,
423
- type RemoveOwnPeerParams,
424
- type RemoveMemberPeerByManagerParams,
425
- type RemoveMemberPeerParams,
426
- type AddManagerParams,
427
- type AdmitManagerParams,
428
- type RemoveManagerParams,
429
- type SealStrandParams,
430
- type StrandWriteOptions
431
- } from './strand-membership-writer.js';
432
-
433
- // Engine-canonical datetime helper (shared by control + strand signed-write flows
434
- // so a signed timestamp byte-matches the datetime-coerced column the CHECK sees).
435
- export { canonicalDatetime } from './canonical-datetime.js';
436
-
437
- // Strand-DB-backed EnrollmentService backing: concrete MemberRegistry +
438
- // MemberVerifier that write/read the real Strand.* membership tables.
439
- export {
440
- StrandMemberRegistry,
441
- StrandMemberVerifier,
442
- memberRegistrationPayload,
443
- type StrandAdmission
444
- } from './strand-member-registry.js';
445
-
446
- // Seed Bootstrap
447
- export {
448
- SeedBootstrapService,
449
- SEED_PROTOCOL,
450
- mergeSeedPeers,
451
- seedDialTargets,
452
- seedDigest,
453
- type SeedBootstrapConfig,
454
- type SeedEventCallbacks
455
- } from './seed-bootstrap.js';
456
-
457
- // Peer Authorization (shared owner-signature digest + offline verifier)
458
- export {
459
- peerAuthorizationDigest,
460
- cadrePeerVoucherDigest,
461
- cadrePeerRemoveDigest,
462
- deviceTokenAddDigest,
463
- deviceTokenRemoveDigest,
464
- formationConsentDigest,
465
- cadreInviteAddDigest,
466
- cadreInviteRedeemDigest,
467
- cadreInviteConsentDigest,
468
- ownerKeyAddDigest,
469
- verifyPeerAuthorization,
470
- verifyCadrePeerVoucher,
471
- verifyOwnerKeyVoucher,
472
- verifyRevocationSigner,
473
- verifyFormationConsent,
474
- verifyInvitationAdmission,
475
- verifyCadreInviteRow,
476
- verifyCadreInviteRedemption,
477
- ownerGrantAddDigest,
478
- ownerGrantRedeemDigest,
479
- ownerGrantConsentDigest,
480
- verifyOwnerGrantRow,
481
- verifyOwnerGrantRedemption,
482
- verifyOwnerGrantAdmission,
483
- type DeviceTokenAuthorizedRow
484
- } from './peer-authorization.js';
485
-
486
- // How the trusted-owner anchor follows the replicated OwnerKey table along verifiable
487
- // chains: the pure derivation rule `CadreNode.syncOwnerAnchor` applies on every membership
488
- // refresh (owner-anchor-sync.ts).
489
- export { deriveOwnerAnchor, type OwnerAnchorInputs, type OwnerAnchorDerivation } from './owner-anchor-sync.js';
490
-
491
- // Strand Wake (control-network push-wake protocol)
492
- export {
493
- StrandWakeService,
494
- dialWake,
495
- WAKE_PROTOCOL,
496
- DEFAULT_WAKE_DIAL_BUDGET_MS,
497
- type StrandWakeServiceOptions,
498
- type DialWakeOptions
499
- } from './strand-wake-protocol.js';
500
-
501
- // Strand Address (control-network strand-address RPC) — wire types come via
502
- // `export * from './types.js'` (StrandAddrRequest / StrandAddrResponse / StrandAddrStatus).
503
- export {
504
- StrandAddrService,
505
- collectStrandAddrs,
506
- STRAND_ADDR_PROTOCOL,
507
- type StrandAddrServiceOptions,
508
- type StrandAddrPeer,
509
- type CollectStrandAddrsOptions,
510
- type StrandAddrOutcome,
511
- type StrandAddrCollection
512
- } from './strand-addr-protocol.js';
513
-
514
- // Peer-address record (self-published, signed, freshness-stamped CadrePeer row)
515
- export {
516
- peerRecordSignedPayload,
517
- signPeerRecord,
518
- verifyPeerRecordSignature,
519
- isPeerRecordFresh,
520
- isSignalingAddr,
521
- orderSignalingFirst,
522
- currentMemberTrustPolicy,
523
- DEFAULT_PEER_RECORD_MAX_AGE_MS,
524
- DEFAULT_PEER_RECORD_HEARTBEAT_MS
525
- } from './peer-record.js';
526
-
527
- // Device-token record (self-published, signed FCM/APNs push token — CadrePeer sibling)
528
- export {
529
- deviceTokenSignedPayload,
530
- signDeviceTokenRecord,
531
- verifyDeviceTokenSignature,
532
- isPushPlatform
533
- } from './device-token.js';
534
-
535
- // Strand-wake payload contract (canonical; shared by the server sender + RN receiver)
536
- export { STRAND_WAKE_TYPE, type StrandWakePayload } from './strand-wake-payload.js';
537
-
538
- // Platform push delivery — the cross-platform `PushNotifier` *contract* only.
539
- // The FCM/APNs implementations (node:http2/node:crypto) and the
540
- // `createPushNotifier` router that builds them live behind the Node-only subpath
541
- // `@serfab/cadre-core/push-node` (`push-node.ts`), never in this graph. A Node
542
- // host constructs a notifier from that subpath and injects the instance into
543
- // `CadreNodeConfig.push.notifier`. These re-exports are type-only (erased at
544
- // emit), so the RN/browser entry graph never pulls the Node modules in.
545
- export type { PushNotifier, PushMessage, PushSendResult } from './push-notifier.js';
546
-
547
- // Push-credential validation + log redaction. Dependency-free (type-only imports),
548
- // so a provisioner (cadre-host / cadre-provider) can reject a partial credential
549
- // set and produce a key-safe log view without pulling the FCM/APNs sender graph.
550
- export { validatePushCredentials, redactPushCredentials, REDACTED } from './push-credentials.js';
551
-
552
- // Server-side push-wake trigger policy + fan-out (who/when to wake). Cross-platform
553
- // clean — it imports only the PushNotifier *type*, so exporting it as a runtime
554
- // value pulls no node:http2/node:crypto edge into the RN/browser graph.
555
- export {
556
- PushFanoutService,
557
- DEFAULT_PUSH_COOLDOWN_MS,
558
- DEFAULT_PUSH_DEBOUNCE_MS,
559
- type PushFanoutOptions,
560
- type FanoutMember
561
- } from './push-fanout.js';
562
-
563
- // Control-cohort dial selection (backbone-preferential, bounded out-degree) +
564
- // the backstop, redial and degree defaults the proactive reconcile routine reads.
565
- export {
566
- selectControlCohortDials,
567
- DEFAULT_CONTROL_COHORT_RECONCILE_MS,
568
- DEFAULT_CONTROL_COHORT_TARGET_DEGREE,
569
- CONTROL_COHORT_REDIAL_MS,
570
- type ControlCohortSelection,
571
- type ControlCohortReconcileResult
572
- } from './control-cohort.js';
573
-
574
- // Dialing one peer from several candidate addresses, each under its own time
575
- // limit, so an address that never answers cannot starve the rest. Each address is
576
- // bound to the peer expected and dialed outside libp2p's dial queue (`dialAddr`),
577
- // so another dial of the same peer in flight cannot capture the attempt.
578
- export {
579
- dialAddr,
580
- withTrailingPeerId,
581
- dialPeerAddrs,
582
- SelfRelayOnlyError,
583
- PeerUnreachableError,
584
- tryAddrsInTurn,
585
- directBeforeRelayed,
586
- DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS,
587
- DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS,
588
- CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS,
589
- DEFAULT_PEER_DIAL_BUDGET,
590
- type PeerDialBudget,
591
- type AddrDialer
592
- } from './peer-dial.js';
593
-
594
- // Dial and reservation budgets counted in link round trips rather than fixed milliseconds, so
595
- // one declared assumption about the link moves them all — see `NetworkConfig.linkRoundTripMs`.
596
- export {
597
- DECLARED_LINK_ROUND_TRIP_MS,
598
- CIRCUIT_DIAL_ROUND_TRIPS,
599
- RELAY_DIAL_ROUND_TRIPS,
600
- RELAYED_DIAL_ROUND_TRIPS,
601
- RELAY_RESERVATION_ROUND_TRIPS,
602
- CIRCUIT_REQUEST_ROUND_TRIPS,
603
- RELAYED_REQUEST_ROUND_TRIPS,
604
- PUSH_TRANSFER_ALLOWANCE_MS,
605
- ADMISSION_DECISION_TIMEOUT_MS,
606
- resolveLinkRoundTripMs,
607
- relayedDialBudgetMs,
608
- relayReservationBudgetMs,
609
- circuitRequestBudgetMs,
610
- relayedRequestBudgetMs,
611
- peerJoinPushBudget,
612
- type PeerJoinPushBudget,
613
- DIAL_ADMISSION_DECISIONS,
614
- optimysticDialLimits,
615
- type OptimysticDialLimits
616
- } from './link-budget.js';
617
-
618
- // Seed trust policy (trust anchor for incoming seeds)
619
- export {
620
- anchoredTrustPolicy,
621
- pinnedKeyTrustPolicy,
622
- tofuTrustPolicy,
623
- claimSecretTrustPolicy,
624
- type SeedTrustPolicy,
625
- type SeedTrustContext,
626
- type SeedTrustDecision,
627
- type ClaimSecretTrustPolicyOptions
628
- } from './seed-trust-policy.js';
629
-
630
- // Claim proof: how a brand-new node's first seed proves its sender holds the node's
631
- // one-time claim secret. The owner side builds the proof over `seedDigest` (exported
632
- // with the seed bootstrap above); `claimSecretTrustPolicy` verifies it.
633
- // `ClaimRefusedError` is what `CadreNode.claimNode` throws when the node said no;
634
- // `PeerUnreachableError` (exported with the peer dial above) when it was never reached.
635
- export {
636
- parseClaimSecret,
637
- claimProof,
638
- verifyClaimProof,
639
- ClaimRefusedError,
640
- CLAIM_SECRET_BYTES
641
- } from './claim-proof.js';
642
-
643
- // The claim payload: the node's peer id, addresses and claim secret as the text a host
644
- // shows as a QR code and a phone scans (`CadreNode.claimNode` takes the decoded form).
645
- export {
646
- encodeNodeClaimPayload,
647
- decodeNodeClaimPayload,
648
- selectNodeClaimAddresses,
649
- withClaimDestination,
650
- destinationPeerIdOf,
651
- classifyDialAddress,
652
- NODE_CLAIM_PAYLOAD_PREFIX,
653
- type NodeClaimPayload,
654
- type NodeClaimAddressOptions,
655
- type DialAddressKind
656
- } from './node-claim-payload.js';
657
-
658
- // Moving a party's strands into another party of the same owner, so an app's strands follow
659
- // the app into the user's main cadre: the bundle one node exports from the party it leaves,
660
- // its adoption by a node of the party it joined, and the check that the party it left holds
661
- // nothing the joined one lacks before it is dissolved.
662
- export {
663
- exportStrandBundle,
664
- adoptStrandBundle,
665
- readStrandHoldings,
666
- unheldBundleContent,
667
- StrandMoveNotOwnerError,
668
- StrandMoveSamePartyError,
669
- type StrandHoldings,
670
- type StrandBundle,
671
- type StrandBundleEntry,
672
- type FormationInviteEntry,
673
- type StrandMoveReport,
674
- type StrandMoveFailure
675
- } from './strand-move.js';
676
-
677
- // The join request: what an app that wants to join a cadre copies to the app that manages it,
678
- // which mints an invitation targeted at the request's peer id. Both paste-text prefixes live here.
679
- export {
680
- encodeCadreJoinRequest,
681
- decodeCadreJoinRequest,
682
- requireCadreJoinReply,
683
- CADRE_JOIN_REQUEST_PREFIX,
684
- CADRE_INVITATION_PREFIX,
685
- OWNER_KEY_EXPORT_STEM,
686
- OWNER_GRANT_PREFIX,
687
- CADRE_JOIN_REQUEST_MAX_APP_NAME,
688
- type CadreJoinReply,
689
- type CadreJoinRequest
690
- } from './cadre-join-request.js';
691
-
692
- // Renting a node from a hosting provider: the provider's descriptor, the app's side of the
693
- // OAuth 2 + PKCE sign-in, the typed client for its container API, and `rentNode` /
694
- // `finishRental`, which add the rented container to this node's cadre by invitation or by
695
- // claim. Global `fetch` and `crypto.getRandomValues` only, so the whole set loads on React
696
- // Native and in the browser (`docs/architecture.md` → "Renting a node from an app"). The
697
- // barrel is the curated list; it is not repeated here.
698
- export * from './provider/index.js';
699
-
700
- // Schema Verification
701
- export {
702
- signSchema,
703
- verifySchema,
704
- assertSchemaSignature,
705
- SchemaVerificationError
706
- } from './schema-verification.js';
707
-
708
- // Strand Formation transport (native cadre-core protocol)
709
- export {
710
- FormationListener,
711
- dialFormation,
712
- dialFormationByMachine,
713
- isValidResponderCreatesResult,
714
- isWellFormedMembershipInvite,
715
- sanitizeStrandAddrs,
716
- FORMATION_PROTOCOL,
717
- type FormationParty,
718
- type FormationContactMessage,
719
- type FormationResultMessage,
720
- type FormationProvisionResult,
721
- type FormationStrandInfo,
722
- type FormationDbConnectionInfo,
723
- type FormationListenerOptions,
724
- type FormationDialOptions,
725
- type FormationDialResult,
726
- type FormationRejection,
727
- type ResponderProvisionOutcome
728
- } from './strand-formation-protocol.js';
729
- // A responder session's one read of its formation token, and the check made from it
730
- export {
731
- classifyTokenRead,
732
- isTokenReadSpent,
733
- type FormationInviteFacts,
734
- type FormationTokenRead,
735
- type FormationTokenCheck
736
- } from './formation-token.js';
737
- // How a formation dial fails: a typed refusal (with a fixed code) or no answer at all
738
- export {
739
- FormationRejectedError,
740
- FormationUnreachableError,
741
- FormationPostApprovalError,
742
- FORMATION_REJECTION_RETRYABLE,
743
- isFormationRejectionCode,
744
- type FormationRejectionCode
745
- } from './strand-formation-rejection.js';
746
- export { formationDeadlines, type FormationDeadlines } from './strand-formation-deadlines.js';
747
- // Cadre invitation redemption transport: the bundle an owner hands out, the wire messages, the
748
- // member-side handler and the device-side dialer, and how a redemption fails
749
- export {
750
- CadreInviteHandler,
751
- redeemAtMembers,
752
- redeemInPasses,
753
- signRedeemRequest,
754
- verifyRedeemReply,
755
- encodeCadreInvitation,
756
- decodeCadreInvitation,
757
- isWellFormedCadreInviteRow,
758
- sanitizeAddrs,
759
- CadreInviteRejectedError,
760
- CadreInviteUnreachableError,
761
- CadreInviteReplyInvalidError,
762
- CADRE_INVITE_PROTOCOL,
763
- CADRE_INVITE_REJECTION_RETRYABLE,
764
- isCadreInviteRejectionCode,
765
- type CadreInvitation,
766
- type CadreInviteRedeemRequest,
767
- type CadreInviteRedeemReply,
768
- type CadreInviteAccepted,
769
- type CadreInviteRejectionCode,
770
- type CadreInviteAddressOutcome,
771
- type CadreInviteHandlerOptions,
772
- type CadreInviteStore,
773
- type RedeemAtMembersOptions,
774
- type RedeemInPassesOptions,
775
- type RedeemSigner,
776
- type RedeemSelfRecord,
777
- type CadreInviteRedemption
778
- } from './cadre-invite-protocol.js';
779
- // Owner grant redemption transport: the bundle an owner hands out, the wire messages, the
780
- // member-side handler and the holder-side dialer, and how a redemption fails
781
- export {
782
- OwnerGrantHandler,
783
- redeemOwnerGrantAtMembers,
784
- redeemOwnerGrantInPasses,
785
- signOwnerGrantRequest,
786
- verifyOwnerGrantReply,
787
- encodeOwnerGrant,
788
- decodeOwnerGrant,
789
- isWellFormedOwnerGrantRow,
790
- OwnerGrantRejectedError,
791
- OwnerGrantUnreachableError,
792
- OwnerGrantReplyInvalidError,
793
- OWNER_GRANT_PROTOCOL,
794
- OWNER_GRANT_REJECTION_RETRYABLE,
795
- isOwnerGrantRejectionCode,
796
- type OwnerGrantBundle,
797
- type OwnerGrantRedeemRequest,
798
- type OwnerGrantRedeemReply,
799
- type OwnerGrantAccepted,
800
- type OwnerGrantRejectionCode,
801
- type OwnerGrantHandlerOptions,
802
- type OwnerGrantStore,
803
- type RedeemOwnerGrantAtMembersOptions,
804
- type RedeemOwnerGrantInPassesOptions,
805
- type OwnerGrantRedemption
806
- } from './owner-grant-protocol.js';
807
- // The exchange shape both redemption protocols are built on
808
- export {
809
- MemberRedemptionHandler,
810
- dialRedemption,
811
- dialRedemptionInPasses,
812
- MAX_REDEMPTION_FRAME_BYTES,
813
- type MemberRedemptionHandlerOptions,
814
- type MemberRedemptionOptions,
815
- type MemberRedemptionPassOptions,
816
- type MemberRedemption,
817
- type RedemptionAddressOutcome,
818
- type RedemptionRejection,
819
- type RedemptionRefusalFrame
820
- } from './member-redemption.js';
821
- // Which machines, and how many addresses of each, an invitation names; how far a cadre invitation reaches
822
- export {
823
- selectCadreInvitationMembers,
824
- cadreInvitationReach,
825
- CADRE_INVITATION_MAX_ADDRS,
826
- CADRE_INVITATION_ADDRS_PER_SIBLING
827
- } from './invitation-bootstrap.js';
828
- // The pending-join retry loop behind CadreNode.requestJoin (PendingJoinStatus is in types.ts)
829
- export { PENDING_JOIN_BACKSTOP_MS, PENDING_JOIN_MAX_BACKOFF_MS, MAX_PENDING_JOIN_MS } from './pending-join-runner.js';
830
-
831
- // Strand Formation manager (drives the native transport)
832
- export {
833
- StrandFormationManager,
834
- createStrandFormationManager,
835
- MEMBERSHIP_INVITE_TTL_MS,
836
- MEMBERSHIP_INVITE_UNAVAILABLE_REASON,
837
- HOST_STRAND_MUST_BE_RECREATED_REASON,
838
- type CadrePeerAddrsSource,
839
- type MembershipInviteIssuer,
840
- type StrandFormationManagerConfig,
841
- type StrandFormationManagerOptions
842
- } from './strand-formation-manager.js';
843
-
844
- // Control-network per-stream protocol guard (which peers may open which protocol)
845
- export {
846
- controlProtocolClasses,
847
- type ControlProtocolClass
848
- } from './control-protocol-guard.js';
849
-
850
- // Control-network inbound connection gate (membership defense-in-depth)
851
- export {
852
- createMembershipConnectionGater,
853
- PROVISIONAL_ADMISSION_DEADLINE_MS,
854
- PROVISIONAL_ADMISSION_CLOSE_TIMEOUT_MS,
855
- MAX_UNAUTHORIZED_RELAY_RESERVATIONS,
856
- UnauthorizedReservationBudget,
857
- type InboundAdmissionPolicy,
858
- type InboundConnectionVerdict
859
- } from './membership-connection-gater.js';
860
-
861
- // Thrown out of `CadreNode.start()` when a `network.relayAddrs` reservation does
862
- // not land on its first attempt — the fail-fast posture of that config field now
863
- // that the control node reserves AFTER control-database bring-up (relay-addrs.ts).
864
- // `UnbindableListenAddressError` is the same posture for the OTHER half of the listen
865
- // config: a `network.listenAddrs` entry whose transport the node will not have refuses
866
- // start instead of being silently dropped by libp2p's transport manager.
867
- //
868
- // `resolveListenAddrs` and `strandNodeAddrs` are the derivations themselves — what a
869
- // `NetworkConfig` actually turns into for the control node and for each strand node.
870
- // Exported so an embedder that hand-writes a `network` block (the React Native and web
871
- // reference apps) can assert on the resulting SHAPE rather than on its own field names,
872
- // which is the difference between a test that proves reachability and one that proves a
873
- // spelling.
874
- export {
875
- RelayReservationFailedError,
876
- UnbindableListenAddressError,
877
- RELAY_SEARCH_LISTEN_ADDR,
878
- resolveListenAddrs
879
- } from './relay-addrs.js';
880
- export { strandNodeAddrs, type StrandNodeAddrs } from './strand-network-config.js';
881
- // STUN for an embedder's WebRTC transport, derived from the relays it already uses: each
882
- // Sereus relay also answers STUN (`ops/docs/ice-servers.md`).
883
- export { RELAY_STUN_PORT, relayStunUrl, resolveStunServers, type StunServer } from './relay-stun.js';
884
- // The circuit-relay SERVER a node runs, and with which init — one resolution shared by the
885
- // control node and every strand node. Exported alongside the listen derivations above for the
886
- // same reason: an embedder can assert on what its `network` block resolves to.
887
- export {
888
- resolveRelayServer,
889
- PARTY_RELAY_MAX_RESERVATIONS,
890
- PARTY_RELAY_RESERVATION_TTL_MS,
891
- type ResolvedRelayServer,
892
- type ResolvedRelayReservations
893
- } from './relay-server.js';
894
-
895
- // Relay reservation via the bare `/p2p-circuit` search listener — the one route
896
- // every control node takes; `network.relayAddrs` is its fail-fast posture
897
- // (see relay-reservation.ts)
898
- export {
899
- circuitMultiaddrs,
900
- superviseRelayReservation,
901
- DEFAULT_RELAY_RESERVE_TIMEOUT_MS,
902
- DEFAULT_RELAY_RESERVE_POLL_MS,
903
- DEFAULT_RELAY_CHECK_MS,
904
- DEFAULT_RELAY_MIN_BACKOFF_MS,
905
- DEFAULT_RELAY_MAX_BACKOFF_MS,
906
- type RelayReservationStatus,
907
- type RelayReservationState,
908
- type RelayReserveOptions,
909
- type RelayReservationSupervisor,
910
- type RelayReservationSupervisorOptions
911
- } from './relay-reservation.js';
912
-
913
- // Connection-path diagnostics (relayed vs direct classification + summary)
914
- export {
915
- classifyTransport,
916
- summarizeConnectionPaths,
917
- emptyConnectionPathSummary,
918
- DEFAULT_SETTLE_WINDOW_MS,
919
- type ConnectionPathKind,
920
- type ConnectionTransport,
921
- type ConnectionPath,
922
- type ConnectionPathSummary,
923
- type ConnectionLike
924
- } from './diagnostics/connection-path.js';
1
+ // Core types
2
+ export * from './types.js';
3
+
4
+ // Canonical JSON serialization (shared signing payload format)
5
+ export { canonicalJson } from './canonical-json.js';
6
+
7
+ // Text for a caught value that may not be an Error (every package that turns one into a message
8
+ // uses this; `yarn lint` flags the `String(err)` fallback it replaces)
9
+ export { describeThrown } from './describe-thrown.js';
10
+
11
+ // Main CadreNode class
12
+ export { CadreNode, CADRE_INVITATION_DEFAULT_TTL_MS, OWNER_GRANT_DEFAULT_TTL_MS } from './cadre-node.js';
13
+
14
+ // Removing a machine from a cadre: the by-name refusal `CadreNode.removeMachine` throws
15
+ // (the listing, plan and result types are in types.ts)
16
+ export { MachineRemovalRefusedError } from './machine-removal.js';
17
+
18
+ // Adding and removing an owner key: the by-name refusals `CadreNode.addOwner` and
19
+ // `CadreNode.removeOwner` throw (the listing, plan and result types are in types.ts)
20
+ export { OwnerKeyAddRefusedError, OwnerKeyRemovalRefusedError } from './owner-keys.js';
21
+
22
+ // Control database
23
+ 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';
24
+
25
+ // The control schema version a store is migrated to on start, and what `start()` throws, with a
26
+ // reason, when the store must not be migrated (docs/architecture.md → "Control schema versions and
27
+ // migrations")
28
+ export { CONTROL_SCHEMA_VERSION, CONTROL_SCHEMA_BASELINE_VERSION, CONTROL_SCHEMA_VERSION_TAG } from './control-schema.js';
29
+ export { ControlStoreIncompatibleError, type ControlStoreIncompatibility } from './control-schema-version.js';
30
+
31
+ // Bounded retry for transient control-write failures (classifier + loop behind
32
+ // ControlDatabase.lockedWithRetry; exported so the integration package can drive the
33
+ // classifier against real engine errors)
34
+ export {
35
+ CONTROL_WRITE_ATTEMPTS,
36
+ CONTROL_WRITE_RETRY_BUDGET_MS,
37
+ LOST_UPDATE_RETRY_POLICY,
38
+ SCHEMA_INIT_ATTEMPTS,
39
+ SCHEMA_INIT_RETRY_POLICY,
40
+ isRetriableControlWriteFailure,
41
+ isRetriableLostUpdateFailure,
42
+ isRetriableSchemaInitFailure,
43
+ retryControlWrite,
44
+ type ControlWriteRetryOptions
45
+ } from './control-write-retry.js';
46
+
47
+ // Bounded retry for transient control-read failures (classifier + policy behind
48
+ // ControlDatabase.readRows; the loop is shared with the write side via control-retry.ts)
49
+ export {
50
+ CONTROL_READ_ATTEMPTS,
51
+ CONTROL_READ_RETRY_DELAYS_MS,
52
+ CONTROL_READ_RETRY_BUDGET_MS,
53
+ isRetriableControlReadFailure,
54
+ retryControlRead,
55
+ type ControlReadRetryOptions
56
+ } from './control-read-retry.js';
57
+
58
+ // The bounded retry loop both control policies share. Only the abandonment record leaves
59
+ // this package: it is the payload of the `control:write-abandoned` node event, so an
60
+ // embedding app can type a handler for it.
61
+ export type {
62
+ ControlRetryAbandonment,
63
+ ControlRetryAbandonReason,
64
+ ControlRetryAbandonListener
65
+ } from './control-retry.js';
66
+
67
+ // Control-plane authorization field vector (the domain/action tagging every signer shares)
68
+ export { controlAuthorizationFields, unboundAuthorizationFields, cadreInviteRowFields, ownerGrantRowFields, type ControlDomain, type BoundControlDomain, type UnboundControlDomain, type ControlAction, type CadreInviteSignedFields, type OwnerGrantSignedFields } from './control-authorization.js';
69
+
70
+ // Ed25519 key bridge (libp2p Ed25519 -> base64url keypair)
71
+ export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, ed25519PublicKeyB64FromPeerId, requireEd25519PublicKeyB64, requireEd25519PrivateKeyB64, type Ed25519KeyPair } from './ed25519-key.js';
72
+
73
+ // Pluggable key store (backend-agnostic identity/owner key material seam).
74
+ // Dependency-free: the interface, error, default slot id, and in-memory backend
75
+ // are safe in every (RN/browser/Node) entry graph. The Node FileKeyStore is a
76
+ // separate subpath module ('@serfab/cadre-core/key-store-file') so its node:fs
77
+ // import never lands here.
78
+ export {
79
+ InMemoryKeyStore,
80
+ KeyStoreAccessError,
81
+ DEFAULT_IDENTITY_KEY_ID,
82
+ DEFAULT_OWNER_KEY_ID,
83
+ type KeyStore,
84
+ type KeyId
85
+ } from './key-store.js';
86
+
87
+ // The filename-safe form of an id that every Node-only per-party file store names its file
88
+ // with (`<name>.<encoded party>.json`), for an embedder keeping its own file beside theirs.
89
+ export { encodeFileSafeComponent } from './file-safe-name.js';
90
+
91
+ // The KeyStore-backed identity rule, shared with embedding apps that need the
92
+ // node key BEFORE `CadreNode` exists.
93
+ export { loadOrCreateIdentityKey } from './identity-key.js';
94
+
95
+ // Owner keys (`docs/architecture.md` → Owner Keys): the one interface owner signatures go
96
+ // through, the key-store slot an owner key lives in apart from the identity slot, and the
97
+ // text form a key is exported and imported in. Cross-platform: pure JS crypto only.
98
+ export {
99
+ softwareOwnerSigner,
100
+ OwnerSigningDeclinedError,
101
+ type OwnerSigner,
102
+ type OwnerSign,
103
+ type OwnerSigningRequest
104
+ } from './owner-signer.js';
105
+ export {
106
+ createOwnerKey,
107
+ loadOwnerSigner,
108
+ importOwnerKey,
109
+ readOwnerPrivateKey,
110
+ OwnerKeySlotOccupiedError
111
+ } from './owner-key-store.js';
112
+ export {
113
+ encodeOwnerKeyExport,
114
+ decodeOwnerKeyExport,
115
+ unlockOwnerKeyExport,
116
+ OwnerKeyExportError,
117
+ OWNER_KEY_EXPORT_PREFIX,
118
+ LOCKED_OWNER_KEY_EXPORT_PREFIX,
119
+ OWNER_KEY_MAX_LABEL,
120
+ type OwnerKeyExportErrorCode,
121
+ type OwnerKeyExportContents,
122
+ type OwnerKeyExportInput,
123
+ type DecodedOwnerKeyExport
124
+ } from './owner-key-export.js';
125
+ export {
126
+ exportOwnerKey,
127
+ importOwnerKeyInto,
128
+ type ExportedOwnerKey,
129
+ type ImportedOwnerKey,
130
+ type OwnerKeyExportOptions
131
+ } from './owner-key-flows.js';
132
+
133
+ // Node-local trusted-owner anchor: the NON-replicated, per-party record of
134
+ // out-of-band-established owner keys (the trust anchor the replicated OwnerKey
135
+ // table cannot be). Cross-platform: interface + in-memory store only — the
136
+ // file-backed store is the Node-only subpath
137
+ // '@serfab/cadre-core/trusted-owner-store-file' (same isolation as
138
+ // key-store-file) so node:fs never lands in this graph.
139
+ export {
140
+ MemoryTrustedOwnerStore,
141
+ PersistentTrustedOwnerStore,
142
+ type TrustedOwnerStore,
143
+ type TrustSource
144
+ } from './trusted-owner-store.js';
145
+
146
+ // The one platform-specific piece of a persistent node-local store: a single
147
+ // durable text slot the embedding app supplies (IndexedDB / SecureStore /
148
+ // SQLite / a file). Everything else — envelope, load policy, snapshot write
149
+ // chain — is cross-platform in node-local-snapshot.ts.
150
+ export type { DurableSlot } from './node-local-snapshot.js';
151
+
152
+ // Node-local cold-start bootstrap-peer store: the dial targets retained from an
153
+ // applied seed so a node that could not connect on its first try keeps retrying
154
+ // across restarts. Same cross-platform split as the trusted-owner anchor above —
155
+ // interface + in-memory store here, Node-only file backend behind the subpath
156
+ // '@serfab/cadre-core/bootstrap-peer-store-file'.
157
+ export {
158
+ MemoryBootstrapPeerStore,
159
+ PersistentBootstrapPeerStore,
160
+ type BootstrapPeerStore,
161
+ type BootstrapPeerEntry
162
+ } from './bootstrap-peer-store.js';
163
+
164
+ // Node-local enrolled-machine count: the machines this party had enrolled the
165
+ // last time this node looked, remembered across restarts so the CONTROL node can
166
+ // declare a block-repair yardstick at bring-up — which is before the database
167
+ // holding the membership rows exists. Same cross-platform split as the two
168
+ // records above; Node-only file backend behind the subpath
169
+ // '@serfab/cadre-core/enrolled-machine-store-file'. Its load policy deliberately
170
+ // DIVERGES from theirs (an unreadable slot cold-starts rather than throwing) —
171
+ // see the module comment before unifying the three.
172
+ export {
173
+ MemoryEnrolledMachineStore,
174
+ PersistentEnrolledMachineStore,
175
+ type EnrolledMachineStore
176
+ } from './enrolled-machine-store.js';
177
+
178
+ // Node-local record of the strands this node joined from ANOTHER party and has not yet
179
+ // published party-wide, re-offered on every start as `strand:discovered`.
180
+ // Cross-platform: its durable form rides the KeyStore seam above (the record carries a
181
+ // closed strand's read secret), so there is no file-backed subpath.
182
+ export {
183
+ MemoryJoinedStrandStore,
184
+ KeyStoreJoinedStrandStore,
185
+ type JoinedStrandStore,
186
+ type JoinedStrandRecord
187
+ } from './joined-strand-store.js';
188
+
189
+ // Node-local strand network state: per strand, the state Optimystic's db-p2p saves for
190
+ // the strand node (its FRET routing table with each peer's signed address record), so a
191
+ // restarted strand node re-imports the peers it was talking to. Same cross-platform
192
+ // split as the bootstrap-peer store above — interface + in-memory + slot-backed stores
193
+ // here, Node-only file backend behind '@serfab/cadre-core/strand-network-state-file'.
194
+ export {
195
+ MemoryStrandNetworkStateStore,
196
+ PersistentStrandNetworkStateStore,
197
+ strandNetworkStatePersistence,
198
+ type StrandNetworkStateStore
199
+ } from './strand-network-state.js';
200
+ // The signed address records a running strand node's FRET table holds, as per-peer dial
201
+ // addresses: what the periodic refresh re-merges into the node's address book, and a
202
+ // diagnostic for "whom could this strand node redial right now?".
203
+ export { strandFretPeerAddrs, type FretAddrHost, type FretPeerAddrs } from './strand-fret-addrs.js';
204
+
205
+ // Storage scope keys — what `CadreNodeConfig.storage.provider` is called with. A
206
+ // strand's key is its strand id; the control database's key carries the party id,
207
+ // so two parties on one device never share a control store. Every key stays within
208
+ // `[a-z0-9._-]` — lowercase, so distinct keys stay distinct on a case-insensitive
209
+ // filesystem: the control key by lowercase hex encoding, a strand's by
210
+ // `assertStrandScopeKey`, which every strand launch runs.
211
+ export {
212
+ controlStorageScope,
213
+ isControlStorageScope,
214
+ isValidStrandScopeKey,
215
+ assertStrandScopeKey,
216
+ InvalidStrandIdError
217
+ } from './storage-scope.js';
218
+
219
+ // Strand database
220
+ export { StrandDatabase, type StrandDatabaseConfig, type StrandDatabaseOffline } from './strand-database.js';
221
+ export type { StrandCommitDurability, StrandCommitHeld } from './strand-commit-durability.js';
222
+
223
+ // Offline mode on strands (`CadreNodeConfig.strandOffline`, `CadreNode.setStrandOfflineMode`,
224
+ // `StrandDatabase.offline`): a commit resolves once the transaction is queued on this machine.
225
+ export {
226
+ StrandOfflineUnavailableError,
227
+ StrandQueueNotEmptyError,
228
+ type StrandLeaveOptions,
229
+ type StrandOfflineConfig,
230
+ type StrandOfflineMode,
231
+ type StrandOfflineQueue,
232
+ type StrandOfflineListeners,
233
+ type StrandOfflineStatus,
234
+ type StrandQueueState
235
+ } from './strand-offline.js';
236
+ export {
237
+ type StrandAppSchemaState,
238
+ type StrandAppSchemaDeferred,
239
+ type StrandAppSchemaListeners
240
+ } from './strand-app-schema-report.js';
241
+ // What a rejected `addStrand` and `strand:error` carry when the app's schema can never apply to the
242
+ // strand's tables, so an app need not depend on the plugin to recognise it.
243
+ export { AppSchemaRefusedError, appSchemaRefusalOf } from '@serfab/quereus-plugin-sereus';
244
+ // What `StrandOfflineQueue.discard` throws, so an app need not depend on Optimystic to tell them apart.
245
+ export { EntryNotDiscardableError, UnknownEntryError } from '@optimystic/db-core';
246
+
247
+ // Strand management
248
+ export {
249
+ StrandWatcher,
250
+ type StrandWatcherCallbacks,
251
+ type StrandQueryable,
252
+ type SAppIdLookup,
253
+ type StrandRowWithApp
254
+ } from './strand-watcher.js';
255
+ export {
256
+ StrandInstanceManager,
257
+ type StartStrandConfig,
258
+ type ResumeStrandOverrides,
259
+ getStrandStoragePath,
260
+ isAwaitingFirstSync,
261
+ liveStrandStatus
262
+ } from './strand-instance-manager.js';
263
+
264
+ // The joining machine's first-sync write gate: a non-founder launch withholds its
265
+ // database (status 'syncing') until the strand's Header has arrived from a peer, so a
266
+ // write before the first sync can never fork the strand's tables.
267
+ export {
268
+ StrandAwaitingFirstSyncError,
269
+ DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS,
270
+ DEFAULT_STRAND_FIRST_SYNC_BACKSTOP_MS,
271
+ type StrandFirstSyncConfig
272
+ } from './strand-first-sync-gate.js';
273
+
274
+ // Peer-join block catch-up (push this network's own blocks to each newly
275
+ // connected peer, so a late joiner physically holds pre-join blocks). Shared
276
+ // by the strand networks (ungated) and the control network (membership-gated).
277
+ export {
278
+ PeerJoinBackfill,
279
+ DEFAULT_PEER_JOIN_BACKFILL,
280
+ PEER_JOIN_BACKFILL_WARN_AFTER_FAILURES,
281
+ type PeerJoinBackfillConfig,
282
+ type PeerJoinBackfillDeps,
283
+ type PeerJoinBackfillResult,
284
+ type PeerJoinBackfillPushClient
285
+ } from './peer-join-backfill.js';
286
+
287
+ // Operator opt-in to Optimystic change notifications on chosen strand nodes
288
+ // (`CadreNodeConfig.strandReactivity`).
289
+ export { strandCohortTopicOption, type StrandReactivityConfig } from './strand-reactivity.js';
290
+
291
+ // Closed-strand revoked-peer enforcement (deny the network nodes of removed
292
+ // members at the stream and connection layers, and hang up the sessions they
293
+ // already hold — see the module doc for the settled deny-list design, the
294
+ // teardown seam, and the fail directions).
295
+ export {
296
+ StrandRevocationEnforcer,
297
+ createRevocationConnectionGater,
298
+ readStrandRevocationRows,
299
+ DEFAULT_REVOCATION_BACKSTOP_MS,
300
+ REVOCATION_REFRESH_RETRY_MS,
301
+ REVOCATION_WIDE_STRAND_REFRESH_MS,
302
+ type StrandRevocationEnforcementConfig,
303
+ type StrandRevocationEnforcerDeps,
304
+ type StrandRevocationRows,
305
+ type StrandMemberPeerBinding,
306
+ type StrandRevocationJudge,
307
+ type StrandRevocationNetwork
308
+ } from './strand-revocation-enforcer.js';
309
+
310
+ // Closed-strand membership reconciliation: the bring-up loop that finishes a
311
+ // party's join on every machine — redeem the staged formation invitation, then
312
+ // write the durable machine→party MemberPeer binding — without ever blocking
313
+ // bring-up (see the module doc for the pass ladder and terminal states).
314
+ export {
315
+ StrandMembershipReconciler,
316
+ DEFAULT_MEMBERSHIP_RECONCILE_INTERVAL_MS,
317
+ IDLE_PASSES_BEFORE_ESCALATION,
318
+ INITIAL_JOIN_RETRY_INTERVAL_MS,
319
+ type StrandMembershipReconcilerDeps,
320
+ type StrandMembershipReconciliationConfig,
321
+ type PendingMembershipInviteSource
322
+ } from './strand-membership-reconciler.js';
323
+
324
+ // The party's machines as one strand sees them: the control-database seam the reconciler binds
325
+ // the party's other machines through and the offline queue waits for them through, and its
326
+ // pure projection.
327
+ export {
328
+ partitionPartyStrandPeers,
329
+ type PartyStrandPeer,
330
+ type PartyStrandPeers,
331
+ type PartyStrandPeerSource,
332
+ type PendingPartyKeyState
333
+ } from './strand-party-peers.js';
334
+
335
+ // The driver that moves a party onto a fresh membership key in a closed strand after a machine
336
+ // removal, and the seams `CadreNode` hands it.
337
+ export {
338
+ StrandPartyKeyRotationDriver,
339
+ type OpenedPendingPartyKey,
340
+ type StrandPartyKeyRotationDeps,
341
+ type StrandPartyKeySwapEntry
342
+ } from './strand-party-key-rotation.js';
343
+
344
+ // The envelope a `PendingStrandPartyKey` row carries its key in, sealed to the machines that remain.
345
+ export {
346
+ sealPartyKey,
347
+ openPartyKey,
348
+ partyKeyRecipients,
349
+ type PartyKeyRecipient,
350
+ type PartyKeyOpener
351
+ } from './sealed-party-key.js';
352
+
353
+ // The timer seam the self-rescheduling loops share (membership retry ladder, the table
354
+ // change schedule the first-sync gate probes on) — injected by tests as a hand-cranked clock.
355
+ export { defaultTimeoutScheduler, type TimeoutScheduler } from './timeout-scheduler.js';
356
+
357
+ // Hibernation
358
+ export {
359
+ HibernationManager,
360
+ type HibernationCallbacks
361
+ } from './hibernation-manager.js';
362
+
363
+ // Arachnode (stub)
364
+ export {
365
+ ArachnodeStub,
366
+ createArachnodeStub,
367
+ type RingConfig
368
+ } from './arachnode-stub.js';
369
+
370
+ // Enrollment
371
+ export {
372
+ EnrollmentService,
373
+ type MemberVerifier,
374
+ type MemberRegistry
375
+ } from './enrollment.js';
376
+
377
+ // Strand Solicitation
378
+ export {
379
+ StrandSolicitationService,
380
+ createDefaultFormationResponseValidator,
381
+ type DisclosureValidator,
382
+ type FormationUsageRecorder,
383
+ type FormationUsageParams,
384
+ type AuthorizedFormationUsage,
385
+ type BoundHostStrand,
386
+ type ResolvedHostStrand,
387
+ type StrandProvisioner,
388
+ type FormationResponseValidator,
389
+ type StrandSolicitationServiceOptions
390
+ } from './strand-solicitation.js';
391
+
392
+ // Formation approval client: asks an invite's ValidationUrl hook whether ONE redemption
393
+ // may proceed, and checks the answer against the bytes the control database will verify.
394
+ export {
395
+ createHttpFormationApprover,
396
+ signFormationApproval,
397
+ verifyFormationApproval,
398
+ FormationApprovalError,
399
+ type FormationApprovalRequest,
400
+ type FormationVouchFields,
401
+ type FormationApproval,
402
+ type FormationApprover,
403
+ type FormationApprovalFailure
404
+ } from './formation-approval.js';
405
+
406
+ // DB-backed FormationUsageRecorder (reads/writes the real CadreControl tables)
407
+ export { ControlFormationUsageRecorder } from './control-formation-recorder.js';
408
+
409
+ // Closed-strand member key generation (ed25519 protobuf, base64) + the
410
+ // protobuf->base64url bridge that derives the founding Member/Manager key.
411
+ export { generateStrandMemberKey, strandMemberKeyPair } from './strand-member-key.js';
412
+
413
+ // Strand membership writer (founder bootstrap, invite issuance/consumption,
414
+ // manager-admit, member-peer registration, manager rotation, sealing — the sole
415
+ // manager permanently freezing admission — + shared signing primitives reused
416
+ // across the flows).
417
+ export {
418
+ signStrandPayload,
419
+ verifyStrandPayload,
420
+ signStrandApproval,
421
+ generateStrandStampId,
422
+ bootstrapFounderMembership,
423
+ PreSplitStrandIdentityError,
424
+ issueInvite,
425
+ consumeInvite,
426
+ burnInvite,
427
+ isStrandMember,
428
+ isStrandManager,
429
+ cancelInvite,
430
+ listOutstandingInvites,
431
+ addMemberByManager,
432
+ revokeMember,
433
+ leaveStrand,
434
+ registerMemberPeer,
435
+ listMemberPeers,
436
+ removeMemberPeer,
437
+ addManager,
438
+ admitManager,
439
+ removeManager,
440
+ sealStrand,
441
+ isStrandSealed,
442
+ StrandTransactionBusyError,
443
+ StrandOfflineQueueBusyError,
444
+ STRAND_ENGINE,
445
+ STRAND_ENGINE_VERSION,
446
+ type FounderBootstrapParams,
447
+ type IssueInviteParams,
448
+ type IssuedInvite,
449
+ type ConsumeInviteParams,
450
+ type CancelInviteParams,
451
+ type OutstandingInvite,
452
+ type AddMemberByManagerParams,
453
+ type RevokeMemberParams,
454
+ type LeaveStrandParams,
455
+ type RegisterMemberPeerParams,
456
+ type RemoveOwnPeerParams,
457
+ type RemoveMemberPeerByManagerParams,
458
+ type RemoveMemberPeerParams,
459
+ type AddManagerParams,
460
+ type AdmitManagerParams,
461
+ type RemoveManagerParams,
462
+ type SealStrandParams,
463
+ type StrandWriteOptions
464
+ } from './strand-membership-writer.js';
465
+
466
+ // Engine-canonical datetime helper (shared by control + strand signed-write flows
467
+ // so a signed timestamp byte-matches the datetime-coerced column the CHECK sees).
468
+ export { canonicalDatetime } from './canonical-datetime.js';
469
+
470
+ // Strand-DB-backed EnrollmentService backing: concrete MemberRegistry +
471
+ // MemberVerifier that write/read the real Strand.* membership tables.
472
+ export {
473
+ StrandMemberRegistry,
474
+ StrandMemberVerifier,
475
+ memberRegistrationPayload,
476
+ type StrandAdmission
477
+ } from './strand-member-registry.js';
478
+
479
+ // Seed Bootstrap
480
+ export {
481
+ SeedBootstrapService,
482
+ SEED_PROTOCOL,
483
+ mergeSeedPeers,
484
+ seedDialTargets,
485
+ seedDigest,
486
+ type SeedBootstrapConfig,
487
+ type SeedEventCallbacks
488
+ } from './seed-bootstrap.js';
489
+
490
+ // Peer Authorization (shared owner-signature digest + offline verifier)
491
+ export {
492
+ peerAuthorizationDigest,
493
+ cadrePeerVoucherDigest,
494
+ cadrePeerRemoveDigest,
495
+ deviceTokenAddDigest,
496
+ deviceTokenRemoveDigest,
497
+ formationConsentDigest,
498
+ cadreInviteAddDigest,
499
+ cadreInviteRedeemDigest,
500
+ cadreInviteConsentDigest,
501
+ ownerKeyAddDigest,
502
+ verifyPeerAuthorization,
503
+ verifyCadrePeerVoucher,
504
+ verifyOwnerKeyVoucher,
505
+ verifyRevocationSigner,
506
+ verifyFormationConsent,
507
+ verifyInvitationAdmission,
508
+ verifyCadreInviteRow,
509
+ verifyCadreInviteRedemption,
510
+ ownerGrantAddDigest,
511
+ ownerGrantRedeemDigest,
512
+ ownerGrantConsentDigest,
513
+ verifyOwnerGrantRow,
514
+ verifyOwnerGrantRedemption,
515
+ verifyOwnerGrantAdmission,
516
+ type DeviceTokenAuthorizedRow
517
+ } from './peer-authorization.js';
518
+
519
+ // How the trusted-owner anchor follows the replicated OwnerKey table along verifiable
520
+ // chains: the pure derivation rule `CadreNode.syncOwnerAnchor` applies on every membership
521
+ // refresh (owner-anchor-sync.ts).
522
+ export { deriveOwnerAnchor, type OwnerAnchorInputs, type OwnerAnchorDerivation } from './owner-anchor-sync.js';
523
+
524
+ // Strand Wake (control-network push-wake protocol)
525
+ export {
526
+ StrandWakeService,
527
+ dialWake,
528
+ WAKE_PROTOCOL,
529
+ DEFAULT_WAKE_DIAL_BUDGET_MS,
530
+ type StrandWakeServiceOptions,
531
+ type DialWakeOptions
532
+ } from './strand-wake-protocol.js';
533
+
534
+ // Strand Address (control-network strand-address RPC) — wire types come via
535
+ // `export * from './types.js'` (StrandAddrRequest / StrandAddrResponse / StrandAddrStatus).
536
+ export {
537
+ StrandAddrService,
538
+ collectStrandAddrs,
539
+ STRAND_ADDR_PROTOCOL,
540
+ type StrandAddrServiceOptions,
541
+ type StrandAddrPeer,
542
+ type CollectStrandAddrsOptions,
543
+ type StrandAddrOutcome,
544
+ type StrandAddrCollection
545
+ } from './strand-addr-protocol.js';
546
+
547
+ // Peer-address record (self-published, signed, freshness-stamped CadrePeer row)
548
+ export {
549
+ peerRecordSignedPayload,
550
+ signPeerRecord,
551
+ verifyPeerRecordSignature,
552
+ isPeerRecordFresh,
553
+ isSignalingAddr,
554
+ orderSignalingFirst,
555
+ currentMemberTrustPolicy,
556
+ DEFAULT_PEER_RECORD_MAX_AGE_MS,
557
+ DEFAULT_PEER_RECORD_HEARTBEAT_MS
558
+ } from './peer-record.js';
559
+
560
+ // Device-token record (self-published, signed FCM/APNs push token — CadrePeer sibling)
561
+ export {
562
+ deviceTokenSignedPayload,
563
+ signDeviceTokenRecord,
564
+ verifyDeviceTokenSignature,
565
+ isPushPlatform
566
+ } from './device-token.js';
567
+
568
+ // Strand-wake payload contract (canonical; shared by the server sender + RN receiver)
569
+ export { STRAND_WAKE_TYPE, type StrandWakePayload } from './strand-wake-payload.js';
570
+
571
+ // Platform push delivery — the cross-platform `PushNotifier` *contract* only.
572
+ // The FCM/APNs implementations (node:http2/node:crypto) and the
573
+ // `createPushNotifier` router that builds them live behind the Node-only subpath
574
+ // `@serfab/cadre-core/push-node` (`push-node.ts`), never in this graph. A Node
575
+ // host constructs a notifier from that subpath and injects the instance into
576
+ // `CadreNodeConfig.push.notifier`. These re-exports are type-only (erased at
577
+ // emit), so the RN/browser entry graph never pulls the Node modules in.
578
+ export type { PushNotifier, PushMessage, PushSendResult } from './push-notifier.js';
579
+
580
+ // Push-credential validation + log redaction. Dependency-free (type-only imports),
581
+ // so a provisioner (cadre-host / cadre-provider) can reject a partial credential
582
+ // set and produce a key-safe log view without pulling the FCM/APNs sender graph.
583
+ export { validatePushCredentials, redactPushCredentials, REDACTED } from './push-credentials.js';
584
+
585
+ // Server-side push-wake trigger policy + fan-out (who/when to wake). Cross-platform
586
+ // clean — it imports only the PushNotifier *type*, so exporting it as a runtime
587
+ // value pulls no node:http2/node:crypto edge into the RN/browser graph.
588
+ export {
589
+ PushFanoutService,
590
+ DEFAULT_PUSH_COOLDOWN_MS,
591
+ DEFAULT_PUSH_DEBOUNCE_MS,
592
+ type PushFanoutOptions,
593
+ type FanoutMember
594
+ } from './push-fanout.js';
595
+
596
+ // Control-cohort dial selection (backbone-preferential, bounded out-degree) +
597
+ // the backstop, redial and degree defaults the proactive reconcile routine reads.
598
+ export {
599
+ selectControlCohortDials,
600
+ DEFAULT_CONTROL_COHORT_RECONCILE_MS,
601
+ DEFAULT_CONTROL_COHORT_TARGET_DEGREE,
602
+ CONTROL_COHORT_REDIAL_MS,
603
+ type ControlCohortSelection,
604
+ type ControlCohortReconcileResult
605
+ } from './control-cohort.js';
606
+
607
+ // Dialing one peer from several candidate addresses, each under its own time
608
+ // limit, so an address that never answers cannot starve the rest. Each address is
609
+ // bound to the peer expected and dialed outside libp2p's dial queue (`dialAddr`),
610
+ // so another dial of the same peer in flight cannot capture the attempt.
611
+ export {
612
+ dialAddr,
613
+ withTrailingPeerId,
614
+ dialPeerAddrs,
615
+ SelfRelayOnlyError,
616
+ PeerUnreachableError,
617
+ tryAddrsInTurn,
618
+ directBeforeRelayed,
619
+ DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS,
620
+ DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS,
621
+ CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS,
622
+ DEFAULT_PEER_DIAL_BUDGET,
623
+ type PeerDialBudget,
624
+ type AddrDialer
625
+ } from './peer-dial.js';
626
+
627
+ // Dial and reservation budgets counted in link round trips rather than fixed milliseconds, so
628
+ // one declared assumption about the link moves them all — see `NetworkConfig.linkRoundTripMs`.
629
+ export {
630
+ DECLARED_LINK_ROUND_TRIP_MS,
631
+ CIRCUIT_DIAL_ROUND_TRIPS,
632
+ RELAY_DIAL_ROUND_TRIPS,
633
+ RELAYED_DIAL_ROUND_TRIPS,
634
+ RELAY_RESERVATION_ROUND_TRIPS,
635
+ CIRCUIT_REQUEST_ROUND_TRIPS,
636
+ RELAYED_REQUEST_ROUND_TRIPS,
637
+ PUSH_TRANSFER_ALLOWANCE_MS,
638
+ ADMISSION_DECISION_TIMEOUT_MS,
639
+ resolveLinkRoundTripMs,
640
+ relayedDialBudgetMs,
641
+ relayReservationBudgetMs,
642
+ circuitRequestBudgetMs,
643
+ relayedRequestBudgetMs,
644
+ peerJoinPushBudget,
645
+ type PeerJoinPushBudget,
646
+ DIAL_ADMISSION_DECISIONS,
647
+ optimysticDialLimits,
648
+ type OptimysticDialLimits
649
+ } from './link-budget.js';
650
+
651
+ // Seed trust policy (trust anchor for incoming seeds)
652
+ export {
653
+ anchoredTrustPolicy,
654
+ pinnedKeyTrustPolicy,
655
+ tofuTrustPolicy,
656
+ claimSecretTrustPolicy,
657
+ type SeedTrustPolicy,
658
+ type SeedTrustContext,
659
+ type SeedTrustDecision,
660
+ type ClaimSecretTrustPolicyOptions
661
+ } from './seed-trust-policy.js';
662
+
663
+ // Claim proof: how a brand-new node's first seed proves its sender holds the node's
664
+ // one-time claim secret. The owner side builds the proof over `seedDigest` (exported
665
+ // with the seed bootstrap above); `claimSecretTrustPolicy` verifies it.
666
+ // `ClaimRefusedError` is what `CadreNode.claimNode` throws when the node said no;
667
+ // `PeerUnreachableError` (exported with the peer dial above) when it was never reached.
668
+ export {
669
+ parseClaimSecret,
670
+ claimProof,
671
+ verifyClaimProof,
672
+ ClaimRefusedError,
673
+ CLAIM_SECRET_BYTES
674
+ } from './claim-proof.js';
675
+
676
+ // The claim payload: the node's peer id, addresses and claim secret as the text a host
677
+ // shows as a QR code and a phone scans (`CadreNode.claimNode` takes the decoded form).
678
+ export {
679
+ encodeNodeClaimPayload,
680
+ decodeNodeClaimPayload,
681
+ selectNodeClaimAddresses,
682
+ withClaimDestination,
683
+ destinationPeerIdOf,
684
+ classifyDialAddress,
685
+ NODE_CLAIM_PAYLOAD_PREFIX,
686
+ type NodeClaimPayload,
687
+ type NodeClaimAddressOptions,
688
+ type DialAddressKind
689
+ } from './node-claim-payload.js';
690
+
691
+ // Moving a party's strands into another party of the same owner, so an app's strands follow
692
+ // the app into the user's main cadre: the bundle one node exports from the party it leaves,
693
+ // its adoption by a node of the party it joined, and the check that the party it left holds
694
+ // nothing the joined one lacks before it is dissolved.
695
+ export {
696
+ exportStrandBundle,
697
+ adoptStrandBundle,
698
+ readStrandHoldings,
699
+ unheldBundleContent,
700
+ StrandMoveNotOwnerError,
701
+ StrandMoveSamePartyError,
702
+ type StrandHoldings,
703
+ type StrandBundle,
704
+ type StrandBundleEntry,
705
+ type FormationInviteEntry,
706
+ type StrandMoveReport,
707
+ type StrandMoveFailure
708
+ } from './strand-move.js';
709
+
710
+ // The join request: what an app that wants to join a cadre copies to the app that manages it,
711
+ // which mints an invitation targeted at the request's peer id. Both paste-text prefixes live here.
712
+ export {
713
+ encodeCadreJoinRequest,
714
+ decodeCadreJoinRequest,
715
+ requireCadreJoinReply,
716
+ CADRE_JOIN_REQUEST_PREFIX,
717
+ CADRE_INVITATION_PREFIX,
718
+ OWNER_KEY_EXPORT_STEM,
719
+ OWNER_GRANT_PREFIX,
720
+ CADRE_JOIN_REQUEST_MAX_APP_NAME,
721
+ type CadreJoinReply,
722
+ type CadreJoinRequest
723
+ } from './cadre-join-request.js';
724
+
725
+ // Renting a node from a hosting provider: the provider's descriptor, the app's side of the
726
+ // OAuth 2 + PKCE sign-in, the typed client for its container API, and `rentNode` /
727
+ // `finishRental`, which add the rented container to this node's cadre by invitation or by
728
+ // claim. Global `fetch` and `crypto.getRandomValues` only, so the whole set loads on React
729
+ // Native and in the browser (`docs/architecture.md` → "Renting a node from an app"). The
730
+ // barrel is the curated list; it is not repeated here.
731
+ export * from './provider/index.js';
732
+
733
+ // Schema Verification
734
+ export {
735
+ signSchema,
736
+ verifySchema,
737
+ assertSchemaSignature,
738
+ SchemaVerificationError
739
+ } from './schema-verification.js';
740
+
741
+ // Strand Formation transport (native cadre-core protocol)
742
+ export {
743
+ FormationListener,
744
+ dialFormation,
745
+ dialFormationByMachine,
746
+ isValidResponderCreatesResult,
747
+ isWellFormedMembershipInvite,
748
+ sanitizeStrandAddrs,
749
+ FORMATION_PROTOCOL,
750
+ type FormationParty,
751
+ type FormationContactMessage,
752
+ type FormationResultMessage,
753
+ type FormationProvisionResult,
754
+ type FormationStrandInfo,
755
+ type FormationDbConnectionInfo,
756
+ type FormationListenerOptions,
757
+ type FormationDialOptions,
758
+ type FormationDialResult,
759
+ type FormationRejection,
760
+ type ResponderProvisionOutcome
761
+ } from './strand-formation-protocol.js';
762
+ // A responder session's one read of its formation token, and the check made from it
763
+ export {
764
+ classifyTokenRead,
765
+ isTokenReadSpent,
766
+ type FormationInviteFacts,
767
+ type FormationTokenRead,
768
+ type FormationTokenCheck
769
+ } from './formation-token.js';
770
+ // How a formation dial fails: a typed refusal (with a fixed code) or no answer at all
771
+ export {
772
+ FormationRejectedError,
773
+ FormationUnreachableError,
774
+ FormationPostApprovalError,
775
+ FORMATION_REJECTION_RETRYABLE,
776
+ isFormationRejectionCode,
777
+ type FormationRejectionCode
778
+ } from './strand-formation-rejection.js';
779
+ export { formationDeadlines, type FormationDeadlines } from './strand-formation-deadlines.js';
780
+ // Cadre invitation redemption transport: the bundle an owner hands out, the wire messages, the
781
+ // member-side handler and the device-side dialer, and how a redemption fails
782
+ export {
783
+ CadreInviteHandler,
784
+ redeemAtMembers,
785
+ redeemInPasses,
786
+ signRedeemRequest,
787
+ verifyRedeemReply,
788
+ encodeCadreInvitation,
789
+ decodeCadreInvitation,
790
+ isWellFormedCadreInviteRow,
791
+ sanitizeAddrs,
792
+ CadreInviteRejectedError,
793
+ CadreInviteUnreachableError,
794
+ CadreInviteReplyInvalidError,
795
+ CADRE_INVITE_PROTOCOL,
796
+ CADRE_INVITE_REJECTION_RETRYABLE,
797
+ isCadreInviteRejectionCode,
798
+ type CadreInvitation,
799
+ type CadreInviteRedeemRequest,
800
+ type CadreInviteRedeemReply,
801
+ type CadreInviteAccepted,
802
+ type CadreInviteRejectionCode,
803
+ type CadreInviteAddressOutcome,
804
+ type CadreInviteHandlerOptions,
805
+ type CadreInviteStore,
806
+ type RedeemAtMembersOptions,
807
+ type RedeemInPassesOptions,
808
+ type RedeemSigner,
809
+ type RedeemSelfRecord,
810
+ type CadreInviteRedemption
811
+ } from './cadre-invite-protocol.js';
812
+ // Owner grant redemption transport: the bundle an owner hands out, the wire messages, the
813
+ // member-side handler and the holder-side dialer, and how a redemption fails
814
+ export {
815
+ OwnerGrantHandler,
816
+ redeemOwnerGrantAtMembers,
817
+ redeemOwnerGrantInPasses,
818
+ signOwnerGrantRequest,
819
+ verifyOwnerGrantReply,
820
+ encodeOwnerGrant,
821
+ decodeOwnerGrant,
822
+ isWellFormedOwnerGrantRow,
823
+ OwnerGrantRejectedError,
824
+ OwnerGrantUnreachableError,
825
+ OwnerGrantReplyInvalidError,
826
+ OWNER_GRANT_PROTOCOL,
827
+ OWNER_GRANT_REJECTION_RETRYABLE,
828
+ isOwnerGrantRejectionCode,
829
+ type OwnerGrantBundle,
830
+ type OwnerGrantRedeemRequest,
831
+ type OwnerGrantRedeemReply,
832
+ type OwnerGrantAccepted,
833
+ type OwnerGrantRejectionCode,
834
+ type OwnerGrantHandlerOptions,
835
+ type OwnerGrantStore,
836
+ type RedeemOwnerGrantAtMembersOptions,
837
+ type RedeemOwnerGrantInPassesOptions,
838
+ type OwnerGrantRedemption
839
+ } from './owner-grant-protocol.js';
840
+ // The exchange shape both redemption protocols are built on
841
+ export {
842
+ MemberRedemptionHandler,
843
+ dialRedemption,
844
+ dialRedemptionInPasses,
845
+ MAX_REDEMPTION_FRAME_BYTES,
846
+ type MemberRedemptionHandlerOptions,
847
+ type MemberRedemptionOptions,
848
+ type MemberRedemptionPassOptions,
849
+ type MemberRedemption,
850
+ type RedemptionAddressOutcome,
851
+ type RedemptionRejection,
852
+ type RedemptionRefusalFrame
853
+ } from './member-redemption.js';
854
+ // Which machines, and how many addresses of each, an invitation names; how far a cadre invitation reaches
855
+ export {
856
+ selectCadreInvitationMembers,
857
+ cadreInvitationReach,
858
+ CADRE_INVITATION_MAX_ADDRS,
859
+ CADRE_INVITATION_ADDRS_PER_SIBLING
860
+ } from './invitation-bootstrap.js';
861
+ // The pending-join retry loop behind CadreNode.requestJoin (PendingJoinStatus is in types.ts)
862
+ export { PENDING_JOIN_BACKSTOP_MS, PENDING_JOIN_MAX_BACKOFF_MS, MAX_PENDING_JOIN_MS } from './pending-join-runner.js';
863
+
864
+ // Strand Formation manager (drives the native transport)
865
+ export {
866
+ StrandFormationManager,
867
+ createStrandFormationManager,
868
+ MEMBERSHIP_INVITE_TTL_MS,
869
+ MEMBERSHIP_INVITE_UNAVAILABLE_REASON,
870
+ HOST_STRAND_MUST_BE_RECREATED_REASON,
871
+ type CadrePeerAddrsSource,
872
+ type MembershipInviteIssuer,
873
+ type StrandFormationManagerConfig,
874
+ type StrandFormationManagerOptions
875
+ } from './strand-formation-manager.js';
876
+
877
+ // Control-network per-stream protocol guard (which peers may open which protocol)
878
+ export {
879
+ controlProtocolClasses,
880
+ type ControlProtocolClass
881
+ } from './control-protocol-guard.js';
882
+
883
+ // Control-network inbound connection gate (membership defense-in-depth)
884
+ export {
885
+ createMembershipConnectionGater,
886
+ PROVISIONAL_ADMISSION_DEADLINE_MS,
887
+ PROVISIONAL_ADMISSION_CLOSE_TIMEOUT_MS,
888
+ MAX_UNAUTHORIZED_RELAY_RESERVATIONS,
889
+ UnauthorizedReservationBudget,
890
+ type InboundAdmissionPolicy,
891
+ type InboundConnectionVerdict
892
+ } from './membership-connection-gater.js';
893
+
894
+ // Thrown out of `CadreNode.start()` when a `network.relayAddrs` reservation does
895
+ // not land on its first attempt — the fail-fast posture of that config field now
896
+ // that the control node reserves AFTER control-database bring-up (relay-addrs.ts).
897
+ // `UnbindableListenAddressError` is the same posture for the OTHER half of the listen
898
+ // config: a `network.listenAddrs` entry whose transport the node will not have refuses
899
+ // start instead of being silently dropped by libp2p's transport manager.
900
+ //
901
+ // `resolveListenAddrs` and `strandNodeAddrs` are the derivations themselves — what a
902
+ // `NetworkConfig` actually turns into for the control node and for each strand node.
903
+ // Exported so an embedder that hand-writes a `network` block (the React Native and web
904
+ // reference apps) can assert on the resulting SHAPE rather than on its own field names,
905
+ // which is the difference between a test that proves reachability and one that proves a
906
+ // spelling.
907
+ export {
908
+ RelayReservationFailedError,
909
+ UnbindableListenAddressError,
910
+ RELAY_SEARCH_LISTEN_ADDR,
911
+ resolveListenAddrs
912
+ } from './relay-addrs.js';
913
+ export { strandNodeAddrs, type StrandNodeAddrs } from './strand-network-config.js';
914
+ // STUN for an embedder's WebRTC transport, derived from the relays it already uses: each
915
+ // Sereus relay also answers STUN (`ops/docs/ice-servers.md`).
916
+ export { RELAY_STUN_PORT, relayStunUrl, resolveStunServers, type StunServer } from './relay-stun.js';
917
+ // The circuit-relay SERVER a node runs, and with which init — one resolution shared by the
918
+ // control node and every strand node. Exported alongside the listen derivations above for the
919
+ // same reason: an embedder can assert on what its `network` block resolves to.
920
+ export {
921
+ resolveRelayServer,
922
+ PARTY_RELAY_MAX_RESERVATIONS,
923
+ PARTY_RELAY_RESERVATION_TTL_MS,
924
+ type ResolvedRelayServer,
925
+ type ResolvedRelayReservations
926
+ } from './relay-server.js';
927
+
928
+ // Relay reservation via the bare `/p2p-circuit` search listener — the one route
929
+ // every control node takes; `network.relayAddrs` is its fail-fast posture
930
+ // (see relay-reservation.ts)
931
+ export {
932
+ circuitMultiaddrs,
933
+ superviseRelayReservation,
934
+ DEFAULT_RELAY_RESERVE_TIMEOUT_MS,
935
+ DEFAULT_RELAY_RESERVE_POLL_MS,
936
+ DEFAULT_RELAY_CHECK_MS,
937
+ DEFAULT_RELAY_MIN_BACKOFF_MS,
938
+ DEFAULT_RELAY_MAX_BACKOFF_MS,
939
+ type RelayReservationStatus,
940
+ type RelayReservationState,
941
+ type RelayReserveOptions,
942
+ type RelayReservationSupervisor,
943
+ type RelayReservationSupervisorOptions
944
+ } from './relay-reservation.js';
945
+
946
+ // Connection-path diagnostics (relayed vs direct classification + summary)
947
+ export {
948
+ classifyTransport,
949
+ summarizeConnectionPaths,
950
+ emptyConnectionPathSummary,
951
+ DEFAULT_SETTLE_WINDOW_MS,
952
+ type ConnectionPathKind,
953
+ type ConnectionTransport,
954
+ type ConnectionPath,
955
+ type ConnectionPathSummary,
956
+ type ConnectionLike
957
+ } from './diagnostics/connection-path.js';