@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
@@ -2,7 +2,7 @@
2
2
  * The strands this party joined from ANOTHER party, held in two records.
3
3
  *
4
4
  * A party's own strands come back after a restart through its control database: the
5
- * `Strand` table holds their rows, the strand watcher polls it, and each row no sApp
5
+ * `Strand` table holds their rows, the strand watcher reads it, and each row no sApp
6
6
  * config claims is offered as `strand:discovered`. A strand joined through formation with
7
7
  * another party (`CadreNode.formStrand`) has its `Strand` row in the OTHER party's control
8
8
  * database, so it needs a record of its own (gotchoices/sereus#18):
@@ -17,7 +17,7 @@
17
17
  * published". A machine that is not an owner never publishes; its joins stay here.
18
18
  *
19
19
  * {@link JoinedStrandSession} moves joins between the two and is what the strand watcher
20
- * polls beside the control rows.
20
+ * reads beside the control rows.
21
21
  *
22
22
  * Two store implementations:
23
23
  * - {@link MemoryJoinedStrandStore} — joins die with the process. The default only for a
@@ -40,11 +40,14 @@ import { assertStrandScopeKey, isValidStrandScopeKey } from './storage-scope.js'
40
40
  const log = debug('sereus:cadre:joined-strand-store');
41
41
  /**
42
42
  * The {@link StrandRow} a record stands for — the shape `addStrand` and `strand:discovered`
43
- * carry. `FounderOwnerKey` is null because a joiner never founds; `CadreNode.launchStrand`
44
- * reads null as "not mine" and joins.
43
+ * carry. The founder columns are null because a joiner never founds; `CadreNode.launchStrand`
44
+ * reads a null `FounderPeerId` as "not mine" and joins.
45
45
  */
46
46
  export function joinedStrandRow(record) {
47
- return { Id: record.Id, Type: record.Type, MemberPrivateKey: record.MemberPrivateKey, FounderOwnerKey: null };
47
+ return { Id: record.Id, Type: record.Type, MemberPrivateKey: record.MemberPrivateKey, FounderOwnerKey: null, FounderPeerId: null };
48
+ }
49
+ function isSameJoin(record, row) {
50
+ return record.Type === row.Type && record.MemberPrivateKey === row.MemberPrivateKey;
48
51
  }
49
52
  /**
50
53
  * Ephemeral store for a node without a `keyStore`. Warns once, at the first join it is
@@ -87,9 +90,9 @@ const SLOT_PREFIX = 'cadre/joined-strand/';
87
90
  * arbitrary text, and base64url never contains the `/` that ends the segment.
88
91
  *
89
92
  * Loads every slot once, at the first {@link list}, then answers from memory and writes
90
- * through, so the strand watcher's five-second poll does not read the enclave on every
91
- * pass. A load that fails — `KeyStoreAccessError` from a refused unlock prompt, say —
92
- * is rethrown rather than read as "no joins" and retried at the next call, exactly as
93
+ * through, so a strand watcher run does not read the enclave each time. A load that
94
+ * fails — `KeyStoreAccessError` from a refused unlock prompt, say — is rethrown rather
95
+ * than read as "no joins" and retried at the next call, exactly as
93
96
  * `loadOrCreateIdentityKey` treats the identity slot. A slot that does not parse as a
94
97
  * record for its own id is dropped with a log and its siblings kept: refusing to start
95
98
  * repairs nothing, and the other joins are still good.
@@ -133,9 +136,10 @@ export class KeyStoreJoinedStrandStore {
133
136
  this.queue = result.catch(() => undefined);
134
137
  return result;
135
138
  }
136
- // NOTE: a failed load is retried at the next list(), which is every strand-watcher poll;
137
- // over a backend that gates reads behind an unlock prompt the user keeps declining, that
138
- // is a prompt every five seconds. Every KeyStore shipped today is ungated for this reason
139
+ // NOTE: a failed load is retried at the next list(), which is every strand-watcher run (a
140
+ // change to `Strand` or `JoinedStrand`, a local join, a retry, the backstop); over a backend
141
+ // that gates reads behind an unlock prompt the user keeps declining, that is a prompt per
142
+ // run. Every KeyStore shipped today is ungated for this reason
139
143
  // (see `SecureStoreKeyStoreOptions.requireAuthentication`); if one is ever gated, back
140
144
  // off the retry here.
141
145
  async loaded() {
@@ -189,7 +193,7 @@ function parseRecord(strandId, bytes) {
189
193
  * the moves between them. Rebuilt at every start, which is what ends the per-session state
190
194
  * below.
191
195
  *
192
- * The watcher reads a row missing from a poll as a removal and detaches the strand, so this
196
+ * The watcher reads a row missing from a run's read as a removal and detaches the strand, so this
193
197
  * holds the state a plain union would get wrong:
194
198
  * - the last list each record answered, reused when a later read fails, so a failed read
195
199
  * is not "every join was forgotten";
@@ -198,11 +202,20 @@ function parseRecord(strandId, bytes) {
198
202
  * and queued for party-wide removal so the next start does not re-attach them.
199
203
  */
200
204
  export class JoinedStrandSession {
201
- constructor(store, ledger) {
205
+ /**
206
+ * @param onLocalChange - Called after a move changes what {@link withControlRows} merges in
207
+ * from outside the control database (this machine's unpublished joins, the joins kept for
208
+ * this session), which no control-table change event reports. `CadreNode` wakes its strand
209
+ * watcher with it.
210
+ */
211
+ constructor(store, ledger, onLocalChange = () => { }) {
202
212
  this.store = store;
203
213
  this.ledger = ledger;
214
+ this.onLocalChange = onLocalChange;
204
215
  this.lastUnpublished = [];
205
216
  this.lastPartyWide = [];
217
+ /** Whether the last party-wide read in {@link withControlRows} succeeded; see {@link lastReadPartial}. */
218
+ this.lastPartyWideFresh = true;
206
219
  this.keptForSession = new Map();
207
220
  /** Strands whose party-wide row {@link syncWithParty} removes, queued by a self-revocation. */
208
221
  this.pendingRemovals = new Set();
@@ -217,7 +230,7 @@ export class JoinedStrandSession {
217
230
  * `control` plus every join, one row per id, in this precedence: the control rows (the
218
231
  * party's own strands), then the party-wide joins, then this machine's unpublished joins
219
232
  * and the joins kept for this session. A local record named by either of the first two in
220
- * a read that succeeded this poll is stale — published, or the strand is the party's own
233
+ * a read that succeeded this run is stale — published, or the strand is the party's own
221
234
  * now — so it is forgotten here; this also cleans up after a crash between a publish and
222
235
  * its local forget. One named only by the last-good party-wide list is kept: that list may
223
236
  * predate a leave the record re-joined after.
@@ -228,7 +241,7 @@ export class JoinedStrandSession {
228
241
  const offered = new Map(control.map((row) => [row.Id, row]));
229
242
  const partyWide = await this.partyWide();
230
243
  // NOTE: a party-wide join whose id the party's own `Strand` table also holds (the party
231
- // founded AND joined it — contrived) is shadowed here, not deleted: a watcher poll must
244
+ // founded AND joined it — contrived) is shadowed here, not deleted: a watcher run must
232
245
  // not make owner-signed writes. If the party later unpublishes its own row the join row
233
246
  // resurfaces; if that is ever seen, remove the join row inside `unpublishStrand`.
234
247
  for (const row of partyWide.rows) {
@@ -257,10 +270,17 @@ export class JoinedStrandSession {
257
270
  }
258
271
  return [...offered.values()];
259
272
  }
273
+ /**
274
+ * True when the last {@link withControlRows} offered the party-wide joins from the last
275
+ * list that answered, because its read of `JoinedStrand` failed.
276
+ */
277
+ lastReadPartial() {
278
+ return !this.lastPartyWideFresh;
279
+ }
260
280
  /**
261
281
  * This machine's unpublished joins, straight from the store (never the last-good list a
262
282
  * failed read stands in with). What a strand move exports beside the `JoinedStrand`
263
- * table: a machine publishes only while it holds a control connection, so until then its
283
+ * table: a machine publishes only while a sibling is reachable, so until then its
264
284
  * joins live only here.
265
285
  */
266
286
  unpublishedRecords() {
@@ -270,20 +290,31 @@ export class JoinedStrandSession {
270
290
  async remember(record) {
271
291
  this.pendingRemovals.delete(record.Id);
272
292
  await this.store.record(record);
293
+ this.onLocalChange();
273
294
  }
274
295
  /**
275
296
  * Record `row`, joined by `addStrand`, unless this party's control database already names
276
297
  * it (its own strand, or a join already published) or an identical record is already here
277
- * (an app re-claiming a remembered join on every start). Keeps the first `joinedAt`. Like
298
+ * (an app re-claiming a remembered join on every start, or `addStrand` right after
299
+ * `formStrand`). The store is asked first: it answers from memory once loaded, so the
300
+ * common re-claim reads no control row. Keeps the first `joinedAt`. Like
278
301
  * {@link remember}, cancels a queued removal.
279
302
  */
280
303
  async rememberForeign(row) {
281
304
  this.pendingRemovals.delete(row.Id);
305
+ const early = await this.storedRecord(row.Id).catch((error) => {
306
+ // Asked again below only when the party does not name the strand; a second failure throws.
307
+ log('joined strand %s: store lookup failed; asking the control database first: %o', row.Id, error);
308
+ return null;
309
+ });
310
+ if (early && isSameJoin(early, row)) {
311
+ return;
312
+ }
282
313
  if (await this.namedByParty(row.Id)) {
283
314
  return;
284
315
  }
285
- const existing = (await this.store.list()).find((record) => record.Id === row.Id);
286
- if (existing?.Type === row.Type && existing.MemberPrivateKey === row.MemberPrivateKey) {
316
+ const existing = early === null ? await this.storedRecord(row.Id) : early;
317
+ if (existing && isSameJoin(existing, row)) {
287
318
  return;
288
319
  }
289
320
  await this.store.record({
@@ -292,6 +323,7 @@ export class JoinedStrandSession {
292
323
  MemberPrivateKey: row.MemberPrivateKey,
293
324
  joinedAt: existing?.joinedAt ?? Date.now()
294
325
  });
326
+ this.onLocalChange();
295
327
  }
296
328
  /**
297
329
  * Leave a join for the whole party: remove the party-wide row, then this machine's record.
@@ -304,6 +336,7 @@ export class JoinedStrandSession {
304
336
  this.keptForSession.delete(strandId);
305
337
  this.lastPartyWide = this.lastPartyWide.filter((row) => row.Id !== strandId);
306
338
  await this.store.forget(strandId);
339
+ this.onLocalChange();
307
340
  });
308
341
  }
309
342
  /**
@@ -321,13 +354,14 @@ export class JoinedStrandSession {
321
354
  if (!row) {
322
355
  return;
323
356
  }
324
- // Kept BEFORE the store forgets, so no poll can union without it. Queued even for a
357
+ // Kept BEFORE the store forgets, so no watcher run can union without it. Queued even for a
325
358
  // local-only join, which a sibling may have published already.
326
359
  this.keptForSession.set(strandId, row);
327
360
  this.pendingRemovals.add(strandId);
328
361
  if (local) {
329
362
  await this.store.forget(strandId);
330
363
  }
364
+ this.onLocalChange();
331
365
  });
332
366
  }
333
367
  /**
@@ -357,15 +391,16 @@ export class JoinedStrandSession {
357
391
  });
358
392
  }
359
393
  // NOTE: a sibling that joined the same strand and has not yet published publishes it after
360
- // a leave, bringing the strand back party-wide. Needs two devices joining one strand within
361
- // a reconcile interval of the leave; if it is ever seen, check the strand's `Revocation`
394
+ // a leave, bringing the strand back party-wide. Needs a second device to have joined the
395
+ // strand and not yet run a connected reconcile pass when the leave lands (a join starts no
396
+ // pass, so up to the 2-minute backstop); if it is ever seen, check the strand's `Revocation`
362
397
  // tombstone before publishing.
363
398
  async publish(record) {
364
399
  try {
365
400
  if (!(await this.ledger.names(record.Id))) {
366
401
  await this.ledger.publish(record);
367
402
  // Into the last-good list too: its local record goes next, so a party-wide read that
368
- // fails before one succeeds would otherwise drop the strand from the poll and hide it
403
+ // fails before one succeeds would otherwise drop the strand from the watcher's read and hide it
369
404
  // from a self-revocation.
370
405
  this.lastPartyWide = [...this.lastPartyWide.filter((row) => row.Id !== record.Id), joinedStrandRow(record)];
371
406
  log('joined strand %s published party-wide (party=%s)', record.Id, this.store.partyId);
@@ -390,18 +425,19 @@ export class JoinedStrandSession {
390
425
  async partyWide() {
391
426
  try {
392
427
  this.lastPartyWide = await this.ledger.list();
393
- return { rows: this.lastPartyWide, fresh: true };
428
+ this.lastPartyWideFresh = true;
394
429
  }
395
430
  catch (error) {
396
431
  log('party-wide joined-strand read failed; offering the last list it answered (%d join(s)): %o', this.lastPartyWide.length, error);
397
- return { rows: this.lastPartyWide, fresh: false };
432
+ this.lastPartyWideFresh = false;
398
433
  }
434
+ return { rows: this.lastPartyWide, fresh: this.lastPartyWideFresh };
399
435
  }
400
436
  /**
401
437
  * {@link PartyJoinedStrandLedger.names}, answering false when the control database cannot
402
438
  * be read (a machine cut off from its party before it received the `JoinedStrand` block).
403
439
  * Recording is the safe side: a local record the party turns out to name is forgotten by
404
- * the next poll that reads it, while a join with no record is not offered after a restart.
440
+ * the next watcher run that reads it, while a join with no record is not offered after a restart.
405
441
  */
406
442
  async namedByParty(strandId) {
407
443
  try {
@@ -412,6 +448,9 @@ export class JoinedStrandSession {
412
448
  return false;
413
449
  }
414
450
  }
451
+ async storedRecord(strandId) {
452
+ return (await this.store.list()).find((record) => record.Id === strandId);
453
+ }
415
454
  /** Run `work` after every earlier serialized move settles; see {@link exclusive}. */
416
455
  serialized(work) {
417
456
  const result = this.exclusive.then(work);
@@ -433,7 +472,7 @@ export class JoinedStrandSession {
433
472
  log('joined strand %s is named by this party\'s control database — local record forgotten', strandId);
434
473
  }
435
474
  catch (error) {
436
- log('forgetting superseded joined strand %s failed; the next poll retries: %o', strandId, error);
475
+ log('forgetting superseded joined strand %s failed; the next watcher run retries: %o', strandId, error);
437
476
  }
438
477
  }
439
478
  }
@@ -1 +1 @@
1
- {"version":3,"file":"joined-strand-store.js","sourceRoot":"","sources":["../src/joined-strand-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEjG,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGjF,MAAM,GAAG,GAAG,KAAK,CAAC,kCAAkC,CAAC,CAAC;AA2BtD;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAA0B;IACzD,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;AAC/G,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,uBAAuB;IAInC,YAAqB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QAHnB,YAAO,GAAG,IAAI,GAAG,EAA8B,CAAC;QACzD,WAAM,GAAG,KAAK,CAAC;IAEgB,CAAC;IAExC,KAAK,CAAC,IAAI;QACT,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;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AC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,IAAI,CAAC,eAAe,CAAC;IAC7B,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAAC,QAAgB;QAC9C,IAAI,CAAC;YACJ,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAClC,GAAG,CAAC,sFAAsF,EAAE,QAAQ,CAAC,CAAC;QACvG,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,GAAG,CAAC,iFAAiF,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QACzG,CAAC;IACF,CAAC;CACD"}
@@ -2,10 +2,10 @@
2
2
  * Backend-agnostic store for raw private key material.
3
3
  *
4
4
  * Mobile cadre nodes hold sensitive key material at rest: the libp2p
5
- * peer/node identity key and (in the single-key reference model) the owner
6
- * signing key derived from it. This module defines the seam those keys flow
7
- * through so a platform-secure backend (iOS Keychain / Android Keystore) can be
8
- * plugged in without `@serfab/cadre-core` taking any platform dependency.
5
+ * peer/node identity key and, on a device the user made an owner, an owner key
6
+ * in a slot of its own (`owner-key-store.ts`). This module defines the seam those
7
+ * keys flow through so a platform-secure backend (iOS Keychain / Android Keystore)
8
+ * can be plugged in without `@serfab/cadre-core` taking any platform dependency.
9
9
  *
10
10
  * This file is dependency-free (no node:/RN imports) so it is safe in every
11
11
  * entry graph. The Node reference {@link FileKeyStore} lives in a separate
@@ -20,6 +20,11 @@ export type KeyId = string;
20
20
  * `identityKeyId`.
21
21
  */
22
22
  export declare const DEFAULT_IDENTITY_KEY_ID: KeyId;
23
+ /**
24
+ * Default slot id for an owner key (`owner-key-store.ts`). Not party-scoped: one
25
+ * owner key may own several cadres, each owner signature binding its party id.
26
+ */
27
+ export declare const DEFAULT_OWNER_KEY_ID: KeyId;
23
28
  /**
24
29
  * Backend-agnostic store for raw private key material. Implementations may be
25
30
  * file-based, OS-keyring, or platform secure-enclave backed (iOS Keychain /
package/dist/key-store.js CHANGED
@@ -2,10 +2,10 @@
2
2
  * Backend-agnostic store for raw private key material.
3
3
  *
4
4
  * Mobile cadre nodes hold sensitive key material at rest: the libp2p
5
- * peer/node identity key and (in the single-key reference model) the owner
6
- * signing key derived from it. This module defines the seam those keys flow
7
- * through so a platform-secure backend (iOS Keychain / Android Keystore) can be
8
- * plugged in without `@serfab/cadre-core` taking any platform dependency.
5
+ * peer/node identity key and, on a device the user made an owner, an owner key
6
+ * in a slot of its own (`owner-key-store.ts`). This module defines the seam those
7
+ * keys flow through so a platform-secure backend (iOS Keychain / Android Keystore)
8
+ * can be plugged in without `@serfab/cadre-core` taking any platform dependency.
9
9
  *
10
10
  * This file is dependency-free (no node:/RN imports) so it is safe in every
11
11
  * entry graph. The Node reference {@link FileKeyStore} lives in a separate
@@ -18,6 +18,11 @@
18
18
  * `identityKeyId`.
19
19
  */
20
20
  export const DEFAULT_IDENTITY_KEY_ID = 'cadre/identity';
21
+ /**
22
+ * Default slot id for an owner key (`owner-key-store.ts`). Not party-scoped: one
23
+ * owner key may own several cadres, each owner signature binding its party id.
24
+ */
25
+ export const DEFAULT_OWNER_KEY_ID = 'cadre/owner';
21
26
  /**
22
27
  * Thrown by {@link KeyStore.get} when access was denied or could not be
23
28
  * satisfied (e.g. a biometric/device-unlock prompt was cancelled or failed).
@@ -1 +1 @@
1
- {"version":3,"file":"key-store.js","sourceRoot":"","sources":["../src/key-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAU,gBAAgB,CAAC;AAgC/D;;;;;;;;;;GAUG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAG7C,YAAY,KAAY,EAAE,OAAe,EAAE,OAA6B;QACvE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,C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H,MAAM,OAAO,gBAAgB;IAA7B;QACkB,UAAK,GAAG,IAAI,GAAG,EAAqB,CAAC;IAkBvD,CAAC;IAhBA,KAAK,CAAC,GAAG,CAAC,KAAY;QACrB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,KAAY,EAAE,WAAuB;QAC9C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAY;QACxB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,IAAI;QACT,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/B,CAAC;CACD"}
@@ -379,13 +379,15 @@ export declare const PUSH_TRANSFER_ALLOWANCE_MS = 6000;
379
379
  * every members-only protocol from the materialized snapshot, and unplaced
380
380
  * relay reservations stay capped (`MAX_UNAUTHORIZED_RELAY_RESERVATIONS`).
381
381
  * - **The slow case is bring-up, not steady state.** A membership read consults
382
- * the cohort only for a block this node does not hold, or before the
383
- * `Revocation` ledger marker exists; once the marker exists every block the
384
- * decision reads is held (`control-founding-consult-budget.spec.ts` pins both
385
- * states). So the gate always fails open only on a node whose membership reads
386
- * still consult: one consult costs about two link round trips, and asking a
387
- * silent peer costs the per-peer read deadline ({@link cohortReadDeadlineMs}, 7 s
388
- * at the default declaration).
382
+ * the cohort only for a block this node does not hold: before a joining
383
+ * machine has read it from the cohort, or for a table nobody has written on a
384
+ * party founded before genesis created every control collection. Otherwise
385
+ * every block the decision reads is held
386
+ * (`control-founding-consult-budget.spec.ts` pins that). So the gate always
387
+ * fails open only on a node whose membership reads still consult: one consult
388
+ * costs about two link round trips, and asking a silent peer costs the
389
+ * per-peer read deadline ({@link cohortReadDeadlineMs}, 7 s at the default
390
+ * declaration).
389
391
  * - **The decision is spent on the dialing machine's clock.** libp2p's listener
390
392
  * runs this gate before it answers the multiplexer negotiation the dialer is
391
393
  * waiting on (`libp2p/dist/src/upgrader.js`), and the listener's own
@@ -379,13 +379,15 @@ export const PUSH_TRANSFER_ALLOWANCE_MS = 6000;
379
379
  * every members-only protocol from the materialized snapshot, and unplaced
380
380
  * relay reservations stay capped (`MAX_UNAUTHORIZED_RELAY_RESERVATIONS`).
381
381
  * - **The slow case is bring-up, not steady state.** A membership read consults
382
- * the cohort only for a block this node does not hold, or before the
383
- * `Revocation` ledger marker exists; once the marker exists every block the
384
- * decision reads is held (`control-founding-consult-budget.spec.ts` pins both
385
- * states). So the gate always fails open only on a node whose membership reads
386
- * still consult: one consult costs about two link round trips, and asking a
387
- * silent peer costs the per-peer read deadline ({@link cohortReadDeadlineMs}, 7 s
388
- * at the default declaration).
382
+ * the cohort only for a block this node does not hold: before a joining
383
+ * machine has read it from the cohort, or for a table nobody has written on a
384
+ * party founded before genesis created every control collection. Otherwise
385
+ * every block the decision reads is held
386
+ * (`control-founding-consult-budget.spec.ts` pins that). So the gate always
387
+ * fails open only on a node whose membership reads still consult: one consult
388
+ * costs about two link round trips, and asking a silent peer costs the
389
+ * per-peer read deadline ({@link cohortReadDeadlineMs}, 7 s at the default
390
+ * declaration).
389
391
  * - **The decision is spent on the dialing machine's clock.** libp2p's listener
390
392
  * runs this gate before it answers the multiplexer negotiation the dialer is
391
393
  * waiting on (`libp2p/dist/src/upgrader.js`), and the listener's own
@@ -1 +1 @@
1
- {"version":3,"file":"link-budget.js","sourceRoot":"","sources":["../src/link-budget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BAAoB,GAAG,WAAW;YAC9D,WAAW,EAAE,OAAO,CAAC,mBAAmB,GAAG,WAAW;SACtD;QACD,YAAY,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,GAAG,WAAW,EAAE;KACpE,CAAC;AACH,CAAC"}
@@ -1,16 +1,14 @@
1
1
  /**
2
- * Removing a machine from a cadre: the listing an app shows (`CadreNode.listMachines`), the
3
- * read-only plan behind its confirmation step (`CadreNode.planMachineRemoval`), and the
4
- * check that a requested re-vouch stays inside that plan. Pure projections over rows the
5
- * node has already read; the reads and writes themselves are `CadreNode.removeMachine`'s and
6
- * `ControlDatabase.removeMachine`'s.
2
+ * Removing a machine from a cadre: the listing an app shows (`CadreNode.listMachines`) and the
3
+ * read-only plan behind its confirmation step (`CadreNode.planMachineRemoval`). Pure
4
+ * projections over rows the node has already read; the reads and writes themselves are
5
+ * `CadreNode.removeMachine`'s and `ControlDatabase.removeMachine`'s.
7
6
  *
8
- * A machine's owner key is its own identity key: an owner-granting invitation seats
9
- * `OwnerKey.Key = CadrePeer.PublicKey`, and `addOwner` takes the key behind a peer id. So
10
- * "this machine is an owner" is "the ed25519 key behind its peer id is a live `OwnerKey`",
11
- * and an owner key with no machine row is still listed, as the machine it names.
7
+ * A machine is a `CadrePeer` row and nothing more: an owner key is the person's, so removing a
8
+ * machine leaves every owner key standing, the one the machine's user signed with included
9
+ * (removing one is `CadreNode.removeOwner`, `owner-keys.ts`).
12
10
  */
13
- import type { CadreInviteStatus, CadreInviteUsageRow, CadreMachine, CadrePeerRow, MachineRemovalPlan, MachineRemovalRefusal, OwnerKeyRow, RemoveMachineOptions } from './types.js';
11
+ import type { CadreInviteStatus, CadreInviteUsageRow, CadreMachine, CadrePeerRow, MachineRemovalPlan, MachineRemovalRefusal } from './types.js';
14
12
  /**
15
13
  * `CadreNode.removeMachine` refused by name, before any write. `code` says which rule
16
14
  * (`MachineRemovalRefusal`), for an app to switch on; the message is for a log.
@@ -26,53 +24,35 @@ export interface MachineListingInput {
26
24
  selfPeerId: string | null;
27
25
  /** Live `CadrePeer` rows (`ControlDatabase.queryCadrePeers`). */
28
26
  rows: readonly CadrePeerRow[];
29
- /** Live `OwnerKey` rows (`ControlDatabase.queryOwnerKeyRows`). */
30
- owners: readonly OwnerKeyRow[];
31
27
  /** This node's authorized-membership predicate for one row (`CadreNode.listAuthorizedMembers`'s). */
32
28
  trusted: (row: CadrePeerRow) => boolean;
33
29
  }
34
30
  /**
35
- * One entry per live `CadrePeer` row, then one per live `OwnerKey` whose key derives a peer
36
- * id with no row. `profile` and `lastPublishedAt` are reported only when the row's
37
- * self-signature verifies under the key behind its peer id, as `CadreNode.resolvePeerAddrs`
38
- * judges the same record: no insert rule constrains `Profile`, and an owner re-vouch may
39
- * bump `UpdatedAt` without re-signing.
31
+ * One entry per live `CadrePeer` row. `profile` and `lastPublishedAt` are reported only when
32
+ * the row's self-signature verifies under the key behind its peer id, as
33
+ * `CadreNode.resolvePeerAddrs` judges the same record: no insert rule constrains `Profile`, and
34
+ * an owner re-vouch may bump `UpdatedAt` without re-signing.
40
35
  */
41
36
  export declare function describeMachines(input: MachineListingInput): CadreMachine[];
42
37
  /** What {@link planMachineRemoval} judges from. */
43
38
  export interface MachineRemovalPlanInput {
44
39
  peerId: string;
45
40
  machines: readonly CadreMachine[];
46
- rows: readonly CadrePeerRow[];
47
- owners: readonly OwnerKeyRow[];
48
41
  selfPeerId: string | null;
49
- /** This node's enrolled owner key (`CadreNode.enrolledOwnerSigningKey`), or null when it cannot sign owner writes. */
50
- selfOwnerKey: string | null;
42
+ /** Whether this node's owner signer is an enrolled owner (`CadreNode.ownerSignerEnrolledIn`), so it can sign the removal. */
43
+ canSign: boolean;
51
44
  invites: readonly CadreInviteStatus[];
52
45
  usages: readonly CadreInviteUsageRow[];
53
46
  }
54
47
  /**
55
- * The plan for removing `peerId` from these rows. The refusals come first and by name: a
56
- * node that cannot sign, the node itself (an owner cannot sign its own `OwnerKey` removal;
57
- * refusing the whole self-removal keeps one rule for owners and non-owners), and a machine
58
- * holding the only live owner key. The last cannot coexist with this node being a different
59
- * owner, but the local count can be wrong under concurrency, so the name stays.
60
- *
61
- * `dependents` are the rows the machine's owner key vouched, which every reader judges
62
- * against its anchor through `VouchOwner`: once the key is removed they stop passing the
63
- * membership predicate on every machine unless re-vouched first. This node's own rows are
64
- * reported as `ownDependency` instead, since it cannot re-vouch them itself.
48
+ * The plan for removing `peerId` from these rows. The refusals come first and by name: a node
49
+ * that cannot sign, and the node itself (leaving a cadre is the embedder's flow, which stops
50
+ * the node and deletes its data; the removal notice a machine acts on is built around another
51
+ * machine removing it).
65
52
  *
66
53
  * `invitations` are the live ones the machine could redeem to come back: targeted at it,
67
54
  * or already redeemed by it and still redeemable (a multi-use invitation, or an open
68
- * owner invitation inside its lifetime). The schema's rule: keeping a device out is removing
55
+ * invitation inside its lifetime). The schema's rule: keeping a device out is removing
69
56
  * its row and withdrawing the invitation.
70
57
  */
71
58
  export declare function planMachineRemoval(input: MachineRemovalPlanInput): MachineRemovalPlan;
72
- /**
73
- * The re-vouch a caller asked for, checked against the plan: every key and peer must be in
74
- * `plan.dependents`, so a caller cannot re-vouch a row the removed owner never vouched (nor
75
- * the machine itself, which `dependents.peers` excludes). Throws naming the offenders, before
76
- * `CadreNode.removeMachine` writes anything. Duplicates are dropped.
77
- */
78
- export declare function revouchWithinPlan(plan: MachineRemovalPlan, revouch: RemoveMachineOptions['revouch']): MachineRemovalPlan['dependents'];