@serfab/cadre-core 1.13.0 → 1.14.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 (120) hide show
  1. package/dist/cadre-invite-protocol.d.ts +348 -0
  2. package/dist/cadre-invite-protocol.js +605 -0
  3. package/dist/cadre-invite-protocol.js.map +1 -0
  4. package/dist/cadre-node.d.ts +523 -180
  5. package/dist/cadre-node.js +921 -293
  6. package/dist/cadre-node.js.map +1 -1
  7. package/dist/claim-proof.d.ts +45 -0
  8. package/dist/claim-proof.js +132 -0
  9. package/dist/claim-proof.js.map +1 -0
  10. package/dist/control-authorization.d.ts +80 -19
  11. package/dist/control-authorization.js +55 -13
  12. package/dist/control-authorization.js.map +1 -1
  13. package/dist/control-cohort.js +1 -1
  14. package/dist/control-cohort.js.map +1 -1
  15. package/dist/control-database.d.ts +514 -97
  16. package/dist/control-database.js +1033 -195
  17. package/dist/control-database.js.map +1 -1
  18. package/dist/control-protocol-guard.d.ts +142 -0
  19. package/dist/control-protocol-guard.js +293 -0
  20. package/dist/control-protocol-guard.js.map +1 -0
  21. package/dist/control-schema.d.ts +1 -1
  22. package/dist/control-schema.js +801 -1067
  23. package/dist/control-schema.js.map +1 -1
  24. package/dist/control-stream.d.ts +4 -0
  25. package/dist/control-stream.js +22 -7
  26. package/dist/control-stream.js.map +1 -1
  27. package/dist/delegate-admission.d.ts +1 -1
  28. package/dist/delegate-admission.js +1 -1
  29. package/dist/device-token.d.ts +11 -9
  30. package/dist/device-token.js +14 -12
  31. package/dist/device-token.js.map +1 -1
  32. package/dist/ed25519-key.d.ts +15 -0
  33. package/dist/ed25519-key.js +28 -1
  34. package/dist/ed25519-key.js.map +1 -1
  35. package/dist/index.d.ts +14 -9
  36. package/dist/index.js +27 -9
  37. package/dist/index.js.map +1 -1
  38. package/dist/link-budget.d.ts +16 -29
  39. package/dist/link-budget.js +16 -31
  40. package/dist/link-budget.js.map +1 -1
  41. package/dist/membership-connection-gater.d.ts +190 -151
  42. package/dist/membership-connection-gater.js +235 -173
  43. package/dist/membership-connection-gater.js.map +1 -1
  44. package/dist/node-claim-payload.d.ts +19 -0
  45. package/dist/node-claim-payload.js +120 -0
  46. package/dist/node-claim-payload.js.map +1 -0
  47. package/dist/owner-anchor-sync.d.ts +22 -0
  48. package/dist/owner-anchor-sync.js +143 -0
  49. package/dist/owner-anchor-sync.js.map +1 -0
  50. package/dist/peer-authorization.d.ts +113 -18
  51. package/dist/peer-authorization.js +225 -29
  52. package/dist/peer-authorization.js.map +1 -1
  53. package/dist/peer-dial.d.ts +19 -0
  54. package/dist/peer-dial.js +22 -1
  55. package/dist/peer-dial.js.map +1 -1
  56. package/dist/peer-join-backfill.d.ts +26 -2
  57. package/dist/peer-join-backfill.js +54 -12
  58. package/dist/peer-join-backfill.js.map +1 -1
  59. package/dist/peer-record.d.ts +13 -9
  60. package/dist/peer-record.js +16 -12
  61. package/dist/peer-record.js.map +1 -1
  62. package/dist/pending-join-runner.d.ts +66 -58
  63. package/dist/pending-join-runner.js +136 -145
  64. package/dist/pending-join-runner.js.map +1 -1
  65. package/dist/push-fanout.d.ts +8 -2
  66. package/dist/push-fanout.js +8 -2
  67. package/dist/push-fanout.js.map +1 -1
  68. package/dist/seed-bootstrap.d.ts +147 -122
  69. package/dist/seed-bootstrap.js +284 -269
  70. package/dist/seed-bootstrap.js.map +1 -1
  71. package/dist/seed-trust-policy.d.ts +98 -37
  72. package/dist/seed-trust-policy.js +188 -2
  73. package/dist/seed-trust-policy.js.map +1 -1
  74. package/dist/strand-addr-protocol.d.ts +24 -26
  75. package/dist/strand-addr-protocol.js +19 -26
  76. package/dist/strand-addr-protocol.js.map +1 -1
  77. package/dist/strand-formation-protocol.js +1 -1
  78. package/dist/strand-formation-protocol.js.map +1 -1
  79. package/dist/strand-revocation-enforcer.d.ts +11 -11
  80. package/dist/strand-revocation-enforcer.js +11 -11
  81. package/dist/strand-wake-protocol.d.ts +13 -16
  82. package/dist/strand-wake-protocol.js +13 -20
  83. package/dist/strand-wake-protocol.js.map +1 -1
  84. package/dist/trusted-owner-store.d.ts +35 -5
  85. package/dist/trusted-owner-store.js +50 -8
  86. package/dist/trusted-owner-store.js.map +1 -1
  87. package/dist/types.d.ts +302 -87
  88. package/dist/types.js.map +1 -1
  89. package/package.json +8 -7
  90. package/src/cadre-invite-protocol.ts +864 -0
  91. package/src/cadre-node.ts +9381 -8686
  92. package/src/claim-proof.ts +147 -0
  93. package/src/control-authorization.ts +203 -117
  94. package/src/control-cohort.ts +1 -1
  95. package/src/control-database.ts +1216 -218
  96. package/src/control-protocol-guard.ts +348 -0
  97. package/src/control-schema.ts +812 -1078
  98. package/src/control-stream.ts +26 -7
  99. package/src/delegate-admission.ts +1 -1
  100. package/src/device-token.ts +14 -10
  101. package/src/ed25519-key.ts +28 -1
  102. package/src/index.ts +84 -10
  103. package/src/link-budget.ts +16 -32
  104. package/src/membership-connection-gater.ts +637 -570
  105. package/src/node-claim-payload.ts +125 -0
  106. package/src/owner-anchor-sync.ts +171 -0
  107. package/src/peer-authorization.ts +258 -29
  108. package/src/peer-dial.ts +22 -1
  109. package/src/peer-join-backfill.ts +56 -11
  110. package/src/peer-record.ts +16 -11
  111. package/src/pending-join-runner.ts +729 -735
  112. package/src/push-fanout.ts +8 -2
  113. package/src/seed-bootstrap.ts +344 -321
  114. package/src/seed-trust-policy.ts +353 -140
  115. package/src/strand-addr-protocol.ts +26 -35
  116. package/src/strand-formation-protocol.ts +1 -1
  117. package/src/strand-revocation-enforcer.ts +11 -11
  118. package/src/strand-wake-protocol.ts +13 -23
  119. package/src/trusted-owner-store.ts +242 -171
  120. package/src/types.ts +2471 -2242
