@serfab/cadre-core 1.9.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cadre-node.d.ts +148 -44
- package/dist/cadre-node.js +363 -139
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-authorization.d.ts +2 -2
- package/dist/control-authorization.js +1 -0
- package/dist/control-authorization.js.map +1 -1
- package/dist/control-cohort.d.ts +1 -1
- package/dist/control-cohort.js +1 -1
- package/dist/control-database.d.ts +105 -14
- package/dist/control-database.js +242 -73
- package/dist/control-database.js.map +1 -1
- package/dist/control-formation-recorder.d.ts +6 -6
- package/dist/control-formation-recorder.js +7 -8
- package/dist/control-formation-recorder.js.map +1 -1
- package/dist/control-schema.d.ts +1 -1
- package/dist/control-schema.js +1066 -979
- package/dist/control-schema.js.map +1 -1
- package/dist/control-write-retry.d.ts +21 -15
- package/dist/control-write-retry.js +21 -15
- package/dist/control-write-retry.js.map +1 -1
- package/dist/diagnostics/connection-path.d.ts +1 -18
- package/dist/diagnostics/connection-path.js +1 -20
- package/dist/diagnostics/connection-path.js.map +1 -1
- package/dist/identity-key.d.ts +0 -30
- package/dist/identity-key.js +7 -40
- package/dist/identity-key.js.map +1 -1
- package/dist/index.d.ts +8 -5
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/dist/invitation-bootstrap.d.ts +32 -0
- package/dist/invitation-bootstrap.js +30 -0
- package/dist/invitation-bootstrap.js.map +1 -0
- package/dist/link-budget.d.ts +204 -119
- package/dist/link-budget.js +208 -120
- package/dist/link-budget.js.map +1 -1
- package/dist/membership-connection-gater.d.ts +3 -3
- package/dist/membership-connection-gater.js +3 -3
- package/dist/peer-dial.d.ts +18 -14
- package/dist/peer-dial.js +18 -14
- package/dist/peer-dial.js.map +1 -1
- package/dist/peer-join-backfill.d.ts +3 -3
- package/dist/pending-join-runner.d.ts +186 -0
- package/dist/pending-join-runner.js +649 -0
- package/dist/pending-join-runner.js.map +1 -0
- package/dist/push-fanout.d.ts +1 -1
- package/dist/push-fanout.js +1 -1
- package/dist/relay-stun.d.ts +24 -0
- package/dist/relay-stun.js +51 -0
- package/dist/relay-stun.js.map +1 -0
- package/dist/seed-bootstrap.d.ts +2 -2
- package/dist/seed-bootstrap.js +5 -5
- package/dist/strand-addr-protocol.js +2 -2
- package/dist/strand-formation-deadlines.d.ts +5 -5
- package/dist/strand-formation-deadlines.js +5 -5
- package/dist/strand-formation-manager.d.ts +18 -4
- package/dist/strand-formation-manager.js +48 -33
- package/dist/strand-formation-manager.js.map +1 -1
- package/dist/strand-formation-protocol.d.ts +71 -14
- package/dist/strand-formation-protocol.js +222 -47
- package/dist/strand-formation-protocol.js.map +1 -1
- package/dist/strand-formation-rejection.d.ts +94 -0
- package/dist/strand-formation-rejection.js +77 -0
- package/dist/strand-formation-rejection.js.map +1 -0
- package/dist/strand-instance-manager.js +4 -1
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-membership-writer.js +32 -32
- package/dist/strand-solicitation.d.ts +11 -3
- package/dist/strand-solicitation.js +9 -0
- package/dist/strand-solicitation.js.map +1 -1
- package/dist/types.d.ts +103 -17
- package/dist/types.js +5 -9
- package/dist/types.js.map +1 -1
- package/package.json +22 -22
- package/src/cadre-node.ts +8654 -8400
- package/src/control-authorization.ts +2 -1
- package/src/control-cohort.ts +128 -128
- package/src/control-database.ts +303 -82
- package/src/control-formation-recorder.ts +353 -354
- package/src/control-read-retry.ts +216 -216
- package/src/control-schema.ts +1078 -991
- package/src/control-write-retry.ts +567 -561
- package/src/diagnostics/connection-path.ts +1 -29
- package/src/formation-approval.ts +610 -610
- package/src/hibernation-manager.ts +638 -638
- package/src/identity-key.ts +7 -62
- package/src/index.ts +644 -627
- package/src/invitation-bootstrap.ts +40 -0
- package/src/joined-strand-store.ts +498 -498
- package/src/link-budget.ts +684 -583
- package/src/membership-connection-gater.ts +570 -570
- package/src/node-local-snapshot.ts +298 -298
- package/src/peer-dial.ts +315 -311
- package/src/peer-join-backfill.ts +710 -710
- package/src/pending-join-runner.ts +735 -0
- package/src/push-fanout.ts +1 -1
- package/src/relay-reservation.ts +1121 -1121
- package/src/relay-server.ts +98 -98
- package/src/relay-stun.ts +58 -0
- package/src/seed-bootstrap.ts +1448 -1448
- package/src/strand-addr-protocol.ts +547 -547
- package/src/strand-database.ts +287 -287
- package/src/strand-first-sync-gate.ts +391 -391
- package/src/strand-formation-deadlines.ts +227 -227
- package/src/strand-formation-manager.ts +725 -700
- package/src/strand-formation-protocol.ts +1036 -802
- package/src/strand-formation-rejection.ts +129 -0
- package/src/strand-fret-addrs.ts +145 -145
- package/src/strand-instance-manager.ts +1789 -1786
- package/src/strand-membership-writer.ts +1974 -1974
- package/src/strand-network-state-file.ts +40 -40
- package/src/strand-network-state.ts +243 -243
- package/src/strand-revocation-enforcer.ts +654 -654
- package/src/strand-solicitation.ts +532 -519
- package/src/strand-wake-protocol.ts +401 -401
- package/src/types.ts +2222 -2140
- package/dist/diagnostics/webrtc-turn-tracker.d.ts +0 -50
- package/dist/diagnostics/webrtc-turn-tracker.js +0 -196
- package/dist/diagnostics/webrtc-turn-tracker.js.map +0 -1
- package/src/diagnostics/webrtc-turn-tracker.ts +0 -222
|
@@ -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
|
|
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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|
* control write. A transient failure (stream reset while a connection is still forming)
|
|
72
72
|
* surfaces in well under a second, so it is retried and the loop adds at most ~2.2 s. A
|
|
73
|
-
* genuinely silent cohort member
|
|
74
|
-
* response-deadline attempts, 10.5 s each at the default declared link
|
|
75
|
-
*
|
|
76
|
-
* already exceeds this budget
|
|
77
|
-
*
|
|
73
|
+
* genuinely silent cohort member costs ~21 s per consensus round (two `ClusterClient`
|
|
74
|
+
* response-deadline attempts, 10.5 s each at the default declared link): one pend round plus
|
|
75
|
+
* the cancel discharge's three rounds, about 84 s for one write in
|
|
76
|
+
* `control-write-degraded-cohort-member.integration.ts`, which already exceeds this budget
|
|
77
|
+
* when attempt 1 returns — so that case is surfaced immediately and retry adds ZERO latency
|
|
78
|
+
* to the case where it cannot help.
|
|
78
79
|
*
|
|
79
80
|
* It cuts the loop off by design, so it does not grow with the link: its job is to end the
|
|
80
81
|
* retries of slow attempts, and the caller gets the last attempt's error unchanged. An attempt
|
|
@@ -85,16 +86,21 @@ export declare const SCHEMA_INIT_ATTEMPTS = 5;
|
|
|
85
86
|
* (10.5 s at the default declared link) still gets none. See `docs/cadre-consistency.md` →
|
|
86
87
|
* "Deadlines Over Optimystic's Reads and Commits".
|
|
87
88
|
*
|
|
88
|
-
* NOTE: a failed commit attempt
|
|
89
|
-
* (optimystic `TransactorSource.transact`'s catch
|
|
90
|
-
* `
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
89
|
+
* NOTE: a failed commit attempt also pays a cancel discharge before its error returns
|
|
90
|
+
* (optimystic `TransactorSource.transact`'s catch) — bounded by six rounds and
|
|
91
|
+
* `abortOrCancelTimeoutMs`, which every collection this repo opens sets to the larger of 5 s
|
|
92
|
+
* and the RPC dial deadline: 42.5 s at the default declared link (`optimysticDialLimits` in
|
|
93
|
+
* `link-budget.ts`;
|
|
94
|
+
* `../optimystic/packages/quereus-plugin-optimystic/src/optimystic-adapter/collection-factory.ts`).
|
|
95
|
+
* One cancel that runs its full budget therefore ends the retries on its own, cutting the
|
|
96
|
+
* three-attempt policy to however many attempts came before it. A cancel only runs that long
|
|
97
|
+
* when a peer stays silent, and that attempt has already spent its pend round past this
|
|
98
|
+
* budget, so the cut loses nothing there. After a transient fault the cancel is either
|
|
99
|
+
* answered or gives up after its six rounds against a dead transport, in about a second
|
|
100
|
+
* either way (optimystic `NetworkTransactor.MAX_CANCEL_ROUNDS`). Not observed — every
|
|
101
|
+
* measured round of the transient-reset case committed on attempt 3 of 3 — so this is a
|
|
102
|
+
* condition to watch, not work to do: if that case ever starts failing with
|
|
103
|
+
* `failed after 2/3 attempt(s)`, the cancel discharge is where the time went.
|
|
98
104
|
*/
|
|
99
105
|
export declare const CONTROL_WRITE_RETRY_BUDGET_MS = 10000;
|
|
100
106
|
/**
|
|
@@ -72,11 +72,12 @@ export const SCHEMA_INIT_ATTEMPTS = 5;
|
|
|
72
72
|
* This budget — not the attempt count — is what makes the policy safe to sit under every
|
|
73
73
|
* control write. A transient failure (stream reset while a connection is still forming)
|
|
74
74
|
* surfaces in well under a second, so it is retried and the loop adds at most ~2.2 s. A
|
|
75
|
-
* genuinely silent cohort member
|
|
76
|
-
* response-deadline attempts, 10.5 s each at the default declared link
|
|
77
|
-
*
|
|
78
|
-
* already exceeds this budget
|
|
79
|
-
*
|
|
75
|
+
* genuinely silent cohort member costs ~21 s per consensus round (two `ClusterClient`
|
|
76
|
+
* response-deadline attempts, 10.5 s each at the default declared link): one pend round plus
|
|
77
|
+
* the cancel discharge's three rounds, about 84 s for one write in
|
|
78
|
+
* `control-write-degraded-cohort-member.integration.ts`, which already exceeds this budget
|
|
79
|
+
* when attempt 1 returns — so that case is surfaced immediately and retry adds ZERO latency
|
|
80
|
+
* to the case where it cannot help.
|
|
80
81
|
*
|
|
81
82
|
* It cuts the loop off by design, so it does not grow with the link: its job is to end the
|
|
82
83
|
* retries of slow attempts, and the caller gets the last attempt's error unchanged. An attempt
|
|
@@ -87,16 +88,21 @@ export const SCHEMA_INIT_ATTEMPTS = 5;
|
|
|
87
88
|
* (10.5 s at the default declared link) still gets none. See `docs/cadre-consistency.md` →
|
|
88
89
|
* "Deadlines Over Optimystic's Reads and Commits".
|
|
89
90
|
*
|
|
90
|
-
* NOTE: a failed commit attempt
|
|
91
|
-
* (optimystic `TransactorSource.transact`'s catch
|
|
92
|
-
* `
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
91
|
+
* NOTE: a failed commit attempt also pays a cancel discharge before its error returns
|
|
92
|
+
* (optimystic `TransactorSource.transact`'s catch) — bounded by six rounds and
|
|
93
|
+
* `abortOrCancelTimeoutMs`, which every collection this repo opens sets to the larger of 5 s
|
|
94
|
+
* and the RPC dial deadline: 42.5 s at the default declared link (`optimysticDialLimits` in
|
|
95
|
+
* `link-budget.ts`;
|
|
96
|
+
* `../optimystic/packages/quereus-plugin-optimystic/src/optimystic-adapter/collection-factory.ts`).
|
|
97
|
+
* One cancel that runs its full budget therefore ends the retries on its own, cutting the
|
|
98
|
+
* three-attempt policy to however many attempts came before it. A cancel only runs that long
|
|
99
|
+
* when a peer stays silent, and that attempt has already spent its pend round past this
|
|
100
|
+
* budget, so the cut loses nothing there. After a transient fault the cancel is either
|
|
101
|
+
* answered or gives up after its six rounds against a dead transport, in about a second
|
|
102
|
+
* either way (optimystic `NetworkTransactor.MAX_CANCEL_ROUNDS`). Not observed — every
|
|
103
|
+
* measured round of the transient-reset case committed on attempt 3 of 3 — so this is a
|
|
104
|
+
* condition to watch, not work to do: if that case ever starts failing with
|
|
105
|
+
* `failed after 2/3 attempt(s)`, the cancel discharge is where the time went.
|
|
100
106
|
*/
|
|
101
107
|
// eslint-disable-next-line no-restricted-syntax -- cuts off by design: it ends the retries of slow attempts rather than waiting them out; see docs/cadre-consistency.md → "Deadlines Over Optimystic's Reads and Commits"
|
|
102
108
|
export const CONTROL_WRITE_RETRY_BUDGET_MS = 10000;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-write-retry.js","sourceRoot":"","sources":["../src/control-write-retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9G,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC
|
|
1
|
+
{"version":3,"file":"control-write-retry.js","sourceRoot":"","sources":["../src/control-write-retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9G,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,0NAA0N;AAC1N,MAAM,CAAC,MAAM,6BAA6B,GAAG,KAAM,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,6BA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AAI,0BAA0B,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC;IACd,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC7E,CAAC;AAcD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAuC;IAC3E,QAAQ,EAAE,oBAAoB;IAC9B,QAAQ,EAAE,2BAA2B;IACrC,WAAW,EAAE,4BAA4B;CACzC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,iBAAiB,CAChC,OAAyB,EACzB,UAAoC,EAAE;IAEtC,OAAO,qBAAqB,CAAC,OAAO,EAAE;QACrC,QAAQ,EAAE,sBAAsB;QAChC,QAAQ,EAAE,6BAA6B;QACvC,QAAQ,EAAE,6BAA6B;QACvC,WAAW,EAAE,8BAA8B;QAC3C,4EAA4E;QAC5E,mDAAmD;QACnD,SAAS,EAAE,eAAe;KAC1B,EAAE,OAAO,CAAC,CAAC;AACb,CAAC"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* multiaddr string alone — no I/O, no events, no stateful observer.
|
|
9
9
|
*/
|
|
10
10
|
export type ConnectionPathKind = 'relayed' | 'direct';
|
|
11
|
-
export type ConnectionTransport = 'circuit-relay' | 'webrtc' | 'webrtc-
|
|
11
|
+
export type ConnectionTransport = 'circuit-relay' | 'webrtc' | 'webrtc-direct' | 'websocket' | 'tcp' | 'unknown';
|
|
12
12
|
export interface ConnectionPath {
|
|
13
13
|
/** remotePeer.toString() */
|
|
14
14
|
peerId: string;
|
|
@@ -50,13 +50,6 @@ export interface ConnectionLike {
|
|
|
50
50
|
timeline?: {
|
|
51
51
|
open?: number;
|
|
52
52
|
};
|
|
53
|
-
/**
|
|
54
|
-
* Set externally (by {@link CadreNode}, from a {@link TurnRelayTracker}
|
|
55
|
-
* observation) when ICE selected a TURN relay candidate for this `/webrtc`
|
|
56
|
-
* session. `undefined` = unknown (the multiaddr alone cannot reveal it). Only
|
|
57
|
-
* honoured for the `webrtc` transport — see {@link classifyConnectionPath}.
|
|
58
|
-
*/
|
|
59
|
-
turnRelayed?: boolean;
|
|
60
53
|
}
|
|
61
54
|
export declare const DEFAULT_SETTLE_WINDOW_MS = 10000;
|
|
62
55
|
interface TransportClass {
|
|
@@ -85,16 +78,6 @@ interface TransportClass {
|
|
|
85
78
|
* `/p2p-circuit` (`…/p2p-circuit/p2p/…`) is genuinely relay-carried.
|
|
86
79
|
*/
|
|
87
80
|
export declare function classifyTransport(remoteAddr: string): TransportClass;
|
|
88
|
-
/**
|
|
89
|
-
* Per-connection classifier. Starts from the pure multiaddr classification, then
|
|
90
|
-
* applies the TURN override: a `/webrtc` session whose ICE selected a TURN relay
|
|
91
|
-
* candidate (`conn.turnRelayed === true`, set externally — the multiaddr alone
|
|
92
|
-
* cannot reveal it) is reclassified `relayed`/`webrtc-turn`. The
|
|
93
|
-
* `transport === 'webrtc'` guard means a `webrtc-direct` connection is never
|
|
94
|
-
* promoted (it uses no ICE and so can never be TURN-relayed), and `undefined`
|
|
95
|
-
* (unknown) degrades safely to the multiaddr result — not relayed.
|
|
96
|
-
*/
|
|
97
|
-
export declare function classifyConnectionPath(conn: ConnectionLike): TransportClass;
|
|
98
81
|
/** An all-zero summary, used when no node/connections are available. */
|
|
99
82
|
export declare function emptyConnectionPathSummary(settleWindowMs?: number): ConnectionPathSummary;
|
|
100
83
|
/**
|
|
@@ -11,7 +11,6 @@ export const DEFAULT_SETTLE_WINDOW_MS = 10000;
|
|
|
11
11
|
const ALL_TRANSPORTS = [
|
|
12
12
|
'circuit-relay',
|
|
13
13
|
'webrtc',
|
|
14
|
-
'webrtc-turn',
|
|
15
14
|
'webrtc-direct',
|
|
16
15
|
'websocket',
|
|
17
16
|
'tcp',
|
|
@@ -61,22 +60,6 @@ function addrString(conn) {
|
|
|
61
60
|
return '';
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Per-connection classifier. Starts from the pure multiaddr classification, then
|
|
66
|
-
* applies the TURN override: a `/webrtc` session whose ICE selected a TURN relay
|
|
67
|
-
* candidate (`conn.turnRelayed === true`, set externally — the multiaddr alone
|
|
68
|
-
* cannot reveal it) is reclassified `relayed`/`webrtc-turn`. The
|
|
69
|
-
* `transport === 'webrtc'` guard means a `webrtc-direct` connection is never
|
|
70
|
-
* promoted (it uses no ICE and so can never be TURN-relayed), and `undefined`
|
|
71
|
-
* (unknown) degrades safely to the multiaddr result — not relayed.
|
|
72
|
-
*/
|
|
73
|
-
export function classifyConnectionPath(conn) {
|
|
74
|
-
const { kind, transport } = classifyTransport(addrString(conn));
|
|
75
|
-
if (transport === 'webrtc' && conn.turnRelayed === true) {
|
|
76
|
-
return { kind: 'relayed', transport: 'webrtc-turn' };
|
|
77
|
-
}
|
|
78
|
-
return { kind, transport };
|
|
79
|
-
}
|
|
80
63
|
/**
|
|
81
64
|
* Best-effort per-connection byte counter. The stock libp2p `Connection`
|
|
82
65
|
* interface carries no byte counter, so unless a metrics implementation is
|
|
@@ -132,9 +115,7 @@ export function summarizeConnectionPaths(conns, settleWindowMs = DEFAULT_SETTLE_
|
|
|
132
115
|
// least one direct connection.
|
|
133
116
|
const classified = list.map((conn) => {
|
|
134
117
|
const remoteAddr = addrString(conn);
|
|
135
|
-
|
|
136
|
-
// turnRelayed hint promotes webrtc → webrtc-turn (relayed).
|
|
137
|
-
const { kind, transport } = classifyConnectionPath(conn);
|
|
118
|
+
const { kind, transport } = classifyTransport(remoteAddr);
|
|
138
119
|
const openedAtMs = typeof conn.timeline?.open === 'number' ? conn.timeline.open : null;
|
|
139
120
|
const ageMs = openedAtMs != null ? Math.max(0, now - openedAtMs) : null;
|
|
140
121
|
const peerId = safePeerId(conn);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-path.js","sourceRoot":"","sources":["../../src/diagnostics/connection-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"connection-path.js","sourceRoot":"","sources":["../../src/diagnostics/connection-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAmDH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAM,CAAC;AAE/C,MAAM,cAAc,GAAmC;IACrD,eAAe;IACf,QAAQ;IACR,eAAe;IACf,WAAW;IACX,KAAK;IACL,SAAS;CACV,CAAC;AAOF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAkB;IAClD,MAAM,IAAI,GAAG,UAAU,IAAI,EAAE,CAAC;IAC9B,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;IAC3F,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;IAC7E,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;IAC1F,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;IAC5E,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACvE,OAAO,EAAE,IAAI,EAAE,QAA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S,EAAE,CAAC,CAAC,SAAS;YACtB,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,UAAU,EAAE,CAAC,CAAC,UAAU;YACxB,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,YAAY;SACb,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,MAAM;QAClB,OAAO;QACP,MAAM;QACN,YAAY,EAAE,UAAU;QACxB,WAAW;QACX,cAAc;QACd,KAAK;QACL,cAAc;KACf,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,IAAoB;IACtC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
package/dist/identity-key.d.ts
CHANGED
|
@@ -17,33 +17,3 @@ import { type KeyId, type KeyStore } from './key-store.js';
|
|
|
17
17
|
* @returns The resolved libp2p private key.
|
|
18
18
|
*/
|
|
19
19
|
export declare function loadOrCreateIdentityKey(keyStore: KeyStore, keyId?: KeyId): Promise<PrivateKey>;
|
|
20
|
-
/**
|
|
21
|
-
* Proof-of-possession signer for a node key, for out-of-band HTTP services that
|
|
22
|
-
* want to attribute a request to a peer id.
|
|
23
|
-
*
|
|
24
|
-
* Deliberately generic — it carries no ICE/TURN vocabulary, and the message it
|
|
25
|
-
* signs is the caller's business. The one consumer today is the reference apps'
|
|
26
|
-
* `loadIceConfig`, which signs the TURN credential issuer's peer assertion; those
|
|
27
|
-
* files mirror this interface structurally rather than importing it, so they stay
|
|
28
|
-
* dependency-free.
|
|
29
|
-
*/
|
|
30
|
-
export interface PeerKeySigner {
|
|
31
|
-
/** base58btc peer id — the same string libp2p reports for this node. */
|
|
32
|
-
readonly peerId: string;
|
|
33
|
-
/** base64url of the libp2p protobuf-encoded public key. */
|
|
34
|
-
readonly publicKeyB64: string;
|
|
35
|
-
/** Sign the UTF-8 bytes of `message`; resolves to a base64url signature. */
|
|
36
|
-
sign(message: string): Promise<string>;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Wrap a libp2p private key as a {@link PeerKeySigner}.
|
|
40
|
-
*
|
|
41
|
-
* Ed25519 only: the peer id is derived as an identity multihash (so
|
|
42
|
-
* `publicKey.toString()` already *is* the base58btc peer id — no `@libp2p/peer-id`
|
|
43
|
-
* round trip needed), and verifiers of this proof accept nothing else.
|
|
44
|
-
*
|
|
45
|
-
* @param privateKey - The node's libp2p Ed25519 private key.
|
|
46
|
-
* @returns A signer exposing the peer id, the encoded public key, and `sign`.
|
|
47
|
-
* @throws If the key is not Ed25519.
|
|
48
|
-
*/
|
|
49
|
-
export declare function peerKeySigner(privateKey: PrivateKey): PeerKeySigner;
|
package/dist/identity-key.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* identity-key — the load-or-create rule for a {@link KeyStore}-backed node
|
|
3
|
-
* identity, plus the "prove you hold this node key" signer built on top of it.
|
|
4
|
-
*
|
|
5
|
-
* Both live here because both are needed *outside* `CadreNode`: an embedding app
|
|
6
|
-
* (the React Native reference app) has to resolve its identity key before the node
|
|
7
|
-
* is constructed, so it can sign an out-of-band HTTP request with the same key the
|
|
8
|
-
* node will then load. Keeping one copy of the load-or-create rule is load-bearing
|
|
9
|
-
* — a second copy that drifted could generate a fresh key and orphan the real
|
|
10
3
|
* identity.
|
|
11
4
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
5
|
+
* Exported beyond `CadreNode` because an embedding app may need its identity key
|
|
6
|
+
* before the node is constructed. Keeping one copy of the rule is load-bearing — a
|
|
7
|
+
* second copy that drifted could generate a fresh key and orphan the real identity.
|
|
8
|
+
*
|
|
9
|
+
* Dependency-free beyond `@libp2p/crypto` (already a core dependency), so this
|
|
10
|
+
* module is safe in every (RN / browser / Node) entry graph.
|
|
14
11
|
*/
|
|
15
12
|
import debug from 'debug';
|
|
16
|
-
import { generateKeyPair, privateKeyToProtobuf, privateKeyFromProtobuf
|
|
17
|
-
import { toString as uint8ArrayToString } from 'uint8arrays';
|
|
13
|
+
import { generateKeyPair, privateKeyToProtobuf, privateKeyFromProtobuf } from '@libp2p/crypto/keys';
|
|
18
14
|
import { DEFAULT_IDENTITY_KEY_ID } from './key-store.js';
|
|
19
15
|
const log = debug('sereus:cadre:identity-key');
|
|
20
16
|
/**
|
|
@@ -49,33 +45,4 @@ export async function loadOrCreateIdentityKey(keyStore, keyId = DEFAULT_IDENTITY
|
|
|
49
45
|
log('Identity key generated and persisted to key store (first run)');
|
|
50
46
|
return generated;
|
|
51
47
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Wrap a libp2p private key as a {@link PeerKeySigner}.
|
|
54
|
-
*
|
|
55
|
-
* Ed25519 only: the peer id is derived as an identity multihash (so
|
|
56
|
-
* `publicKey.toString()` already *is* the base58btc peer id — no `@libp2p/peer-id`
|
|
57
|
-
* round trip needed), and verifiers of this proof accept nothing else.
|
|
58
|
-
*
|
|
59
|
-
* @param privateKey - The node's libp2p Ed25519 private key.
|
|
60
|
-
* @returns A signer exposing the peer id, the encoded public key, and `sign`.
|
|
61
|
-
* @throws If the key is not Ed25519.
|
|
62
|
-
*/
|
|
63
|
-
export function peerKeySigner(privateKey) {
|
|
64
|
-
if (privateKey.type !== 'Ed25519') {
|
|
65
|
-
throw new Error(`peerKeySigner requires an Ed25519 key, got ${privateKey.type}`);
|
|
66
|
-
}
|
|
67
|
-
const publicKey = privateKey.publicKey;
|
|
68
|
-
// For Ed25519 the public key's digest is an identity multihash, so its string
|
|
69
|
-
// form is the peer id itself — the same value `peerIdFromPrivateKey` produces.
|
|
70
|
-
const peerId = publicKey.toString();
|
|
71
|
-
const publicKeyB64 = uint8ArrayToString(publicKeyToProtobuf(publicKey), 'base64url');
|
|
72
|
-
return {
|
|
73
|
-
peerId,
|
|
74
|
-
publicKeyB64,
|
|
75
|
-
async sign(message) {
|
|
76
|
-
const signature = await privateKey.sign(new TextEncoder().encode(message));
|
|
77
|
-
return uint8ArrayToString(signature, 'base64url');
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
48
|
//# sourceMappingURL=identity-key.js.map
|
package/dist/identity-key.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-key.js","sourceRoot":"","sources":["../src/identity-key.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"identity-key.js","sourceRoot":"","sources":["../src/identity-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEpG,OAAO,EAAE,uBAAuB,EAA6B,MAAM,gBAAgB,CAAC;AAEpF,MAAM,GAAG,GAAG,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAE/C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,QAAkB,EAClB,QAAe,uBAAuB;IAEtC,2EAA2E;IAC3E,4EAA4E;IAC5E,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,KAAK,EAAE,CAAC;QACV,+DAA+D;QAC/D,uDAAuD;QACvD,MAAM,MAAM,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;QAC7C,GAAG,CAAC,mDAAmD,CAAC,CAAC;QACzD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,SAAS,CAAC,CAAC;IACnD,MAAM,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3D,GAAG,CAAC,+DAA+D,CAAC,CAAC;IACrE,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type { ControlRetryAbandonment, ControlRetryAbandonReason, ControlRetryAb
|
|
|
8
8
|
export { controlAuthorizationFields, type ControlDomain, type ControlAction } from './control-authorization.js';
|
|
9
9
|
export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, 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
|
-
export { loadOrCreateIdentityKey
|
|
11
|
+
export { loadOrCreateIdentityKey } from './identity-key.js';
|
|
12
12
|
export { MemoryTrustedOwnerStore, PersistentTrustedOwnerStore, type TrustedOwnerStore, type TrustSource } from './trusted-owner-store.js';
|
|
13
13
|
export type { DurableSlot } from './node-local-snapshot.js';
|
|
14
14
|
export { MemoryBootstrapPeerStore, PersistentBootstrapPeerStore, type BootstrapPeerStore, type BootstrapPeerEntry } from './bootstrap-peer-store.js';
|
|
@@ -47,15 +47,18 @@ export { validatePushCredentials, redactPushCredentials, REDACTED } from './push
|
|
|
47
47
|
export { PushFanoutService, DEFAULT_PUSH_COOLDOWN_MS, DEFAULT_PUSH_DEBOUNCE_MS, type PushFanoutOptions, type FanoutMember } from './push-fanout.js';
|
|
48
48
|
export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE, type ControlCohortSelection, type ControlCohortReconcileResult } from './control-cohort.js';
|
|
49
49
|
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';
|
|
50
|
-
export { DECLARED_LINK_ROUND_TRIP_MS, 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 } from './link-budget.js';
|
|
50
|
+
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';
|
|
51
51
|
export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy, type SeedTrustPolicy, type SeedTrustContext, type SeedTrustDecision } from './seed-trust-policy.js';
|
|
52
52
|
export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
|
|
53
|
-
export { FormationListener, dialFormation, isValidResponderCreatesResult, isWellFormedMembershipInvite, sanitizeStrandAddrs, FORMATION_PROTOCOL, type FormationParty, type FormationContactMessage, type FormationResultMessage, type FormationProvisionResult, type FormationStrandInfo, type FormationDbConnectionInfo, type FormationListenerOptions, type FormationDialOptions, type FormationDialResult, type ResponderProvisionOutcome } from './strand-formation-protocol.js';
|
|
53
|
+
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';
|
|
54
|
+
export { FormationRejectedError, FormationUnreachableError, FormationPostApprovalError, FORMATION_REJECTION_RETRYABLE, isFormationRejectionCode, type FormationRejectionCode } from './strand-formation-rejection.js';
|
|
54
55
|
export { formationDeadlines, type FormationDeadlines } from './strand-formation-deadlines.js';
|
|
55
|
-
export {
|
|
56
|
+
export { PENDING_JOIN_POLL_MS, PENDING_JOIN_MAX_BACKOFF_MS, MAX_PENDING_JOIN_MS } from './pending-join-runner.js';
|
|
57
|
+
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';
|
|
56
58
|
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';
|
|
57
59
|
export { RelayReservationFailedError, UnbindableListenAddressError, RELAY_SEARCH_LISTEN_ADDR, resolveListenAddrs } from './relay-addrs.js';
|
|
58
60
|
export { strandNodeAddrs, type StrandNodeAddrs } from './strand-network-config.js';
|
|
61
|
+
export { RELAY_STUN_PORT, relayStunUrl, resolveStunServers, type StunServer } from './relay-stun.js';
|
|
59
62
|
export { resolveRelayServer, PARTY_RELAY_MAX_RESERVATIONS, PARTY_RELAY_RESERVATION_TTL_MS, type ResolvedRelayServer, type ResolvedRelayReservations } from './relay-server.js';
|
|
60
63
|
export { circuitMultiaddrs, superviseRelayReservation, DEFAULT_RELAY_RESERVE_TIMEOUT_MS, DEFAULT_RELAY_RESERVE_POLL_MS, DEFAULT_RELAY_CHECK_MS, DEFAULT_RELAY_MIN_BACKOFF_MS, DEFAULT_RELAY_MAX_BACKOFF_MS, type RelayReservationStatus, type RelayReservationState, type RelayReserveOptions, type RelayReservationSupervisor, type RelayReservationSupervisorOptions } from './relay-reservation.js';
|
|
61
|
-
export { classifyTransport,
|
|
64
|
+
export { classifyTransport, summarizeConnectionPaths, emptyConnectionPathSummary, DEFAULT_SETTLE_WINDOW_MS, type ConnectionPathKind, type ConnectionTransport, type ConnectionPath, type ConnectionPathSummary, type ConnectionLike } from './diagnostics/connection-path.js';
|
package/dist/index.js
CHANGED
|
@@ -24,9 +24,8 @@ export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, requireEd25519Pu
|
|
|
24
24
|
// import never lands here.
|
|
25
25
|
export { InMemoryKeyStore, KeyStoreAccessError, DEFAULT_IDENTITY_KEY_ID } from './key-store.js';
|
|
26
26
|
// The KeyStore-backed identity rule, shared with embedding apps that need the
|
|
27
|
-
// node key BEFORE `CadreNode` exists
|
|
28
|
-
|
|
29
|
-
export { loadOrCreateIdentityKey, peerKeySigner } from './identity-key.js';
|
|
27
|
+
// node key BEFORE `CadreNode` exists.
|
|
28
|
+
export { loadOrCreateIdentityKey } from './identity-key.js';
|
|
30
29
|
// Node-local trusted-owner anchor: the NON-replicated, per-party record of
|
|
31
30
|
// out-of-band-established owner keys (the trust anchor the replicated OwnerKey
|
|
32
31
|
// table cannot be). Cross-platform: interface + in-memory store only — the
|
|
@@ -155,14 +154,18 @@ export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_
|
|
|
155
154
|
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';
|
|
156
155
|
// Dial and reservation budgets counted in link round trips rather than fixed milliseconds, so
|
|
157
156
|
// one declared assumption about the link moves them all — see `NetworkConfig.linkRoundTripMs`.
|
|
158
|
-
export { DECLARED_LINK_ROUND_TRIP_MS, 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 } from './link-budget.js';
|
|
157
|
+
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';
|
|
159
158
|
// Seed trust policy (trust anchor for incoming seeds)
|
|
160
159
|
export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy } from './seed-trust-policy.js';
|
|
161
160
|
// Schema Verification
|
|
162
161
|
export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
|
|
163
162
|
// Strand Formation transport (native cadre-core protocol)
|
|
164
|
-
export { FormationListener, dialFormation, isValidResponderCreatesResult, isWellFormedMembershipInvite, sanitizeStrandAddrs, FORMATION_PROTOCOL } from './strand-formation-protocol.js';
|
|
163
|
+
export { FormationListener, dialFormation, dialFormationByMachine, isValidResponderCreatesResult, isWellFormedMembershipInvite, sanitizeStrandAddrs, FORMATION_PROTOCOL } from './strand-formation-protocol.js';
|
|
164
|
+
// How a formation dial fails: a typed refusal (with a fixed code) or no answer at all
|
|
165
|
+
export { FormationRejectedError, FormationUnreachableError, FormationPostApprovalError, FORMATION_REJECTION_RETRYABLE, isFormationRejectionCode } from './strand-formation-rejection.js';
|
|
165
166
|
export { formationDeadlines } from './strand-formation-deadlines.js';
|
|
167
|
+
// The pending-join retry loop behind CadreNode.requestJoin (PendingJoinStatus is in types.ts)
|
|
168
|
+
export { PENDING_JOIN_POLL_MS, PENDING_JOIN_MAX_BACKOFF_MS, MAX_PENDING_JOIN_MS } from './pending-join-runner.js';
|
|
166
169
|
// Strand Formation manager (drives the native transport)
|
|
167
170
|
export { StrandFormationManager, createStrandFormationManager, MEMBERSHIP_INVITE_TTL_MS, MEMBERSHIP_INVITE_UNAVAILABLE_REASON, HOST_STRAND_MUST_BE_RECREATED_REASON } from './strand-formation-manager.js';
|
|
168
171
|
// Control-network inbound connection gate (membership defense-in-depth)
|
|
@@ -182,6 +185,9 @@ export { createMembershipConnectionGater, STRANGER_OPEN_PROTOCOLS, DEFAULT_ENROL
|
|
|
182
185
|
// spelling.
|
|
183
186
|
export { RelayReservationFailedError, UnbindableListenAddressError, RELAY_SEARCH_LISTEN_ADDR, resolveListenAddrs } from './relay-addrs.js';
|
|
184
187
|
export { strandNodeAddrs } from './strand-network-config.js';
|
|
188
|
+
// STUN for an embedder's WebRTC transport, derived from the relays it already uses: each
|
|
189
|
+
// Sereus relay also answers STUN (`ops/docs/ice-servers.md`).
|
|
190
|
+
export { RELAY_STUN_PORT, relayStunUrl, resolveStunServers } from './relay-stun.js';
|
|
185
191
|
// The circuit-relay SERVER a node runs, and with which init — one resolution shared by the
|
|
186
192
|
// control node and every strand node. Exported alongside the listen derivations above for the
|
|
187
193
|
// same reason: an embedder can assert on what its `network` block resolves to.
|
|
@@ -191,5 +197,5 @@ export { resolveRelayServer, PARTY_RELAY_MAX_RESERVATIONS, PARTY_RELAY_RESERVATI
|
|
|
191
197
|
// (see relay-reservation.ts)
|
|
192
198
|
export { circuitMultiaddrs, superviseRelayReservation, DEFAULT_RELAY_RESERVE_TIMEOUT_MS, DEFAULT_RELAY_RESERVE_POLL_MS, DEFAULT_RELAY_CHECK_MS, DEFAULT_RELAY_MIN_BACKOFF_MS, DEFAULT_RELAY_MAX_BACKOFF_MS } from './relay-reservation.js';
|
|
193
199
|
// Connection-path diagnostics (relayed vs direct classification + summary)
|
|
194
|
-
export { classifyTransport,
|
|
200
|
+
export { classifyTransport, summarizeConnectionPaths, emptyConnectionPathSummary, DEFAULT_SETTLE_WINDOW_MS } from './diagnostics/connection-path.js';
|
|
195
201
|
//# sourceMappingURL=index.js.map
|
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,E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E;AACxE,OAAO,EACL,+BAA+B,EAC/B,uBAAuB,EACvB,4BAA4B,EAC5B,mCAAmC,EACnC,gCAAgC,EAChC,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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which of the inviting party's other machines an open invitation names, so a joiner can still
|
|
3
|
+
* form while the machine that minted it is offline. The minting machine's own addresses go
|
|
4
|
+
* first and are not chosen here (`CadreNode.createOpenInvitation`).
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* At most this many of the party's other machines are named, each with at most
|
|
8
|
+
* {@link INVITATION_ADDRS_PER_SIBLING} addresses: 12 extra addresses of roughly 100–200
|
|
9
|
+
* characters, base64url-encoded into an invitation shared as text.
|
|
10
|
+
*
|
|
11
|
+
* NOTE: if invitations are ever carried in a QR code, lower these caps or name the machines by
|
|
12
|
+
* peer id only.
|
|
13
|
+
* NOTE: the per-machine cap keeps the record's order (relay first, then direct addresses as the
|
|
14
|
+
* machine published them, loopback included). If a sibling with many interfaces is seen to have
|
|
15
|
+
* its reachable address cut, rank loopback and private addresses last before slicing.
|
|
16
|
+
*/
|
|
17
|
+
export declare const INVITATION_SIBLING_MACHINES = 3;
|
|
18
|
+
export declare const INVITATION_ADDRS_PER_SIBLING = 4;
|
|
19
|
+
/** One other machine of the party whose signed address record resolved. */
|
|
20
|
+
export interface InvitationSibling {
|
|
21
|
+
peerId: string;
|
|
22
|
+
/** The record's `UpdatedAt`: when the machine last published its addresses. */
|
|
23
|
+
updatedAt: number;
|
|
24
|
+
/** Relay (signaling) addresses first, each ending in `/p2p/<peerId>`. */
|
|
25
|
+
addrs: string[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The addresses of the siblings an invitation names. Machines this node is connected to right
|
|
29
|
+
* now come first, since a live connection is the best evidence that a machine is up; a record
|
|
30
|
+
* shows only that it was up within the freshness window. Within each half, newest record first.
|
|
31
|
+
*/
|
|
32
|
+
export declare function selectInvitationSiblingAddrs(siblings: InvitationSibling[], connected: ReadonlySet<string>): string[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which of the inviting party's other machines an open invitation names, so a joiner can still
|
|
3
|
+
* form while the machine that minted it is offline. The minting machine's own addresses go
|
|
4
|
+
* first and are not chosen here (`CadreNode.createOpenInvitation`).
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* At most this many of the party's other machines are named, each with at most
|
|
8
|
+
* {@link INVITATION_ADDRS_PER_SIBLING} addresses: 12 extra addresses of roughly 100–200
|
|
9
|
+
* characters, base64url-encoded into an invitation shared as text.
|
|
10
|
+
*
|
|
11
|
+
* NOTE: if invitations are ever carried in a QR code, lower these caps or name the machines by
|
|
12
|
+
* peer id only.
|
|
13
|
+
* NOTE: the per-machine cap keeps the record's order (relay first, then direct addresses as the
|
|
14
|
+
* machine published them, loopback included). If a sibling with many interfaces is seen to have
|
|
15
|
+
* its reachable address cut, rank loopback and private addresses last before slicing.
|
|
16
|
+
*/
|
|
17
|
+
export const INVITATION_SIBLING_MACHINES = 3;
|
|
18
|
+
export const INVITATION_ADDRS_PER_SIBLING = 4;
|
|
19
|
+
/**
|
|
20
|
+
* The addresses of the siblings an invitation names. Machines this node is connected to right
|
|
21
|
+
* now come first, since a live connection is the best evidence that a machine is up; a record
|
|
22
|
+
* shows only that it was up within the freshness window. Within each half, newest record first.
|
|
23
|
+
*/
|
|
24
|
+
export function selectInvitationSiblingAddrs(siblings, connected) {
|
|
25
|
+
return [...siblings]
|
|
26
|
+
.sort((a, b) => Number(connected.has(b.peerId)) - Number(connected.has(a.peerId)) || b.updatedAt - a.updatedAt)
|
|
27
|
+
.slice(0, INVITATION_SIBLING_MACHINES)
|
|
28
|
+
.flatMap((sibling) => sibling.addrs.slice(0, INVITATION_ADDRS_PER_SIBLING));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=invitation-bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invitation-bootstrap.js","sourceRoot":"","sources":["../src/invitation-bootstrap.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAC7C,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAW9C;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAAC,QAA6B,EAAE,SAA8B;IACzG,OAAO,CAAC,GAAG,QAAQ,CAAC;SAClB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;SAC9G,KAAK,CAAC,CAAC,EAAE,2BAA2B,CAAC;SACrC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,4BAA4B,CAAC,CAAC,CAAC;AAC9E,CAAC"}
|