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