@@ -1 +1 @@
1
- {"version":3,"file":"control-schema.js","sourceRoot":"","sources":["../src/control-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC"}
1
+ {"version":3,"file":"control-schema.js","sourceRoot":"","sources":["../src/control-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgyB7B,CAAC"}
@@ -30,6 +30,10 @@ export interface ControlStream extends AsyncIterable<Uint8Array> {
30
30
  send(data: Uint8Array): boolean;
31
31
  close(): Promise<void>;
32
32
  abort(err: Error): void;
33
+ /** Whether the remote has half-closed its write end (`'closed'`); absent on test doubles. */
34
+ readonly remoteWriteStatus?: string;
35
+ /** Bytes received and not yet read; absent on test doubles. */
36
+ readonly readBufferLength?: number;
33
37
  }
34
38
  /** Write a JSON object as a single 4-byte big-endian length-prefixed frame. */
35
39
  export declare function writeFrame(stream: ControlStream, obj: unknown): void;
@@ -170,16 +170,31 @@ export function readStreamToEnd(stream, opts) {
170
170
  const readLoop = collect(stream, maxBytes, label);
171
171
  return Promise.race([readLoop, timeout]).finally(() => clearTimeout(timer));
172
172
  }
173
- /** Accumulate every chunk to EOF, rejecting once the running total exceeds `maxBytes`. */
173
+ /**
174
+ * Accumulate every chunk to EOF, rejecting once the running total exceeds `maxBytes`.
175
+ *
176
+ * A remote that half-closed before this read began has already sent everything it will,
177
+ * so the read ends once those buffered bytes are in. Its own end-of-stream cannot be
178
+ * waited for: libp2p 3.3.11's stream iterator ends on the one-shot `remoteCloseWrite`
179
+ * event, and an iterator attached after it fired never ends. That happens to any handler
180
+ * that awaits before reading, as the control-protocol guard's live membership check makes
181
+ * the wake and strand-addr handlers do.
182
+ */
174
183
  async function collect(stream, maxBytes, label) {
175
184
  const chunks = [];
176
185
  let total = 0;
177
- for await (const chunk of stream) {
178
- const bytes = toBytes(chunk);
179
- chunks.push(bytes);
180
- total += bytes.length;
181
- if (total > maxBytes) {
182
- throw new Error(`${label} message too large: ${total} bytes exceeds max ${maxBytes}`);
186
+ const alreadySent = stream.remoteWriteStatus === 'closed' ? (stream.readBufferLength ?? 0) : undefined;
187
+ if (alreadySent !== 0) {
188
+ for await (const chunk of stream) {
189
+ const bytes = toBytes(chunk);
190
+ chunks.push(bytes);
191
+ total += bytes.length;
192
+ if (total > maxBytes) {
193
+ throw new Error(`${label} message too large: ${total} bytes exceeds max ${maxBytes}`);
194
+ }
195
+ if (alreadySent !== undefined && total >= alreadySent) {
196
+ break;
197
+ }
183
198
  }
184
199
  }
185
200
  const data = new Uint8Array(total);
@@ -1 +1 @@
1
-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AE,CAAC;gBACrB,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,uBAAuB,KAAK,sBAAsB,QAAQ,EAAE,CAAC,CAAC;YACxF,CAAC;YACD,IAAI,WAAW,KAAK,SAAS,IAAI,KAAK,IAAI,WAAW,EAAE,CAAC;gBACtD,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;IACzB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -21,7 +21,7 @@
21
21
  * granted delegate is admitted outright, never drawing on the small
22
22
  * unauthorized-reservation budget that unplaced peers share
23
23
  * (`membership-connection-gater.ts` → "The relay-reservation seam") and never
24
- * racing its not-reserving connection deadline. The fail-closed per-stream gate
24
+ * put on the provisional connection deadline. The fail-closed per-stream gate
25
25
  * (`authorizeInboundControlStream`) never honors a grant, so a delegate gets
26
26
  * the connection and its reservation (all a circuit-relay `hop` needs) and
27
27
  * nothing more.
@@ -21,7 +21,7 @@
21
21
  * granted delegate is admitted outright, never drawing on the small
22
22
  * unauthorized-reservation budget that unplaced peers share
23
23
  * (`membership-connection-gater.ts` → "The relay-reservation seam") and never
24
- * racing its not-reserving connection deadline. The fail-closed per-stream gate
24
+ * put on the provisional connection deadline. The fail-closed per-stream gate
25
25
  * (`authorizeInboundControlStream`) never honors a grant, so a delegate gets
26
26
  * the connection and its reservation (all a circuit-relay `hop` needs) and
27
27
  * nothing more.
@@ -9,15 +9,16 @@
9
9
  * encoding, so no field split is ambiguous even with an opaque platform token. It
10
10
  * is intentionally NOT JSON-canonicalized (deterministic across node/browser/RN,
11
11
  * no key ordering) and is reconstructable inside the `DeviceToken.AuthorizedUpdate`
12
- * SQL constraint from the row's own columns:
12
+ * SQL constraint from the row's own columns and the node-local `party_id()`:
13
13
  *
14
- * digest('CadreControl.DeviceToken', 'publish',
14
+ * digest('CadreControl.DeviceToken', 'publish', party_id(),
15
15
  * new.PeerId, new.Platform, new.Token, cast(new.UpdatedAt as text))
16
16
  *
17
17
  * Keep {@link deviceTokenSignedPayload} and that constraint byte-for-byte in sync.
18
18
  * The `'publish'` action tag marks this as a peer's SELF-signed record (signed with
19
19
  * the peer's own key, not an owner key) and keeps it disjoint from every
20
- * owner-signed digest.
20
+ * owner-signed digest; the party id keeps a record published into one party's table
21
+ * from verifying in another's (peer-record.ts says why a node uses its own party).
21
22
  *
22
23
  * Unlike a peer-address record, a device-token record carries NO public key: the
23
24
  * signature is verified against the `CadrePeer.PublicKey` bound to the same PeerId
@@ -30,21 +31,22 @@ import type { DeviceTokenRecord, PushPlatform } from './types.js';
30
31
  * `DeviceToken.AuthorizedUpdate` constraint exactly; both sides take the default
31
32
  * base64url output of a single `digest(...)`, which round-trips cleanly.
32
33
  */
33
- export declare function deviceTokenSignedPayload(record: Omit<DeviceTokenRecord, 'sig'>): string;
34
+ export declare function deviceTokenSignedPayload(partyId: string, record: Omit<DeviceTokenRecord, 'sig'>): string;
34
35
  /**
35
36
  * Sign a device-token record with the ed25519 private key behind its `peerId`.
36
37
  * Returns a fully-populated {@link DeviceTokenRecord}.
37
38
  *
39
+ * @param partyId - the party whose `DeviceToken` table the record is published into
38
40
  * @param fields - the record fields to sign
39
41
  * @param privateKeyB64 - base64url ed25519 seed (see `ed25519KeyPairFromLibp2p`)
40
42
  */
41
- export declare function signDeviceTokenRecord(fields: Omit<DeviceTokenRecord, 'sig'>, privateKeyB64: string): DeviceTokenRecord;
43
+ export declare function signDeviceTokenRecord(partyId: string, fields: Omit<DeviceTokenRecord, 'sig'>, privateKeyB64: string): DeviceTokenRecord;
42
44
  /**
43
45
  * Verify a record's self-signature against the `CadrePeer.PublicKey` (base64url)
44
- * bound to its `peerId`. Reconstructs the signed bytes from the record exactly as
45
- * {@link signDeviceTokenRecord} produced them. Returns false on a missing key/sig or
46
- * any verification failure.
46
+ * bound to its `peerId`, for `partyId`. Reconstructs the signed bytes from the record
47
+ * exactly as {@link signDeviceTokenRecord} produced them. Returns false on a missing
48
+ * key/sig or any verification failure.
47
49
  */
48
- export declare function verifyDeviceTokenSignature(record: DeviceTokenRecord, publicKeyB64: string): boolean;
50
+ export declare function verifyDeviceTokenSignature(partyId: string, record: DeviceTokenRecord, publicKeyB64: string): boolean;
49
51
  /** Narrow an arbitrary stored string to a known {@link PushPlatform}. */
50
52
  export declare function isPushPlatform(value: string): value is PushPlatform;
@@ -9,15 +9,16 @@
9
9
  * encoding, so no field split is ambiguous even with an opaque platform token. It
10
10
  * is intentionally NOT JSON-canonicalized (deterministic across node/browser/RN,
11
11
  * no key ordering) and is reconstructable inside the `DeviceToken.AuthorizedUpdate`
12
- * SQL constraint from the row's own columns:
12
+ * SQL constraint from the row's own columns and the node-local `party_id()`:
13
13
  *
14
- * digest('CadreControl.DeviceToken', 'publish',
14
+ * digest('CadreControl.DeviceToken', 'publish', party_id(),
15
15
  * new.PeerId, new.Platform, new.Token, cast(new.UpdatedAt as text))
16
16
  *
17
17
  * Keep {@link deviceTokenSignedPayload} and that constraint byte-for-byte in sync.
18
18
  * The `'publish'` action tag marks this as a peer's SELF-signed record (signed with
19
19
  * the peer's own key, not an owner key) and keeps it disjoint from every
20
- * owner-signed digest.
20
+ * owner-signed digest; the party id keeps a record published into one party's table
21
+ * from verifying in another's (peer-record.ts says why a node uses its own party).
21
22
  *
22
23
  * Unlike a peer-address record, a device-token record carries NO public key: the
23
24
  * signature is verified against the `CadrePeer.PublicKey` bound to the same PeerId
@@ -31,33 +32,34 @@ import { controlAuthorizationFields } from './control-authorization.js';
31
32
  * `DeviceToken.AuthorizedUpdate` constraint exactly; both sides take the default
32
33
  * base64url output of a single `digest(...)`, which round-trips cleanly.
33
34
  */
34
- export function deviceTokenSignedPayload(record) {
35
- const fields = controlAuthorizationFields('CadreControl.DeviceToken', 'publish', [record.peerId, record.platform, record.token, String(record.updatedAt)]);
35
+ export function deviceTokenSignedPayload(partyId, record) {
36
+ const fields = controlAuthorizationFields('CadreControl.DeviceToken', 'publish', partyId, [record.peerId, record.platform, record.token, String(record.updatedAt)]);
36
37
  return digest(fields, 'sha256', 'base64url');
37
38
  }
38
39
  /**
39
40
  * Sign a device-token record with the ed25519 private key behind its `peerId`.
40
41
  * Returns a fully-populated {@link DeviceTokenRecord}.
41
42
  *
43
+ * @param partyId - the party whose `DeviceToken` table the record is published into
42
44
  * @param fields - the record fields to sign
43
45
  * @param privateKeyB64 - base64url ed25519 seed (see `ed25519KeyPairFromLibp2p`)
44
46
  */
45
- export function signDeviceTokenRecord(fields, privateKeyB64) {
46
- const payloadDigest = deviceTokenSignedPayload(fields);
47
+ export function signDeviceTokenRecord(partyId, fields, privateKeyB64) {
48
+ const payloadDigest = deviceTokenSignedPayload(partyId, fields);
47
49
  const sig = sign(payloadDigest, privateKeyB64, 'ed25519', 'base64url', 'base64url', 'base64url');
48
50
  return { peerId: fields.peerId, platform: fields.platform, token: fields.token, updatedAt: fields.updatedAt, sig };
49
51
  }
50
52
  /**
51
53
  * Verify a record's self-signature against the `CadrePeer.PublicKey` (base64url)
52
- * bound to its `peerId`. Reconstructs the signed bytes from the record exactly as
53
- * {@link signDeviceTokenRecord} produced them. Returns false on a missing key/sig or
54
- * any verification failure.
54
+ * bound to its `peerId`, for `partyId`. Reconstructs the signed bytes from the record
55
+ * exactly as {@link signDeviceTokenRecord} produced them. Returns false on a missing
56
+ * key/sig or any verification failure.
55
57
  */
56
- export function verifyDeviceTokenSignature(record, publicKeyB64) {
58
+ export function verifyDeviceTokenSignature(partyId, record, publicKeyB64) {
57
59
  if (!publicKeyB64 || !record.sig) {
58
60
  return false;
59
61
  }
60
- const payloadDigest = deviceTokenSignedPayload(record);
62
+ const payloadDigest = deviceTokenSignedPayload(partyId, record);
61
63
  return verify(payloadDigest, record.sig, publicKeyB64, 'ed25519', 'base64url', 'base64url', 'base64url');
62
64
  }
63
65
  /** Narrow an arbitrary stored string to a known {@link PushPlatform}. */
@@ -1 +1 @@
1
- {"version":3,"file":"device-token.js","sourceRoot":"","sources":["../src/device-token.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAGxE;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAsC;IAC7E,MAAM,MAAM,GAAG,0BAA0B,CACvC,0BAA0B,EAC1B,SAAS,EACT,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CACzE,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,CAAW,CAAC;AACzD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAAsC,EACtC,aAAqB;IAErB,MAAM,aAAa,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACvD,MAAM,GAAG,GAAG,IAAI,CACd,aAAa,EACb,aAAa,EACb,SAAS,EACT,WAAW,EACX,WAAW,EACX,WAAW,CACF,CAAC;IACZ,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC;AACrH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAyB,EAAE,YAAoB;IACxF,IAAI,CAAC,YAAY,IA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AC;IACZ,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC;AACrH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAAe,EAAE,MAAyB,EAAE,YAAoB;IACzG,IAAI,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,aAAa,GAAG,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAChE,OAAO,MAAM,CACX,aAAa,EACb,MAAM,CAAC,GAAG,EACV,YAAY,EACZ,SAAS,EACT,WAAW,EACX,WAAW,EACX,WAAW,CACZ,CAAC;AACJ,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,OAAO,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,MAAM,CAAC;AAC7C,CAAC"}
@@ -40,6 +40,21 @@ export declare function ed25519KeyPairFromLibp2p(privateKey: PrivateKey): Ed2551
40
40
  * @returns The base64url-encoded Ed25519 public key.
41
41
  */
42
42
  export declare function ed25519PublicKeyFromPrivate(privateKeyB64: string): string;
43
+ /**
44
+ * Derive the base64url ed25519 public key embedded in an Ed25519 libp2p PeerId.
45
+ *
46
+ * An Ed25519 PeerId is an identity multihash of the public key, so
47
+ * `peerIdFromString(id).publicKey.raw` is the 32-byte ed25519 key whose
48
+ * base64url form matches the `OwnerKey.Key` representation (and
49
+ * `ed25519KeyPairFromLibp2p().publicKeyB64`). Returns null for a non-Ed25519
50
+ * id, a missing embedded key, or any parse failure — callers treat null as
51
+ * "not an owner" rather than throwing.
52
+ *
53
+ * Lives here, beside the other key bridges, so the lightweight verifiers in
54
+ * `peer-authorization.ts` can check a stored `PeerKey` against a row's `PeerId`
55
+ * without importing the seed-bootstrap runtime.
56
+ */
57
+ export declare function ed25519PublicKeyB64FromPeerId(peerId: string): string | null;
43
58
  /**
44
59
  * Reject a value that isn't shaped like a base64url-encoded 32-byte Ed25519 public key
45
60
  * before it reaches the control database, where a malformed key would otherwise sit
@@ -1,5 +1,6 @@
1
1
  import { toString as uint8ArrayToString, fromString as uint8ArrayFromString } from 'uint8arrays';
2
2
  import { getPublicKey } from '@optimystic/quereus-plugin-crypto';
3
+ import { peerIdFromString } from '@libp2p/peer-id';
3
4
  /**
4
5
  * Bridge a libp2p Ed25519 private key into the base64url keypair used by the
5
6
  * control- and strand-database signing constraints.
@@ -48,11 +49,37 @@ export function ed25519KeyPairFromLibp2p(privateKey) {
48
49
  export function ed25519PublicKeyFromPrivate(privateKeyB64) {
49
50
  return getPublicKey(privateKeyB64, 'ed25519', 'base64url', 'base64url');
50
51
  }
52
+ /**
53
+ * Derive the base64url ed25519 public key embedded in an Ed25519 libp2p PeerId.
54
+ *
55
+ * An Ed25519 PeerId is an identity multihash of the public key, so
56
+ * `peerIdFromString(id).publicKey.raw` is the 32-byte ed25519 key whose
57
+ * base64url form matches the `OwnerKey.Key` representation (and
58
+ * `ed25519KeyPairFromLibp2p().publicKeyB64`). Returns null for a non-Ed25519
59
+ * id, a missing embedded key, or any parse failure — callers treat null as
60
+ * "not an owner" rather than throwing.
61
+ *
62
+ * Lives here, beside the other key bridges, so the lightweight verifiers in
63
+ * `peer-authorization.ts` can check a stored `PeerKey` against a row's `PeerId`
64
+ * without importing the seed-bootstrap runtime.
65
+ */
66
+ export function ed25519PublicKeyB64FromPeerId(peerId) {
67
+ try {
68
+ const parsed = peerIdFromString(peerId);
69
+ if (parsed.type !== 'Ed25519' || !parsed.publicKey) {
70
+ return null;
71
+ }
72
+ return uint8ArrayToString(parsed.publicKey.raw, 'base64url');
73
+ }
74
+ catch {
75
+ return null;
76
+ }
77
+ }
51
78
  /** Longest rejected key value echoed back in an error — a real key is 43 base64url chars. */
52
79
  const REJECTED_VALUE_ECHO_LIMIT = 64;
53
80
  /**
54
81
  * Render a rejected value for an error message, capped: owner keys now reach this check
55
- * from remote-supplied fields (a `CadreInvite`'s `ownerKeys`, a donation request's
82
+ * from remote-supplied fields (a cadre invitation's `ownerKeys`, a donation request's
56
83
  * `ownerKeys`), so an unbounded echo would let a peer turn one junk string into a
57
84
  * megabyte of log line.
58
85
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ed25519-key.js","sourceRoot":"","sources":["../src/ed25519-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAgBjE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,wBAAwB,CAAC,UAAsB;IAC7D,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,yDAAyD,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC;IAC3B,IAAI,GAAG,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,kEAAkE,GAAG,CAAC,MAAM,QAAQ,CAAC,CAAC;IACxG,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACjC,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC;IAC9C,IAAI,YAAY,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,8CAA8C,YAAY,CAAC,MAAM,QAAQ,CAAC,CAAC;IAC7F,CAAC;IAED,OAAO;QACL,aAAa,EAAE,kBAAkB,CAAC,IAAI,EAAE,WAAW,C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QACf,MAAM,IAAI,KAAK,CACb,KAAK,KAAK,sEAAsE,gBAAgB,CAAC,OAAO,CAAC,iBAAiB,EAC1H,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,KAAK,KAAK,6DAA6D,gBAAgB,CAAC,OAAO,CAAC,gBAAgB,OAAO,CAAC,MAAM,SAAS,CACxI,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  export * from './types.js';
2
2
  export { canonicalJson } from './canonical-json.js';
3
- export { CadreNode } from './cadre-node.js';
4
- export { ControlDatabase, MissingHostStrandError, buildAuthorizationMessage, formationVouchMessage, formationConsentMessage, REAPABLE_TABLES, type ReapableTable, type ControlDatabaseConfig, type ControlTable, type RevocableTable, type FormationUsageResult, type MembershipChangeListener, type GuardedDeleteListener, type ControlWriteAbandonedListener, type RevokedRowRef } from './control-database.js';
3
+ export { CadreNode, OWNER_INVITATION_DEFAULT_TTL_MS, CADRE_INVITATION_DEFAULT_TTL_MS } from './cadre-node.js';
4
+ export { ControlDatabase, MissingHostStrandError, InvitationExhaustedError, CadreInviteIssuerUnknownError, buildAuthorizationMessage, registerPartyIdFunction, formationVouchMessage, formationConsentMessage, cadreInviteAddMessage, cadreInviteRedeemMessage, cadreInviteConsentMessage, projectSeedPeers, REAPABLE_TABLES, type ReapableTable, type ControlDatabaseConfig, type ControlTable, type RevocableTable, type FormationUsageResult, type MembershipChangeListener, type GuardedDeleteListener, type ControlWriteAbandonedListener, type RevokedRowRef } from './control-database.js';
5
5
  export { CONTROL_WRITE_ATTEMPTS, CONTROL_WRITE_RETRY_BUDGET_MS, SCHEMA_INIT_ATTEMPTS, SCHEMA_INIT_RETRY_POLICY, isRetriableControlWriteFailure, isRetriableSchemaInitFailure, retryControlWrite, type ControlWriteRetryOptions } from './control-write-retry.js';
6
6
  export { CONTROL_READ_ATTEMPTS, CONTROL_READ_RETRY_DELAYS_MS, CONTROL_READ_RETRY_BUDGET_MS, isRetriableControlReadFailure, retryControlRead, type ControlReadRetryOptions } from './control-read-retry.js';
7
7
  export type { ControlRetryAbandonment, ControlRetryAbandonReason, ControlRetryAbandonListener } from './control-retry.js';
8
- export { controlAuthorizationFields, type ControlDomain, type ControlAction } from './control-authorization.js';
9
- export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, requireEd25519PublicKeyB64, type Ed25519KeyPair } from './ed25519-key.js';
8
+ export { controlAuthorizationFields, unboundAuthorizationFields, cadreInviteRowFields, type ControlDomain, type BoundControlDomain, type UnboundControlDomain, type ControlAction, type CadreInviteSignedFields } from './control-authorization.js';
9
+ export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, ed25519PublicKeyB64FromPeerId, requireEd25519PublicKeyB64, type Ed25519KeyPair } from './ed25519-key.js';
10
10
  export { InMemoryKeyStore, KeyStoreAccessError, DEFAULT_IDENTITY_KEY_ID, type KeyStore, type KeyId } from './key-store.js';
11
11
  export { loadOrCreateIdentityKey } from './identity-key.js';
12
12
  export { MemoryTrustedOwnerStore, PersistentTrustedOwnerStore, type TrustedOwnerStore, type TrustSource } from './trusted-owner-store.js';
@@ -36,8 +36,9 @@ export { generateStrandMemberKey, strandMemberKeyPair } from './strand-member-ke
36
36
  export { signStrandPayload, verifyStrandPayload, signStrandApproval, generateStrandStampId, bootstrapFounderMembership, PreSplitStrandIdentityError, issueInvite, consumeInvite, burnInvite, isStrandMember, cancelInvite, listOutstandingInvites, addMemberByManager, revokeMember, leaveStrand, registerMemberPeer, listMemberPeers, removeMemberPeer, addManager, admitManager, removeManager, sealStrand, isStrandSealed, StrandTransactionBusyError, STRAND_ENGINE, STRAND_ENGINE_VERSION, type FounderBootstrapParams, type IssueInviteParams, type IssuedInvite, type ConsumeInviteParams, type CancelInviteParams, type OutstandingInvite, type AddMemberByManagerParams, type RevokeMemberParams, type LeaveStrandParams, type RegisterMemberPeerParams, type RemoveOwnPeerParams, type RemoveMemberPeerByManagerParams, type RemoveMemberPeerParams, type AddManagerParams, type AdmitManagerParams, type RemoveManagerParams, type SealStrandParams, type StrandWriteOptions } from './strand-membership-writer.js';
37
37
  export { canonicalDatetime } from './canonical-datetime.js';
38
38
  export { StrandMemberRegistry, StrandMemberVerifier, memberRegistrationPayload, type StrandAdmission } from './strand-member-registry.js';
39
- export { SeedBootstrapService, SEED_PROTOCOL, ed25519PublicKeyB64FromPeerId, type SeedBootstrapConfig, type SeedEventCallbacks } from './seed-bootstrap.js';
40
- export { peerAuthorizationDigest, cadrePeerVoucherDigest, cadrePeerRemoveDigest, deviceTokenAddDigest, deviceTokenRemoveDigest, formationConsentDigest, verifyPeerAuthorization, verifyCadrePeerVoucher, verifyFormationConsent, type DeviceTokenAuthorizedRow } from './peer-authorization.js';
39
+ export { SeedBootstrapService, SEED_PROTOCOL, mergeSeedPeers, seedDigest, type SeedBootstrapConfig, type SeedEventCallbacks } from './seed-bootstrap.js';
40
+ export { peerAuthorizationDigest, cadrePeerVoucherDigest, cadrePeerRemoveDigest, deviceTokenAddDigest, deviceTokenRemoveDigest, formationConsentDigest, cadreInviteAddDigest, cadreInviteRedeemDigest, cadreInviteConsentDigest, ownerKeyAddDigest, verifyPeerAuthorization, verifyCadrePeerVoucher, verifyOwnerKeyVoucher, verifyRevocationSigner, verifyFormationConsent, verifyInvitationAdmission, verifyInvitationOwnerAdmission, verifyCadreInviteRow, verifyCadreInviteRedemption, type DeviceTokenAuthorizedRow } from './peer-authorization.js';
41
+ export { deriveOwnerAnchor, type OwnerAnchorInputs, type OwnerAnchorDerivation } from './owner-anchor-sync.js';
41
42
  export { StrandWakeService, dialWake, WAKE_PROTOCOL, DEFAULT_WAKE_DIAL_BUDGET_MS, type StrandWakeServiceOptions, type DialWakeOptions } from './strand-wake-protocol.js';
42
43
  export { StrandAddrService, collectStrandAddrs, STRAND_ADDR_PROTOCOL, type StrandAddrServiceOptions, type StrandAddrPeer, type CollectStrandAddrsOptions, type StrandAddrOutcome, type StrandAddrCollection } from './strand-addr-protocol.js';
43
44
  export { peerRecordSignedPayload, signPeerRecord, verifyPeerRecordSignature, isPeerRecordFresh, isSignalingAddr, orderSignalingFirst, withTrailingPeerId, currentMemberTrustPolicy, DEFAULT_PEER_RECORD_MAX_AGE_MS, DEFAULT_PEER_RECORD_HEARTBEAT_MS } from './peer-record.js';
@@ -47,16 +48,20 @@ export type { PushNotifier, PushMessage, PushSendResult } from './push-notifier.
47
48
  export { validatePushCredentials, redactPushCredentials, REDACTED } from './push-credentials.js';
48
49
  export { PushFanoutService, DEFAULT_PUSH_COOLDOWN_MS, DEFAULT_PUSH_DEBOUNCE_MS, type PushFanoutOptions, type FanoutMember } from './push-fanout.js';
49
50
  export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE, type ControlCohortSelection, type ControlCohortReconcileResult } from './control-cohort.js';
50
- export { dialPeerAddrs, SelfRelayOnlyError, tryAddrsInTurn, directBeforeRelayed, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS, CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS, DEFAULT_PEER_DIAL_BUDGET, type PeerDialBudget, type AddrDialer } from './peer-dial.js';
51
+ export { dialPeerAddrs, SelfRelayOnlyError, PeerUnreachableError, tryAddrsInTurn, directBeforeRelayed, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS, CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS, DEFAULT_PEER_DIAL_BUDGET, type PeerDialBudget, type AddrDialer } from './peer-dial.js';
51
52
  export { DECLARED_LINK_ROUND_TRIP_MS, CIRCUIT_DIAL_ROUND_TRIPS, RELAY_DIAL_ROUND_TRIPS, RELAYED_DIAL_ROUND_TRIPS, RELAY_RESERVATION_ROUND_TRIPS, CIRCUIT_REQUEST_ROUND_TRIPS, RELAYED_REQUEST_ROUND_TRIPS, PUSH_TRANSFER_ALLOWANCE_MS, ADMISSION_DECISION_TIMEOUT_MS, resolveLinkRoundTripMs, relayedDialBudgetMs, relayReservationBudgetMs, circuitRequestBudgetMs, relayedRequestBudgetMs, peerJoinPushBudget, type PeerJoinPushBudget, DIAL_ADMISSION_DECISIONS, optimysticDialLimits, type OptimysticDialLimits } from './link-budget.js';
52
- export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy, type SeedTrustPolicy, type SeedTrustContext, type SeedTrustDecision } from './seed-trust-policy.js';
53
+ export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy, claimSecretTrustPolicy, type SeedTrustPolicy, type SeedTrustContext, type SeedTrustDecision, type ClaimSecretTrustPolicyOptions } from './seed-trust-policy.js';
54
+ export { parseClaimSecret, claimProof, verifyClaimProof, ClaimRefusedError, CLAIM_SECRET_BYTES } from './claim-proof.js';
55
+ export { encodeNodeClaimPayload, decodeNodeClaimPayload, NODE_CLAIM_PAYLOAD_PREFIX, type NodeClaimPayload } from './node-claim-payload.js';
53
56
  export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
54
57
  export { FormationListener, dialFormation, dialFormationByMachine, isValidResponderCreatesResult, isWellFormedMembershipInvite, sanitizeStrandAddrs, FORMATION_PROTOCOL, type FormationParty, type FormationContactMessage, type FormationResultMessage, type FormationProvisionResult, type FormationStrandInfo, type FormationDbConnectionInfo, type FormationListenerOptions, type FormationDialOptions, type FormationDialResult, type FormationRejection, type FormationTokenCheck, type ResponderProvisionOutcome } from './strand-formation-protocol.js';
55
58
  export { FormationRejectedError, FormationUnreachableError, FormationPostApprovalError, FORMATION_REJECTION_RETRYABLE, isFormationRejectionCode, type FormationRejectionCode } from './strand-formation-rejection.js';
56
59
  export { formationDeadlines, type FormationDeadlines } from './strand-formation-deadlines.js';
60
+ export { CadreInviteHandler, redeemAtMembers, signRedeemRequest, verifyRedeemReply, encodeCadreInvitation, decodeCadreInvitation, isWellFormedCadreInviteRow, sanitizeAddrs, CadreInviteRejectedError, CadreInviteUnreachableError, CadreInviteReplyInvalidError, CADRE_INVITE_PROTOCOL, CADRE_INVITE_REJECTION_RETRYABLE, isCadreInviteRejectionCode, type CadreInvitation, type CadreInviteRedeemRequest, type CadreInviteRedeemReply, type CadreInviteAccepted, type CadreInviteRejectionCode, type CadreInviteAddressOutcome, type CadreInviteHandlerOptions, type CadreInviteStore, type RedeemAtMembersOptions, type RedeemSigner, type CadreInviteRedemption } from './cadre-invite-protocol.js';
57
61
  export { PENDING_JOIN_POLL_MS, PENDING_JOIN_MAX_BACKOFF_MS, MAX_PENDING_JOIN_MS } from './pending-join-runner.js';
58
62
  export { StrandFormationManager, createStrandFormationManager, MEMBERSHIP_INVITE_TTL_MS, MEMBERSHIP_INVITE_UNAVAILABLE_REASON, HOST_STRAND_MUST_BE_RECREATED_REASON, type CadrePeerAddrsSource, type MembershipInviteIssuer, type StrandFormationManagerConfig, type StrandFormationManagerOptions } from './strand-formation-manager.js';
59
- export { createMembershipConnectionGater, STRANGER_OPEN_PROTOCOLS, DEFAULT_ENROLLMENT_WINDOW_MS, RELAY_ADMISSION_RESERVE_DEADLINE_MS, RELAY_ADMISSION_CLOSE_TIMEOUT_MS, MAX_UNAUTHORIZED_RELAY_RESERVATIONS, UnauthorizedReservationBudget, type InboundAdmissionPolicy, type InboundConnectionVerdict } from './membership-connection-gater.js';
63
+ export { controlProtocolClasses, type ControlProtocolClass } from './control-protocol-guard.js';
64
+ export { createMembershipConnectionGater, PROVISIONAL_ADMISSION_DEADLINE_MS, PROVISIONAL_ADMISSION_CLOSE_TIMEOUT_MS, MAX_UNAUTHORIZED_RELAY_RESERVATIONS, UnauthorizedReservationBudget, type InboundAdmissionPolicy, type InboundConnectionVerdict } from './membership-connection-gater.js';
60
65
  export { RelayReservationFailedError, UnbindableListenAddressError, RELAY_SEARCH_LISTEN_ADDR, resolveListenAddrs } from './relay-addrs.js';
61
66
  export { strandNodeAddrs, type StrandNodeAddrs } from './strand-network-config.js';
62
67
  export { RELAY_STUN_PORT, relayStunUrl, resolveStunServers, type StunServer } from './relay-stun.js';
package/dist/index.js CHANGED
@@ -3,9 +3,9 @@ export * from './types.js';
3
3
  // Canonical JSON serialization (shared signing payload format)
4
4
  export { canonicalJson } from './canonical-json.js';
5
5
  // Main CadreNode class
6
- export { CadreNode } from './cadre-node.js';
6
+ export { CadreNode, OWNER_INVITATION_DEFAULT_TTL_MS, CADRE_INVITATION_DEFAULT_TTL_MS } from './cadre-node.js';
7
7
  // Control database
8
- export { ControlDatabase, MissingHostStrandError, buildAuthorizationMessage, formationVouchMessage, formationConsentMessage, REAPABLE_TABLES } from './control-database.js';
8
+ export { ControlDatabase, MissingHostStrandError, InvitationExhaustedError, CadreInviteIssuerUnknownError, buildAuthorizationMessage, registerPartyIdFunction, formationVouchMessage, formationConsentMessage, cadreInviteAddMessage, cadreInviteRedeemMessage, cadreInviteConsentMessage, projectSeedPeers, REAPABLE_TABLES } from './control-database.js';
9
9
  // Bounded retry for transient control-write failures (classifier + loop behind
10
10
  // ControlDatabase.lockedWithRetry; exported so the integration package can drive the
11
11
  // classifier against real engine errors)
@@ -14,9 +14,9 @@ export { CONTROL_WRITE_ATTEMPTS, CONTROL_WRITE_RETRY_BUDGET_MS, SCHEMA_INIT_ATTE
14
14
  // ControlDatabase.readRows; the loop is shared with the write side via control-retry.ts)
15
15
  export { CONTROL_READ_ATTEMPTS, CONTROL_READ_RETRY_DELAYS_MS, CONTROL_READ_RETRY_BUDGET_MS, isRetriableControlReadFailure, retryControlRead } from './control-read-retry.js';
16
16
  // Control-plane authorization field vector (the domain/action tagging every signer shares)
17
- export { controlAuthorizationFields } from './control-authorization.js';
17
+ export { controlAuthorizationFields, unboundAuthorizationFields, cadreInviteRowFields } from './control-authorization.js';
18
18
  // Ed25519 key bridge (libp2p Ed25519 -> base64url keypair)
19
- export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, requireEd25519PublicKeyB64 } from './ed25519-key.js';
19
+ export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, ed25519PublicKeyB64FromPeerId, requireEd25519PublicKeyB64 } from './ed25519-key.js';
20
20
  // Pluggable key store (backend-agnostic identity/owner key material seam).
21
21
  // Dependency-free: the interface, error, default slot id, and in-memory backend
22
22
  // are safe in every (RN/browser/Node) entry graph. The Node FileKeyStore is a
@@ -127,9 +127,13 @@ export { canonicalDatetime } from './canonical-datetime.js';
127
127
  // MemberVerifier that write/read the real Strand.* membership tables.
128
128
  export { StrandMemberRegistry, StrandMemberVerifier, memberRegistrationPayload } from './strand-member-registry.js';
129
129
  // Seed Bootstrap
130
- export { SeedBootstrapService, SEED_PROTOCOL, ed25519PublicKeyB64FromPeerId } from './seed-bootstrap.js';
130
+ export { SeedBootstrapService, SEED_PROTOCOL, mergeSeedPeers, seedDigest } from './seed-bootstrap.js';
131
131
  // Peer Authorization (shared owner-signature digest + offline verifier)
132
- export { peerAuthorizationDigest, cadrePeerVoucherDigest, cadrePeerRemoveDigest, deviceTokenAddDigest, deviceTokenRemoveDigest, formationConsentDigest, verifyPeerAuthorization, verifyCadrePeerVoucher, verifyFormationConsent } from './peer-authorization.js';
132
+ export { peerAuthorizationDigest, cadrePeerVoucherDigest, cadrePeerRemoveDigest, deviceTokenAddDigest, deviceTokenRemoveDigest, formationConsentDigest, cadreInviteAddDigest, cadreInviteRedeemDigest, cadreInviteConsentDigest, ownerKeyAddDigest, verifyPeerAuthorization, verifyCadrePeerVoucher, verifyOwnerKeyVoucher, verifyRevocationSigner, verifyFormationConsent, verifyInvitationAdmission, verifyInvitationOwnerAdmission, verifyCadreInviteRow, verifyCadreInviteRedemption } from './peer-authorization.js';
133
+ // How the trusted-owner anchor follows the replicated OwnerKey table along verifiable
134
+ // chains: the pure derivation rule `CadreNode.syncOwnerAnchor` applies on every membership
135
+ // refresh (owner-anchor-sync.ts).
136
+ export { deriveOwnerAnchor } from './owner-anchor-sync.js';
133
137
  // Strand Wake (control-network push-wake protocol)
134
138
  export { StrandWakeService, dialWake, WAKE_PROTOCOL, DEFAULT_WAKE_DIAL_BUDGET_MS } from './strand-wake-protocol.js';
135
139
  // Strand Address (control-network strand-address RPC) — wire types come via
@@ -154,12 +158,21 @@ export { PushFanoutService, DEFAULT_PUSH_COOLDOWN_MS, DEFAULT_PUSH_DEBOUNCE_MS }
154
158
  export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE } from './control-cohort.js';
155
159
  // Dialing one peer from several candidate addresses, each under its own time
156
160
  // limit, so an address that never answers cannot starve the rest.
157
- export { dialPeerAddrs, SelfRelayOnlyError, tryAddrsInTurn, directBeforeRelayed, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS, CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS, DEFAULT_PEER_DIAL_BUDGET } from './peer-dial.js';
161
+ export { dialPeerAddrs, SelfRelayOnlyError, PeerUnreachableError, tryAddrsInTurn, directBeforeRelayed, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS, CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS, DEFAULT_PEER_DIAL_BUDGET } from './peer-dial.js';
158
162
  // Dial and reservation budgets counted in link round trips rather than fixed milliseconds, so
159
163
  // one declared assumption about the link moves them all — see `NetworkConfig.linkRoundTripMs`.
160
164
  export { DECLARED_LINK_ROUND_TRIP_MS, CIRCUIT_DIAL_ROUND_TRIPS, RELAY_DIAL_ROUND_TRIPS, RELAYED_DIAL_ROUND_TRIPS, RELAY_RESERVATION_ROUND_TRIPS, CIRCUIT_REQUEST_ROUND_TRIPS, RELAYED_REQUEST_ROUND_TRIPS, PUSH_TRANSFER_ALLOWANCE_MS, ADMISSION_DECISION_TIMEOUT_MS, resolveLinkRoundTripMs, relayedDialBudgetMs, relayReservationBudgetMs, circuitRequestBudgetMs, relayedRequestBudgetMs, peerJoinPushBudget, DIAL_ADMISSION_DECISIONS, optimysticDialLimits } from './link-budget.js';
161
165
  // Seed trust policy (trust anchor for incoming seeds)
162
- export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy } from './seed-trust-policy.js';
166
+ export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy, claimSecretTrustPolicy } from './seed-trust-policy.js';
167
+ // Claim proof: how a brand-new node's first seed proves its sender holds the node's
168
+ // one-time claim secret. The owner side builds the proof over `seedDigest` (exported
169
+ // with the seed bootstrap above); `claimSecretTrustPolicy` verifies it.
170
+ // `ClaimRefusedError` is what `CadreNode.claimNode` throws when the node said no;
171
+ // `PeerUnreachableError` (exported with the peer dial above) when it was never reached.
172
+ export { parseClaimSecret, claimProof, verifyClaimProof, ClaimRefusedError, CLAIM_SECRET_BYTES } from './claim-proof.js';
173
+ // The claim payload: the node's peer id, addresses and claim secret as the text a host
174
+ // shows as a QR code and a phone scans (`CadreNode.claimNode` takes the decoded form).
175
+ export { encodeNodeClaimPayload, decodeNodeClaimPayload, NODE_CLAIM_PAYLOAD_PREFIX } from './node-claim-payload.js';
163
176
  // Schema Verification
164
177
  export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
165
178
  // Strand Formation transport (native cadre-core protocol)
@@ -167,12 +180,17 @@ export { FormationListener, dialFormation, dialFormationByMachine, isValidRespon
167
180
  // How a formation dial fails: a typed refusal (with a fixed code) or no answer at all
168
181
  export { FormationRejectedError, FormationUnreachableError, FormationPostApprovalError, FORMATION_REJECTION_RETRYABLE, isFormationRejectionCode } from './strand-formation-rejection.js';
169
182
  export { formationDeadlines } from './strand-formation-deadlines.js';
183
+ // Cadre invitation redemption transport: the bundle an owner hands out, the wire messages, the
184
+ // member-side handler and the device-side dialer, and how a redemption fails
185
+ export { CadreInviteHandler, redeemAtMembers, signRedeemRequest, verifyRedeemReply, encodeCadreInvitation, decodeCadreInvitation, isWellFormedCadreInviteRow, sanitizeAddrs, CadreInviteRejectedError, CadreInviteUnreachableError, CadreInviteReplyInvalidError, CADRE_INVITE_PROTOCOL, CADRE_INVITE_REJECTION_RETRYABLE, isCadreInviteRejectionCode } from './cadre-invite-protocol.js';
170
186
  // The pending-join retry loop behind CadreNode.requestJoin (PendingJoinStatus is in types.ts)
171
187
  export { PENDING_JOIN_POLL_MS, PENDING_JOIN_MAX_BACKOFF_MS, MAX_PENDING_JOIN_MS } from './pending-join-runner.js';
172
188
  // Strand Formation manager (drives the native transport)
173
189
  export { StrandFormationManager, createStrandFormationManager, MEMBERSHIP_INVITE_TTL_MS, MEMBERSHIP_INVITE_UNAVAILABLE_REASON, HOST_STRAND_MUST_BE_RECREATED_REASON } from './strand-formation-manager.js';
190
+ // Control-network per-stream protocol guard (which peers may open which protocol)
191
+ export { controlProtocolClasses } from './control-protocol-guard.js';
174
192
  // Control-network inbound connection gate (membership defense-in-depth)
175
- export { createMembershipConnectionGater, STRANGER_OPEN_PROTOCOLS, DEFAULT_ENROLLMENT_WINDOW_MS, RELAY_ADMISSION_RESERVE_DEADLINE_MS, RELAY_ADMISSION_CLOSE_TIMEOUT_MS, MAX_UNAUTHORIZED_RELAY_RESERVATIONS, UnauthorizedReservationBudget } from './membership-connection-gater.js';
193
+ export { createMembershipConnectionGater, PROVISIONAL_ADMISSION_DEADLINE_MS, PROVISIONAL_ADMISSION_CLOSE_TIMEOUT_MS, MAX_UNAUTHORIZED_RELAY_RESERVATIONS, UnauthorizedReservationBudget } from './membership-connection-gater.js';
176
194
  // Thrown out of `CadreNode.start()` when a `network.relayAddrs` reservation does
177
195
  // not land on its first attempt — the fail-fast posture of that config field now
178
196
  // that the control node reserves AFTER control-database bring-up (relay-addrs.ts).
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,cAAc,YAAY,CAAC;AAE3B,+DAA+D;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,uBAAuB;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,mBAAmB;AACnB,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,eAAe,EAAwO,MAAM,uBAAuB,CAAC;AAElZ,+EAA+E;AAC/E,qFAAqF;AACrF,yCAAyC;AACzC,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,oBAAoB,EACpB,wBAAwB,EACxB,8BAA8B,EAC9B,4BAA4B,EAC5B,iBAAiB,EAElB,MAAM,0BAA0B,CAAC;AAElC,gFAAgF;AAChF,yFAAyF;AACzF,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,4BAA4B,EAC5B,6BAA6B,EAC7B,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AAWjC,2FAA2F;AAC3F,OAAO,EAAE,0BAA0B,EAA0C,MAAM,4BAA4B,CAAC;AAEhH,2DAA2D;AAC3D,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,0BAA0B,EAAuB,MAAM,kBAAkB,CAAC;AAE1I,2EAA2E;AAC3E,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,2BAA2B;AAC3B,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EAGxB,MAAM,gBAAgB,CAAC;AAExB,8EAA8E;AAC9E,sCAAsC;AACtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,2EAA2E;AAC3E,+EAA+E;AAC/E,2EAA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ACxE,OAAO,EACL,+BAA+B,EAC/B,iCAAiC,EACjC,sCAAsC,EACtC,mCAAmC,EACnC,6BAA6B,EAG9B,MAAM,kCAAkC,CAAC;AAE1C,iFAAiF;AACjF,iFAAiF;AACjF,mFAAmF;AACnF,sFAAsF;AACtF,uFAAuF;AACvF,yEAAyE;AACzE,EAAE;AACF,qFAAqF;AACrF,qFAAqF;AACrF,uFAAuF;AACvF,wFAAwF;AACxF,wFAAwF;AACxF,YAAY;AACZ,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAwB,MAAM,4BAA4B,CAAC;AACnF,yFAAyF;AACzF,8DAA8D;AAC9D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAmB,MAAM,iBAAiB,CAAC;AACrG,2FAA2F;AAC3F,8FAA8F;AAC9F,+EAA+E;AAC/E,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC5B,8BAA8B,EAG/B,MAAM,mBAAmB,CAAC;AAE3B,gFAAgF;AAChF,0EAA0E;AAC1E,6BAA6B;AAC7B,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,gCAAgC,EAChC,6BAA6B,EAC7B,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAM7B,MAAM,wBAAwB,CAAC;AAEhC,2EAA2E;AAC3E,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EAMzB,MAAM,kCAAkC,CAAC"}
@@ -73,9 +73,7 @@
73
73
  * Every row that opens a relayed connection counts opening the relay connection too
74
74
  * ({@link RELAYED_DIAL_ROUND_TRIPS}), because a dialer cannot know beforehand whether it holds
75
75
  * one, and a budget that is too short fails as silently as an absent peer. The
76
- * reservation-request row is {@link RELAY_RESERVE_REQUEST_ROUND_TRIPS}, which also sizes how long
77
- * a party-run relay waits for a stranger's reservation ({@link relayAdmissionReserveDeadlineMs}).
78
- * The commit row is a measurement of a whole write, not a count of exchanges; its doc comment
76
+ * reservation-request row is {@link RELAY_RESERVE_REQUEST_ROUND_TRIPS}. The commit row is a measurement of a whole write, not a count of exchanges; its doc comment
79
77
  * ({@link COMMIT_ROUND_TRIPS}) holds the figures and says when to re-measure it.
80
78
  *
81
79
  * **Measured** 2026-09-26, one Windows machine, loopback dedicated relay: a relayed dial over a
@@ -198,10 +196,10 @@
198
196
  * the host derives its provisioning budget from its own, so a joiner declaring a faster
199
197
  * link than the host gives up on a reply the host is still entitled to send. Declare the
200
198
  * same link on every machine of a party.
201
- * Relay admission too: a party-run relay derives how long a stranger has to ask for a
202
- * reservation from ITS declaration ({@link relayAdmissionReserveDeadlineMs}), so a relay
203
- * declaring a faster link than a client closes that client's connection before its request
204
- * arrives.
199
+ * Provisional admission too: a member derives how long it keeps a connection from a peer it
200
+ * cannot place from ITS declaration ({@link relayedRequestBudgetMs}), so a member declaring a
201
+ * faster link than a redeeming device can close that device's connection while the device is
202
+ * still waiting on its redemption.
205
203
  */
206
204
  import { type Libp2pConnectionTimeouts, type RpcDeadlineDefaults } from '@optimystic/db-p2p';
207
205
  /**
@@ -255,20 +253,19 @@ export declare const RELAY_DIAL_ROUND_TRIPS = 1;
255
253
  */
256
254
  export declare const RELAYED_DIAL_ROUND_TRIPS: number;
257
255
  /**
258
- * Link round trips from the moment a party-run relay admits a stranger's connection for relay
259
- * use to the moment that stranger's RESERVE request reaches it. libp2p's reservation store
260
- * (`@libp2p/circuit-relay-v2`'s `addRelay`) opens the hop stream the instant its dial resolves,
261
- * without waiting for identify, so:
256
+ * Link round trips from the moment a relay accepts a client's connection to the moment that
257
+ * client's RESERVE request reaches it. libp2p's reservation store (`@libp2p/circuit-relay-v2`'s
258
+ * `addRelay`) opens the hop stream the instant its dial resolves, without waiting for identify,
259
+ * so:
262
260
  *
263
261
  * 1. The client's last Noise handshake message and its hop-stream open arrive at the relay
264
- * together. The relay's gate runs on the handshake message (and arms the reserve deadline),
265
- * then the relay answers the protocol negotiation.
262
+ * together. A party-run relay's gate runs on the handshake message, then the relay answers
263
+ * the protocol negotiation.
266
264
  * 2. The answer reaches the client and the client's RESERVE request reaches the relay: one round
267
265
  * trip on the client-to-relay hop, which is the whole link round trip when all of the link's
268
266
  * delay is on the client's own hop (a phone on a congested mobile link).
269
267
  *
270
- * The relay's decision on that request is local time, not link time;
271
- * {@link relayAdmissionReserveDeadlineMs} adds it separately.
268
+ * The relay's decision on that request is local time, not link time.
272
269
  */
273
270
  export declare const RELAY_RESERVE_REQUEST_ROUND_TRIPS = 1;
274
271
  /**
@@ -472,20 +469,6 @@ export declare function commitBudgetMs(linkRoundTripMs?: number): number;
472
469
  * declaration.
473
470
  */
474
471
  export declare function relayReservationBudgetMs(linkRoundTripMs?: number): number;
475
- /**
476
- * How long a party-run relay keeps a connection it admitted only for relay use
477
- * (`membership-connection-gater.ts`'s `'admit-for-relay'`) before closing it, unless a
478
- * reservation is admitted on it first: {@link RELAY_RESERVE_REQUEST_ROUND_TRIPS} at the declared
479
- * link round trip, plus one {@link ADMISSION_DECISION_TIMEOUT_MS} for the relay's own decision on
480
- * the reservation (`denyInboundRelayReservation`), which disarms the timer only once it settles.
481
- * 3 500 + 2 000 = 5 500 ms at the default declaration.
482
- *
483
- * The declaration is the RELAY's own, because the relay is the machine that decides.
484
- *
485
- * What it costs, against the fixed 5 000 ms it replaced: a stranger that connects and never
486
- * reserves holds a mute connection 0.5 s longer at the default declaration.
487
- */
488
- export declare function relayAdmissionReserveDeadlineMs(linkRoundTripMs?: number): number;
489
472
  /**
490
473
  * Deadline for one request and its answer over a circuit that is already open —
491
474
  * {@link CIRCUIT_REQUEST_ROUND_TRIPS} at the declared link round trip, plus `transferAllowanceMs`
@@ -501,6 +484,10 @@ export declare function circuitRequestBudgetMs(linkRoundTripMs?: number, transfe
501
484
  *
502
485
  * No transfer allowance, unlike {@link circuitRequestBudgetMs}: the requests this bounds are a few
503
486
  * hundred bytes to a few KB, so their bytes cost nothing a round trip does not already cover.
487
+ *
488
+ * A control node also keeps a connection it admitted provisionally this long, at its own
489
+ * declaration, because a cadre invitation redemption is bounded by this budget on the device's
490
+ * side (`membership-connection-gater.ts`, `PROVISIONAL_ADMISSION_DEADLINE_MS`).
504
491
  */
505
492
  export declare function relayedRequestBudgetMs(linkRoundTripMs?: number): number;
506
493
  /**