@serfab/cadre-core 1.23.0 → 1.24.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/README.md +216 -294
- package/dist/arachnode-stub.d.ts +12 -4
- package/dist/arachnode-stub.js +15 -8
- package/dist/arachnode-stub.js.map +1 -1
- package/dist/cadre-invite-protocol.js +5 -4
- package/dist/cadre-invite-protocol.js.map +1 -1
- package/dist/cadre-node.d.ts +145 -44
- package/dist/cadre-node.js +239 -79
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-authorization.d.ts +14 -2
- package/dist/control-authorization.js +8 -3
- package/dist/control-authorization.js.map +1 -1
- package/dist/control-cohort.d.ts +27 -13
- package/dist/control-cohort.js +21 -14
- package/dist/control-cohort.js.map +1 -1
- package/dist/control-database.d.ts +18 -16
- package/dist/control-database.js +57 -22
- package/dist/control-database.js.map +1 -1
- package/dist/control-protocol-guard.d.ts +1 -1
- package/dist/control-protocol-guard.js +7 -3
- package/dist/control-protocol-guard.js.map +1 -1
- package/dist/control-read-retry.d.ts +49 -11
- package/dist/control-read-retry.js +56 -15
- package/dist/control-read-retry.js.map +1 -1
- package/dist/control-retry.d.ts +32 -3
- package/dist/control-retry.js +35 -4
- package/dist/control-retry.js.map +1 -1
- package/dist/control-schema-version.d.ts +5 -5
- package/dist/control-schema-version.js +5 -5
- package/dist/control-schema-version.js.map +1 -1
- package/dist/control-schema.d.ts +5 -5
- package/dist/control-schema.js +1032 -1011
- package/dist/control-schema.js.map +1 -1
- package/dist/control-write-retry.d.ts +54 -65
- package/dist/control-write-retry.js +134 -158
- package/dist/control-write-retry.js.map +1 -1
- package/dist/delegate-admission.d.ts +1 -1
- package/dist/delegate-admission.js +1 -1
- package/dist/edge-node/config.d.ts +4 -3
- package/dist/edge-node/config.js +11 -9
- package/dist/edge-node/config.js.map +1 -1
- package/dist/edge-node/dissolve.d.ts +4 -4
- package/dist/edge-node/dissolve.js +4 -4
- package/dist/edge-node/edge-join.d.ts +1 -1
- package/dist/edge-node/edge-join.js +1 -1
- package/dist/edge-node/edge-node.js +2 -2
- package/dist/edge-node/edge-node.js.map +1 -1
- package/dist/edge-node/index.d.ts +1 -0
- package/dist/edge-node/index.js +1 -0
- package/dist/edge-node/index.js.map +1 -1
- package/dist/edge-node/join-credential.d.ts +1 -1
- package/dist/edge-node/join-credential.js +1 -1
- package/dist/edge-node/lazy-raw-storage.js +12 -0
- package/dist/edge-node/lazy-raw-storage.js.map +1 -1
- package/dist/edge-node/listen-addrs.d.ts +21 -0
- package/dist/edge-node/listen-addrs.js +25 -0
- package/dist/edge-node/listen-addrs.js.map +1 -0
- package/dist/edge-node/owner-grant.d.ts +1 -1
- package/dist/edge-node/owner-grant.js +1 -1
- package/dist/edge-node/platform.d.ts +5 -4
- package/dist/edge-node/platform.js.map +1 -1
- package/dist/edge-node/strand-move.d.ts +1 -1
- package/dist/edge-node/strand-move.js +1 -1
- package/dist/edge-node/strands.js +27 -11
- package/dist/edge-node/strands.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +18 -7
- package/dist/index.js.map +1 -1
- package/dist/invitation-bootstrap.d.ts +28 -5
- package/dist/invitation-bootstrap.js +41 -8
- package/dist/invitation-bootstrap.js.map +1 -1
- package/dist/link-budget.d.ts +53 -4
- package/dist/link-budget.js +58 -5
- package/dist/link-budget.js.map +1 -1
- package/dist/machine-removal.d.ts +2 -2
- package/dist/machine-removal.js +4 -3
- package/dist/machine-removal.js.map +1 -1
- package/dist/membership-connection-gater.d.ts +2 -2
- package/dist/membership-connection-gater.js +2 -2
- package/dist/membership-view.d.ts +2 -2
- package/dist/membership-view.js +2 -2
- package/dist/node-claim-payload.d.ts +15 -7
- package/dist/node-claim-payload.js +25 -9
- package/dist/node-claim-payload.js.map +1 -1
- package/dist/node-class.d.ts +36 -0
- package/dist/node-class.js +26 -0
- package/dist/node-class.js.map +1 -0
- package/dist/node-default-transports.d.ts +50 -3
- package/dist/node-default-transports.js +48 -3
- package/dist/node-default-transports.js.map +1 -1
- package/dist/node-roles.d.ts +118 -0
- package/dist/node-roles.js +142 -0
- package/dist/node-roles.js.map +1 -0
- package/dist/node-transports.d.ts +6 -2
- package/dist/node-transports.js +39 -7
- package/dist/node-transports.js.map +1 -1
- package/dist/owner-anchor-sync.js +1 -1
- package/dist/owner-key-export.js +1 -1
- package/dist/owner-key-flows.d.ts +1 -1
- package/dist/owner-key-store.js +1 -1
- package/dist/owner-signer.js +1 -1
- package/dist/peer-authorization.d.ts +3 -1
- package/dist/peer-authorization.js +3 -1
- package/dist/peer-authorization.js.map +1 -1
- package/dist/peer-dial.d.ts +74 -10
- package/dist/peer-dial.js +89 -17
- package/dist/peer-dial.js.map +1 -1
- package/dist/peer-join-backfill.js +4 -4
- package/dist/peer-join-backfill.js.map +1 -1
- package/dist/peer-record.d.ts +34 -9
- package/dist/peer-record.js +66 -13
- package/dist/peer-record.js.map +1 -1
- package/dist/pending-join-runner.d.ts +1 -1
- package/dist/pending-join-runner.js +1 -1
- package/dist/provider/client.d.ts +6 -5
- package/dist/provider/client.js +3 -3
- package/dist/provider/client.js.map +1 -1
- package/dist/provider/descriptor.d.ts +1 -1
- package/dist/provider/descriptor.js +1 -1
- package/dist/provider/oauth.d.ts +1 -1
- package/dist/provider/oauth.js +1 -1
- package/dist/provider/rent-node.d.ts +4 -3
- package/dist/provider/rent-node.js +3 -3
- package/dist/provider/rent-node.js.map +1 -1
- package/dist/relay-addrs.d.ts +62 -7
- package/dist/relay-addrs.js +74 -11
- package/dist/relay-addrs.js.map +1 -1
- package/dist/relay-reservation.d.ts +1 -1
- package/dist/relay-reservation.js +1 -1
- package/dist/relay-server.d.ts +6 -5
- package/dist/relay-server.js +5 -5
- package/dist/relay-server.js.map +1 -1
- package/dist/schema-verification.d.ts +13 -10
- package/dist/schema-verification.js +32 -24
- package/dist/schema-verification.js.map +1 -1
- package/dist/sealed-party-key.js +1 -1
- package/dist/seed-bootstrap.d.ts +4 -3
- package/dist/seed-bootstrap.js +6 -7
- package/dist/seed-bootstrap.js.map +1 -1
- package/dist/strand-addr-protocol.d.ts +8 -6
- package/dist/strand-addr-protocol.js +12 -10
- package/dist/strand-addr-protocol.js.map +1 -1
- package/dist/strand-app-schema-report.d.ts +16 -2
- package/dist/strand-app-schema-report.js +15 -0
- package/dist/strand-app-schema-report.js.map +1 -1
- package/dist/strand-cohort.d.ts +1 -4
- package/dist/strand-cohort.js.map +1 -1
- package/dist/strand-commit-durability.d.ts +1 -1
- package/dist/strand-database.d.ts +13 -6
- package/dist/strand-database.js +17 -9
- package/dist/strand-database.js.map +1 -1
- package/dist/strand-first-sync-gate.d.ts +3 -2
- package/dist/strand-first-sync-gate.js +3 -2
- package/dist/strand-first-sync-gate.js.map +1 -1
- package/dist/strand-formation-deadlines.d.ts +2 -2
- package/dist/strand-formation-deadlines.js +2 -2
- package/dist/strand-formation-protocol.d.ts +1 -1
- package/dist/strand-formation-protocol.js +51 -16
- package/dist/strand-formation-protocol.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +67 -33
- package/dist/strand-instance-manager.js +164 -55
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-membership-reconciler.d.ts +8 -3
- package/dist/strand-membership-reconciler.js +8 -3
- package/dist/strand-membership-reconciler.js.map +1 -1
- package/dist/strand-membership-writer.d.ts +2 -2
- package/dist/strand-membership-writer.js +41 -39
- package/dist/strand-membership-writer.js.map +1 -1
- package/dist/strand-move.js +1 -1
- package/dist/strand-network-config.d.ts +15 -5
- package/dist/strand-network-config.js +7 -6
- package/dist/strand-network-config.js.map +1 -1
- package/dist/strand-party-key-rotation.d.ts +7 -3
- package/dist/strand-party-key-rotation.js +7 -3
- package/dist/strand-party-key-rotation.js.map +1 -1
- package/dist/strand-party-machines.d.ts +19 -8
- package/dist/strand-party-machines.js +26 -11
- package/dist/strand-party-machines.js.map +1 -1
- package/dist/strand-party-peers.d.ts +36 -14
- package/dist/strand-party-peers.js +24 -15
- package/dist/strand-party-peers.js.map +1 -1
- package/dist/strand-peer-redial.d.ts +1 -1
- package/dist/strand-peer-redial.js +1 -1
- package/dist/strand-reactivity.d.ts +20 -17
- package/dist/strand-reactivity.js +31 -18
- package/dist/strand-reactivity.js.map +1 -1
- package/dist/strand-revocation-enforcer.d.ts +3 -3
- package/dist/strand-revocation-enforcer.js +3 -3
- package/dist/strand-wake-protocol.d.ts +19 -7
- package/dist/strand-wake-protocol.js +22 -10
- package/dist/strand-wake-protocol.js.map +1 -1
- package/dist/strand-watcher.d.ts +1 -1
- package/dist/strand-watcher.js +1 -1
- package/dist/table-change-watch.js +1 -1
- package/dist/types.d.ts +116 -55
- package/dist/types.js.map +1 -1
- package/dist/webrtc-upgrade.d.ts +254 -0
- package/dist/webrtc-upgrade.js +355 -0
- package/dist/webrtc-upgrade.js.map +1 -0
- package/package.json +9 -9
- package/src/announce-addrs.ts +93 -93
- package/src/arachnode-stub.ts +18 -10
- package/src/bootstrap-peer-store-file.ts +44 -44
- package/src/bootstrap-peer-store.ts +214 -214
- package/src/cadre-invite-protocol.ts +741 -740
- package/src/cadre-node.ts +12462 -12280
- package/src/claim-proof.ts +147 -147
- package/src/control-authorization.ts +290 -276
- package/src/control-cohort.ts +223 -204
- package/src/control-database.ts +72 -28
- package/src/control-formation-recorder.ts +359 -359
- package/src/control-protocol-guard.ts +370 -366
- package/src/control-read-retry.ts +222 -180
- package/src/control-retry.ts +36 -4
- package/src/control-schema-version.ts +301 -301
- package/src/control-schema.ts +1108 -1087
- package/src/control-write-retry.ts +639 -669
- package/src/delegate-admission.ts +351 -351
- package/src/describe-thrown.ts +60 -60
- package/src/ed25519-key.ts +185 -185
- package/src/edge-node/config.ts +13 -10
- package/src/edge-node/dissolve.ts +252 -252
- package/src/edge-node/edge-join.ts +320 -320
- package/src/edge-node/edge-node.ts +1095 -1095
- package/src/edge-node/index.ts +60 -59
- package/src/edge-node/join-credential.ts +16 -16
- package/src/edge-node/lazy-raw-storage.ts +194 -178
- package/src/edge-node/listen-addrs.ts +26 -0
- package/src/edge-node/node-local.ts +84 -84
- package/src/edge-node/options.ts +195 -195
- package/src/edge-node/owner-grant.ts +63 -63
- package/src/edge-node/platform.ts +5 -4
- package/src/edge-node/strand-move.ts +266 -266
- package/src/edge-node/strands.ts +27 -12
- package/src/enrolled-machine-store-file.ts +43 -43
- package/src/enrolled-machine-store.ts +280 -280
- package/src/fetch-impl.ts +23 -23
- package/src/file-durable-slot.ts +64 -64
- package/src/file-safe-name.ts +32 -32
- package/src/formation-approval.ts +604 -604
- package/src/formation-token.ts +63 -63
- package/src/fs-atomic.ts +92 -92
- package/src/index.ts +987 -957
- package/src/invitation-bootstrap.ts +152 -118
- package/src/joined-strand-store.ts +553 -553
- package/src/key-store-file.ts +142 -142
- package/src/link-budget.ts +61 -5
- package/src/machine-removal.ts +211 -210
- package/src/member-redemption.ts +643 -643
- package/src/membership-connection-gater.ts +650 -650
- package/src/membership-view.ts +147 -147
- package/src/node-claim-payload.ts +34 -12
- package/src/node-class.ts +47 -0
- package/src/node-default-transports.ts +65 -3
- package/src/node-roles.ts +220 -0
- package/src/node-transports.ts +86 -49
- package/src/owner-anchor-sync.ts +172 -172
- package/src/owner-grant-protocol.ts +547 -547
- package/src/owner-key-export.ts +348 -348
- package/src/owner-key-flows.ts +109 -109
- package/src/owner-key-store.ts +1 -1
- package/src/owner-keys.ts +179 -179
- package/src/owner-signer.ts +92 -92
- package/src/peer-addr-book.ts +252 -252
- package/src/peer-authorization.ts +584 -582
- package/src/peer-dial.ts +698 -605
- package/src/peer-join-backfill.ts +961 -961
- package/src/peer-record.ts +71 -16
- package/src/pending-join-runner.ts +798 -798
- package/src/primary-lan-address.ts +47 -47
- package/src/provider/client.ts +327 -326
- package/src/provider/descriptor.ts +129 -129
- package/src/provider/index.ts +59 -59
- package/src/provider/oauth.ts +285 -285
- package/src/provider/rent-node.ts +276 -275
- package/src/relay-addrs.ts +90 -12
- package/src/relay-reservation.ts +1 -1
- package/src/relay-server.ts +99 -98
- package/src/schema-verification.ts +38 -23
- package/src/sealed-party-key.ts +190 -190
- package/src/seed-bootstrap.ts +8 -11
- package/src/seed-trust-policy.ts +353 -353
- package/src/self-address-update.ts +19 -19
- package/src/strand-addr-protocol.ts +17 -14
- package/src/strand-app-schema-report.ts +147 -122
- package/src/strand-cohort.ts +1 -5
- package/src/strand-commit-durability.ts +165 -165
- package/src/strand-database.ts +522 -510
- package/src/strand-first-sync-gate.ts +3 -2
- package/src/strand-formation-deadlines.ts +227 -227
- package/src/strand-formation-manager.ts +731 -731
- package/src/strand-formation-protocol.ts +1174 -1138
- package/src/strand-fret-addrs.ts +179 -179
- package/src/strand-instance-manager.ts +188 -63
- package/src/strand-membership-reconciler.ts +1315 -1310
- package/src/strand-membership-writer.ts +2152 -2150
- package/src/strand-move.ts +1 -1
- package/src/strand-network-config.ts +16 -6
- package/src/strand-offline.ts +178 -178
- package/src/strand-party-key-rotation.ts +440 -436
- package/src/strand-party-machines.ts +308 -293
- package/src/strand-party-peers.ts +151 -129
- package/src/strand-peer-redial.ts +1 -1
- package/src/strand-reactivity.ts +36 -19
- package/src/strand-revocation-enforcer.ts +758 -758
- package/src/strand-wake-protocol.ts +406 -394
- package/src/strand-watcher.ts +1 -1
- package/src/table-change-watch.ts +285 -285
- package/src/timed-step.ts +28 -28
- package/src/timeout-scheduler.ts +29 -29
- package/src/trusted-owner-store.ts +242 -242
- package/src/types.ts +3182 -3121
- package/src/webrtc-upgrade.ts +439 -0
package/dist/relay-addrs.d.ts
CHANGED
|
@@ -53,8 +53,9 @@
|
|
|
53
53
|
* other. A node with configured relays is built with that discovery switched off
|
|
54
54
|
* altogether when it has a transport list to wrap (`node-transports.ts`), because it
|
|
55
55
|
* CAN reach a relay-capable peer in its own namespace and take the configured relay's
|
|
56
|
-
* slot. See `relay-reservation.ts`'s module doc and `docs/
|
|
56
|
+
* slot. See `relay-reservation.ts`'s module doc and `docs/network/relay.md`.
|
|
57
57
|
*/
|
|
58
|
+
import { type StunServer } from './relay-stun.js';
|
|
58
59
|
import type { NetworkConfig } from './types.js';
|
|
59
60
|
import type { RelayReservationState } from './relay-reservation.js';
|
|
60
61
|
/**
|
|
@@ -77,6 +78,18 @@ export declare const DEFAULT_DIRECT_LISTEN_ADDR = "/ip4/0.0.0.0/tcp/0";
|
|
|
77
78
|
* each relay's supervisor has a slot of its own to fill.
|
|
78
79
|
*/
|
|
79
80
|
export declare const RELAY_SEARCH_LISTEN_ADDR = "/p2p-circuit";
|
|
81
|
+
/**
|
|
82
|
+
* The WebRTC listen entry, for every host that offers one: the edge apps
|
|
83
|
+
* (`edge-node/listen-addrs.ts`) and `cadre-cli`'s `network.webrtc`. One home for the
|
|
84
|
+
* spelling {@link listenTransportKind} classifies, like the two constants around it —
|
|
85
|
+
* a host that mis-spells it gets a refusal naming the transport instead of a listener.
|
|
86
|
+
*
|
|
87
|
+
* It binds no socket: the transport registers libp2p's signalling handler and derives
|
|
88
|
+
* this node's address from each relay reservation it holds, which is why the entry is
|
|
89
|
+
* worth adding to a machine reachable only through a relay and worth nothing on one with
|
|
90
|
+
* a public address.
|
|
91
|
+
*/
|
|
92
|
+
export declare const WEBRTC_LISTEN_ADDR = "/webrtc";
|
|
80
93
|
/**
|
|
81
94
|
* The circuit-listen multiaddr for each configured relay: `<relayAddr>/p2p-circuit`.
|
|
82
95
|
* An entry that already carries `/p2p-circuit` is passed through unchanged.
|
|
@@ -120,7 +133,37 @@ export interface ListenTransportOptions {
|
|
|
120
133
|
* {@link WS_TRANSPORT_SWITCH_PORT}.
|
|
121
134
|
*/
|
|
122
135
|
wsPort?: number;
|
|
136
|
+
/**
|
|
137
|
+
* Present when some listen entry names `/webrtc` — the switch that makes
|
|
138
|
+
* `nodeDefaultTransports` add `@libp2p/webrtc`'s transport
|
|
139
|
+
* (`node-default-transports.ts`). Unlike {@link wsPort} the value is real: it is the
|
|
140
|
+
* ICE servers that transport needs, derived once here from `network.relayAddrs` and
|
|
141
|
+
* `network.stunUrls` (`relay-stun.ts` → `resolveStunServers`), so the factory reads one
|
|
142
|
+
* field instead of re-deriving them from a `NetworkConfig` it is not given.
|
|
143
|
+
*
|
|
144
|
+
* May be EMPTY, and an empty array is still the switch: WebRTC with no STUN server
|
|
145
|
+
* offers host and LAN candidates only, which is enough between two machines on one
|
|
146
|
+
* network. Absent is the only "no WebRTC" answer.
|
|
147
|
+
*/
|
|
148
|
+
webrtcIceServers?: StunServer[];
|
|
123
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* The subset of a resolved {@link ListenTransportOptions} that is a `createLibp2pNode` option,
|
|
152
|
+
* for the two sites that spread it into one (`cadre-node.ts`, `strand-instance-manager.ts`).
|
|
153
|
+
*
|
|
154
|
+
* `wsPort` is db-p2p's own switch, so it goes through. {@link ListenTransportOptions.webrtcIceServers}
|
|
155
|
+
* does not: it is read only by `network.defaultTransports`, and db-p2p knows no such key —
|
|
156
|
+
* handing it one is the drift the strand builder already avoids for `relayAddrs`. One home for
|
|
157
|
+
* that distinction rather than a correct spread at each site.
|
|
158
|
+
*
|
|
159
|
+
* NOTE: the allow-list is the destructuring, so a THIRD {@link ListenTransportOptions} field that
|
|
160
|
+
* is a db-p2p option has to be added here too or it is dropped in silence. Deliberate — the
|
|
161
|
+
* opposite default would leak a cadre-only field into db-p2p's options, which is the failure the
|
|
162
|
+
* function exists to prevent.
|
|
163
|
+
*/
|
|
164
|
+
export declare function listenTransportNodeOptions({ wsPort }: ListenTransportOptions): {
|
|
165
|
+
wsPort?: number;
|
|
166
|
+
};
|
|
124
167
|
/**
|
|
125
168
|
* The transport-derived libp2p options `listenAddrs` implies, and the gate that stops a
|
|
126
169
|
* listen address the node has no transport for from being SILENTLY dropped.
|
|
@@ -144,11 +187,18 @@ export interface ListenTransportOptions {
|
|
|
144
187
|
* case where cadre passes the transport list itself (`node-transports.ts`, to switch
|
|
145
188
|
* relay discovery off); when the embedder gave none, that list comes from
|
|
146
189
|
* `network.defaultTransports`, which reads the same switch.
|
|
147
|
-
* - **
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
190
|
+
* - **WebRTC is derived ONLY for a node that passed `network.defaultTransports`.** That
|
|
191
|
+
* field is a Node host's injected transport list
|
|
192
|
+
* (`@serfab/cadre-core/node-default-transports`), and it is the only thing in this repo
|
|
193
|
+
* that can supply `@libp2p/webrtc`'s Node build — whose module graph loads
|
|
194
|
+
* `node-datachannel`'s native addon, so this file's graph, which every React Native and
|
|
195
|
+
* browser bundle reaches, must not import it. Without that field a `/webrtc` entry is
|
|
196
|
+
* refused exactly as before.
|
|
197
|
+
* - **Everything else is REFUSED.** Deriving `/quic-v1` or `/webtransport` would mean
|
|
198
|
+
* importing transport packages into every `cadre-core` consumer including the React
|
|
199
|
+
* Native and browser bundles (against the cross-platform rule in `AGENTS.md`) and
|
|
200
|
+
* duplicating policy `libp2p-node.ts` owns. So name the address, name the transport it
|
|
201
|
+
* needs, and refuse to start — matching how `network.relayAddrs` and
|
|
152
202
|
* `network.announceAddrs` already treat an operator typo.
|
|
153
203
|
*
|
|
154
204
|
* Returns `{}` unconditionally when `network.transports` is set: a programmatic embedder
|
|
@@ -172,7 +222,8 @@ export interface ListenTransportOptions {
|
|
|
172
222
|
* {@link resolveListenAddrs}, or the strand derivation, after any per-node rewriting —
|
|
173
223
|
* so the check reads what this node will actually bind.
|
|
174
224
|
* @throws {UnbindableListenAddressError} when a listen entry names a transport outside
|
|
175
|
-
* {tcp, ws/wss, p2p-circuit}
|
|
225
|
+
* {tcp, ws/wss, p2p-circuit}, or names `/webrtc` on a node that passed no
|
|
226
|
+
* `network.defaultTransports`.
|
|
176
227
|
*/
|
|
177
228
|
export declare function resolveTransportOptions(network: NetworkConfig | undefined, listenAddrs: readonly string[] | undefined): ListenTransportOptions;
|
|
178
229
|
/**
|
|
@@ -180,6 +231,10 @@ export declare function resolveTransportOptions(network: NetworkConfig | undefin
|
|
|
180
231
|
* default transports can bind. Names each offending address alongside the libp2p
|
|
181
232
|
* transport package it would need — what the operator has without this is a node that
|
|
182
233
|
* starts and silently never listens there.
|
|
234
|
+
*
|
|
235
|
+
* A `/webrtc` entry reaches this only on a node that passed no
|
|
236
|
+
* `network.defaultTransports`, so it gets the extra sentence naming the setting that
|
|
237
|
+
* does supply WebRTC on a Node host.
|
|
183
238
|
*/
|
|
184
239
|
export declare class UnbindableListenAddressError extends Error {
|
|
185
240
|
readonly listenAddrs: readonly string[];
|
package/dist/relay-addrs.js
CHANGED
|
@@ -53,10 +53,11 @@
|
|
|
53
53
|
* other. A node with configured relays is built with that discovery switched off
|
|
54
54
|
* altogether when it has a transport list to wrap (`node-transports.ts`), because it
|
|
55
55
|
* CAN reach a relay-capable peer in its own namespace and take the configured relay's
|
|
56
|
-
* slot. See `relay-reservation.ts`'s module doc and `docs/
|
|
56
|
+
* slot. See `relay-reservation.ts`'s module doc and `docs/network/relay.md`.
|
|
57
57
|
*/
|
|
58
58
|
import { multiaddr } from '@multiformats/multiaddr';
|
|
59
59
|
import { circuitRelayTargetOrThrow } from './delegate-admission.js';
|
|
60
|
+
import { resolveStunServers } from './relay-stun.js';
|
|
60
61
|
/**
|
|
61
62
|
* The direct listener a node keeps when it configures `relayAddrs` but no
|
|
62
63
|
* `listenAddrs`. Without this, naming a relay would silently REPLACE the node's
|
|
@@ -77,6 +78,18 @@ export const DEFAULT_DIRECT_LISTEN_ADDR = '/ip4/0.0.0.0/tcp/0';
|
|
|
77
78
|
* each relay's supervisor has a slot of its own to fill.
|
|
78
79
|
*/
|
|
79
80
|
export const RELAY_SEARCH_LISTEN_ADDR = '/p2p-circuit';
|
|
81
|
+
/**
|
|
82
|
+
* The WebRTC listen entry, for every host that offers one: the edge apps
|
|
83
|
+
* (`edge-node/listen-addrs.ts`) and `cadre-cli`'s `network.webrtc`. One home for the
|
|
84
|
+
* spelling {@link listenTransportKind} classifies, like the two constants around it —
|
|
85
|
+
* a host that mis-spells it gets a refusal naming the transport instead of a listener.
|
|
86
|
+
*
|
|
87
|
+
* It binds no socket: the transport registers libp2p's signalling handler and derives
|
|
88
|
+
* this node's address from each relay reservation it holds, which is why the entry is
|
|
89
|
+
* worth adding to a machine reachable only through a relay and worth nothing on one with
|
|
90
|
+
* a public address.
|
|
91
|
+
*/
|
|
92
|
+
export const WEBRTC_LISTEN_ADDR = '/webrtc';
|
|
80
93
|
/**
|
|
81
94
|
* The circuit-listen multiaddr for each configured relay: `<relayAddr>/p2p-circuit`.
|
|
82
95
|
* An entry that already carries `/p2p-circuit` is passed through unchanged.
|
|
@@ -119,11 +132,28 @@ export function resolveListenAddrs(network) {
|
|
|
119
132
|
if (!listenAddrs && relayEntries.length === 0) {
|
|
120
133
|
return undefined;
|
|
121
134
|
}
|
|
122
|
-
// An explicitly empty `listenAddrs` (
|
|
135
|
+
// An explicitly empty `listenAddrs` (a device that names no listener of its own) stays
|
|
123
136
|
// empty — but a relay named alongside it still gets its listen entry, since
|
|
124
137
|
// acquiring a slot is the whole point of configuring a relay.
|
|
125
138
|
return dedupe([...(listenAddrs ?? [DEFAULT_DIRECT_LISTEN_ADDR]), ...relayEntries]);
|
|
126
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* The subset of a resolved {@link ListenTransportOptions} that is a `createLibp2pNode` option,
|
|
142
|
+
* for the two sites that spread it into one (`cadre-node.ts`, `strand-instance-manager.ts`).
|
|
143
|
+
*
|
|
144
|
+
* `wsPort` is db-p2p's own switch, so it goes through. {@link ListenTransportOptions.webrtcIceServers}
|
|
145
|
+
* does not: it is read only by `network.defaultTransports`, and db-p2p knows no such key —
|
|
146
|
+
* handing it one is the drift the strand builder already avoids for `relayAddrs`. One home for
|
|
147
|
+
* that distinction rather than a correct spread at each site.
|
|
148
|
+
*
|
|
149
|
+
* NOTE: the allow-list is the destructuring, so a THIRD {@link ListenTransportOptions} field that
|
|
150
|
+
* is a db-p2p option has to be added here too or it is dropped in silence. Deliberate — the
|
|
151
|
+
* opposite default would leak a cadre-only field into db-p2p's options, which is the failure the
|
|
152
|
+
* function exists to prevent.
|
|
153
|
+
*/
|
|
154
|
+
export function listenTransportNodeOptions({ wsPort }) {
|
|
155
|
+
return wsPort === undefined ? {} : { wsPort };
|
|
156
|
+
}
|
|
127
157
|
/**
|
|
128
158
|
* The `wsPort` value passed purely to turn `@optimystic/db-p2p`'s WebSocket transport
|
|
129
159
|
* ON. It is never bound, so it is deliberately `0` rather than a port scraped from a
|
|
@@ -177,11 +207,18 @@ const WS_TRANSPORT_SWITCH_PORT = 0;
|
|
|
177
207
|
* case where cadre passes the transport list itself (`node-transports.ts`, to switch
|
|
178
208
|
* relay discovery off); when the embedder gave none, that list comes from
|
|
179
209
|
* `network.defaultTransports`, which reads the same switch.
|
|
180
|
-
* - **
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
210
|
+
* - **WebRTC is derived ONLY for a node that passed `network.defaultTransports`.** That
|
|
211
|
+
* field is a Node host's injected transport list
|
|
212
|
+
* (`@serfab/cadre-core/node-default-transports`), and it is the only thing in this repo
|
|
213
|
+
* that can supply `@libp2p/webrtc`'s Node build — whose module graph loads
|
|
214
|
+
* `node-datachannel`'s native addon, so this file's graph, which every React Native and
|
|
215
|
+
* browser bundle reaches, must not import it. Without that field a `/webrtc` entry is
|
|
216
|
+
* refused exactly as before.
|
|
217
|
+
* - **Everything else is REFUSED.** Deriving `/quic-v1` or `/webtransport` would mean
|
|
218
|
+
* importing transport packages into every `cadre-core` consumer including the React
|
|
219
|
+
* Native and browser bundles (against the cross-platform rule in `AGENTS.md`) and
|
|
220
|
+
* duplicating policy `libp2p-node.ts` owns. So name the address, name the transport it
|
|
221
|
+
* needs, and refuse to start — matching how `network.relayAddrs` and
|
|
185
222
|
* `network.announceAddrs` already treat an operator typo.
|
|
186
223
|
*
|
|
187
224
|
* Returns `{}` unconditionally when `network.transports` is set: a programmatic embedder
|
|
@@ -205,31 +242,49 @@ const WS_TRANSPORT_SWITCH_PORT = 0;
|
|
|
205
242
|
* {@link resolveListenAddrs}, or the strand derivation, after any per-node rewriting —
|
|
206
243
|
* so the check reads what this node will actually bind.
|
|
207
244
|
* @throws {UnbindableListenAddressError} when a listen entry names a transport outside
|
|
208
|
-
* {tcp, ws/wss, p2p-circuit}
|
|
245
|
+
* {tcp, ws/wss, p2p-circuit}, or names `/webrtc` on a node that passed no
|
|
246
|
+
* `network.defaultTransports`.
|
|
209
247
|
*/
|
|
210
248
|
export function resolveTransportOptions(network, listenAddrs) {
|
|
211
249
|
if (network?.transports) {
|
|
212
250
|
return {};
|
|
213
251
|
}
|
|
214
252
|
const kinds = (listenAddrs ?? []).map((addr) => [addr, listenTransportKind(addr)]);
|
|
215
|
-
|
|
253
|
+
// A `/webrtc` entry is bindable only through an injected default transport list, so
|
|
254
|
+
// without one it joins the refusal rather than being accepted and silently unbound.
|
|
255
|
+
const webrtcBindable = network?.defaultTransports !== undefined;
|
|
256
|
+
const unsupported = kinds
|
|
257
|
+
.filter(([, kind]) => kind === 'unsupported' || (kind === 'webrtc' && !webrtcBindable))
|
|
258
|
+
.map(([addr]) => addr);
|
|
216
259
|
if (unsupported.length > 0) {
|
|
217
260
|
throw new UnbindableListenAddressError(unsupported);
|
|
218
261
|
}
|
|
219
|
-
return
|
|
262
|
+
return {
|
|
263
|
+
...(kinds.some(([, kind]) => kind === 'websockets') && { wsPort: WS_TRANSPORT_SWITCH_PORT }),
|
|
264
|
+
...(kinds.some(([, kind]) => kind === 'webrtc') && {
|
|
265
|
+
webrtcIceServers: resolveStunServers(network?.relayAddrs ?? [], network?.stunUrls)
|
|
266
|
+
})
|
|
267
|
+
};
|
|
220
268
|
}
|
|
221
269
|
/**
|
|
222
270
|
* Thrown at config resolution when `network.listenAddrs` names an address none of the
|
|
223
271
|
* default transports can bind. Names each offending address alongside the libp2p
|
|
224
272
|
* transport package it would need — what the operator has without this is a node that
|
|
225
273
|
* starts and silently never listens there.
|
|
274
|
+
*
|
|
275
|
+
* A `/webrtc` entry reaches this only on a node that passed no
|
|
276
|
+
* `network.defaultTransports`, so it gets the extra sentence naming the setting that
|
|
277
|
+
* does supply WebRTC on a Node host.
|
|
226
278
|
*/
|
|
227
279
|
export class UnbindableListenAddressError extends Error {
|
|
228
280
|
constructor(listenAddrs) {
|
|
229
281
|
super('network.listenAddrs names an address this node has no transport for: ' +
|
|
230
282
|
`${listenAddrs.map((a) => `${a} — ${unbindableReason(a)}`).join('; ')}. ` +
|
|
231
283
|
'Default transports bind TCP (including /unix/<path>), WebSocket (/ws, /wss) and circuit-relay addresses only. ' +
|
|
232
|
-
'Either drop the address, or supply the transport programmatically via network.transports.'
|
|
284
|
+
'Either drop the address, or supply the transport programmatically via network.transports.' +
|
|
285
|
+
(listenAddrs.some((a) => listenTransportKind(a) === 'webrtc')
|
|
286
|
+
? ' A /webrtc listener needs a Node host that passes network.defaultTransports (cadre-cli: network.webrtc).'
|
|
287
|
+
: ''));
|
|
233
288
|
this.listenAddrs = listenAddrs;
|
|
234
289
|
this.name = 'UnbindableListenAddressError';
|
|
235
290
|
}
|
|
@@ -267,6 +322,14 @@ function listenTransportKind(listenAddr) {
|
|
|
267
322
|
if (outermost === 'ws' || outermost === 'wss') {
|
|
268
323
|
return 'websockets';
|
|
269
324
|
}
|
|
325
|
+
// Read from the outermost component like every other kind here, so `/webrtc` and a
|
|
326
|
+
// `…/p2p-circuit/webrtc` entry classify alike — they need the same transport, and the
|
|
327
|
+
// relayed form is the shape libp2p itself derives for a `/webrtc` listener once the
|
|
328
|
+
// reservation lands. `/webrtc-direct` is deliberately NOT this kind: it is a separate
|
|
329
|
+
// libp2p transport (`webRTCDirect`) that nothing here supplies.
|
|
330
|
+
if (outermost === 'webrtc') {
|
|
331
|
+
return 'webrtc';
|
|
332
|
+
}
|
|
270
333
|
// Only a BARE tcp or unix stack is TCP. `@libp2p/tcp` binds both — its `listenFilter`
|
|
271
334
|
// accepts an exact TCP match OR a `/unix/<path>` address (a named pipe on Windows) —
|
|
272
335
|
// and nothing layered on top of either, which is why `/tcp/<port>/<anything else>` is
|
package/dist/relay-addrs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-addrs.js","sourceRoot":"","sources":["../src/relay-addrs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,OAAO,EAAE,SAAS,EAAkB,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"relay-addrs.js","sourceRoot":"","sources":["../src/relay-addrs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,OAAO,EAAE,SAAS,EAAkB,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAmB,MAAM,iBAAiB,CAAC;AAItE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,cAAc,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAE5C;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAA6B;IAC7D,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAkC;IACnE,MAAM,YAAY,GAAG,iBAAiB,CAAC,OAAO,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;QAC1E,CAAC,CAAC,CAAC,wBAAwB,CAAC;QAC5B,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,WAAW,GA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IAC3E,IAAI,CAAC;QACH,yBAAyB,CAAC,UAAU,CAAC,CAAC,CAAC,6BAA6B;IACtE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,4FAA4F,SAAS,EAAE,EACvG,EAAE,KAAK,EAAE,GAAG,EAAE,CACf,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,2FAA2F;AAC3F,SAAS,eAAe,CAAC,SAAiB;IACxC,IAAI,CAAC;QACH,OAAO,SAAS,CAAC,SAAS,CAAC,CAAC,aAAa,EAAE,CAAC;IAC9C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,sDAAsD,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IACrG,CAAC;AACH,CAAC;AAED,yFAAyF;AACzF,SAAS,MAAM,CAAC,KAAwB;IACtC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
*
|
|
76
76
|
* ⚠️ WHY LIBP2P'S RELAY DISCOVERY IS SWITCHED OFF. Discovery does reach SOME
|
|
77
77
|
* peers: every connected peer whose identify lists the relay-hop protocol, and a
|
|
78
|
-
*
|
|
78
|
+
* `'server'` member's strand node runs the relay server in the same
|
|
79
79
|
* `/optimystic/strand-<id>/…` namespace as this node's strand node (control nodes
|
|
80
80
|
* share `/optimystic/control-<partyId>/…` the same way). Discovery reserves on such
|
|
81
81
|
* a peer as soon as it connects, and that takes one of the slots the configured
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
*
|
|
76
76
|
* ⚠️ WHY LIBP2P'S RELAY DISCOVERY IS SWITCHED OFF. Discovery does reach SOME
|
|
77
77
|
* peers: every connected peer whose identify lists the relay-hop protocol, and a
|
|
78
|
-
*
|
|
78
|
+
* `'server'` member's strand node runs the relay server in the same
|
|
79
79
|
* `/optimystic/strand-<id>/…` namespace as this node's strand node (control nodes
|
|
80
80
|
* share `/optimystic/control-<partyId>/…` the same way). Discovery reserves on such
|
|
81
81
|
* a peer as soon as it connects, and that takes one of the slots the configured
|
package/dist/relay-server.d.ts
CHANGED
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
* this is the same policy for the party-run kind.
|
|
17
17
|
*/
|
|
18
18
|
import type { CircuitRelayServerInit, ServerReservationStoreInit } from '@libp2p/circuit-relay-v2';
|
|
19
|
-
import type { NetworkConfig
|
|
19
|
+
import type { NetworkConfig } from './types.js';
|
|
20
|
+
import type { NodeRoles } from './node-roles.js';
|
|
20
21
|
/**
|
|
21
22
|
* Default size of a party-run relay's reservation store, raised from libp2p's 15.
|
|
22
23
|
*
|
|
@@ -65,15 +66,15 @@ export interface ResolvedRelayServer {
|
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
68
|
/**
|
|
68
|
-
* Resolve the relay server for a node built from `network` with `
|
|
69
|
+
* Resolve the relay server for a node built from `network` with `roles`.
|
|
69
70
|
*
|
|
70
|
-
* `enabled`: an explicit `network.enableRelay` wins; otherwise
|
|
71
|
-
*
|
|
71
|
+
* `enabled`: an explicit `network.enableRelay` wins; otherwise an always-on node runs the
|
|
72
|
+
* server (those are the machines with the connectivity and uptime to be a relay).
|
|
72
73
|
*
|
|
73
74
|
* `init`: MERGED, not replaced. `reservations` is merged key by key over the party-run
|
|
74
75
|
* defaults, so a caller who sets only `maxReservations` does not silently get the data
|
|
75
76
|
* limit back; every other top-level key is taken from the caller as given. A key set to
|
|
76
77
|
* `undefined` counts as unset, so the default beneath it holds.
|
|
77
78
|
*/
|
|
78
|
-
export declare function resolveRelayServer(network: NetworkConfig | undefined,
|
|
79
|
+
export declare function resolveRelayServer(network: NetworkConfig | undefined, roles: NodeRoles): ResolvedRelayServer;
|
|
79
80
|
export {};
|
package/dist/relay-server.js
CHANGED
|
@@ -47,20 +47,20 @@ const PARTY_RELAY_RESERVATION_DEFAULTS = {
|
|
|
47
47
|
reservationTtl: PARTY_RELAY_RESERVATION_TTL_MS
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
50
|
-
* Resolve the relay server for a node built from `network` with `
|
|
50
|
+
* Resolve the relay server for a node built from `network` with `roles`.
|
|
51
51
|
*
|
|
52
|
-
* `enabled`: an explicit `network.enableRelay` wins; otherwise
|
|
53
|
-
*
|
|
52
|
+
* `enabled`: an explicit `network.enableRelay` wins; otherwise an always-on node runs the
|
|
53
|
+
* server (those are the machines with the connectivity and uptime to be a relay).
|
|
54
54
|
*
|
|
55
55
|
* `init`: MERGED, not replaced. `reservations` is merged key by key over the party-run
|
|
56
56
|
* defaults, so a caller who sets only `maxReservations` does not silently get the data
|
|
57
57
|
* limit back; every other top-level key is taken from the caller as given. A key set to
|
|
58
58
|
* `undefined` counts as unset, so the default beneath it holds.
|
|
59
59
|
*/
|
|
60
|
-
export function resolveRelayServer(network,
|
|
60
|
+
export function resolveRelayServer(network, roles) {
|
|
61
61
|
const override = network?.relayServerInit;
|
|
62
62
|
return {
|
|
63
|
-
enabled: network?.enableRelay ??
|
|
63
|
+
enabled: network?.enableRelay ?? roles.alwaysOn,
|
|
64
64
|
init: {
|
|
65
65
|
...override,
|
|
66
66
|
reservations: { ...PARTY_RELAY_RESERVATION_DEFAULTS, ...definedEntries(override?.reservations) }
|
package/dist/relay-server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-server.js","sourceRoot":"","sources":["../src/relay-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"relay-server.js","sourceRoot":"","sources":["../src/relay-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEjE;;;;GAIG;AACH,MAAM,gCAAgC,GAAG;IACvC,iBAAiB,EAAE,KAAK;IACxB,eAAe,EAAE,4BAA4B;IAC7C,cAAc,EAAE,8BAA8B;CACD,CAAC;AAmBhD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAkC,EAAE,KAAgB;IACrF,MAAM,QAAQ,GAAG,OAAO,EAAE,eAAe,CAAC;IAC1C,OAAO;QACL,OAAO,EAAE,OAAO,EAAE,WAAW,IAAI,KAAK,CAAC,QAAQ;QAC/C,IAAI,EAAE;YACJ,GAAG,QAAQ;YACX,YAAY,EAAE,EAAE,GAAG,gCAAgC,EAAE,GAAG,cAAc,CAAC,QAAQ,EAAE,YAAY,CAAC,EAAE;SACjG;KACF,CAAC;AACJ,CAAC;AAED,yFAAyF;AACzF,SAAS,cAAc,CAAmB,GAAkB;IAC1D,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAe,CAAC;AAChH,CAAC"}
|
|
@@ -1,36 +1,39 @@
|
|
|
1
1
|
import type { SAppConfig } from './types.js';
|
|
2
|
+
/** The `SAppConfig` fields the author's signature covers. */
|
|
3
|
+
export type SignedSAppFields = Pick<SAppConfig, 'schema' | 'version' | 'schemaVersion'>;
|
|
2
4
|
/**
|
|
3
5
|
* Error thrown when sApp schema signature verification fails.
|
|
4
6
|
*/
|
|
5
7
|
export declare class SchemaVerificationError extends Error {
|
|
6
8
|
readonly sAppId: string;
|
|
7
9
|
readonly version: string;
|
|
8
|
-
constructor(sAppId: string, version: string, reason: string);
|
|
10
|
+
constructor(sAppId: string, version: string, schemaVersion: number, reason: string);
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
|
-
* Sign an sApp schema with the author's ed25519
|
|
12
|
-
* Used by sApp authors when publishing their schema.
|
|
13
|
+
* Sign an sApp schema, its release version and its schema version with the author's ed25519
|
|
14
|
+
* private key. Used by sApp authors when publishing their schema.
|
|
13
15
|
*
|
|
14
|
-
* @param
|
|
15
|
-
* @param version - Schema version string
|
|
16
|
+
* @param sApp - The declarative schema DDL, the release version string and the schema version
|
|
16
17
|
* @param authorPrivateKey - Author's ed25519 private key (base64url)
|
|
17
18
|
* @returns Signature (base64url)
|
|
18
19
|
*/
|
|
19
|
-
export declare function signSchema(
|
|
20
|
+
export declare function signSchema(sApp: SignedSAppFields, authorPrivateKey: string): string;
|
|
20
21
|
/**
|
|
21
22
|
* Verify an sApp schema signature against the author's ed25519 public key.
|
|
22
23
|
*
|
|
23
|
-
* @param
|
|
24
|
-
* @param version - Schema version string
|
|
24
|
+
* @param sApp - The declarative schema DDL, the release version string and the schema version
|
|
25
25
|
* @param signature - Signature to verify (base64url)
|
|
26
26
|
* @param authorPublicKey - Author's ed25519 public key (base64url)
|
|
27
27
|
* @returns true if the signature is valid
|
|
28
28
|
*/
|
|
29
|
-
export declare function verifySchema(
|
|
29
|
+
export declare function verifySchema(sApp: SignedSAppFields, signature: string, authorPublicKey: string): boolean;
|
|
30
30
|
/**
|
|
31
31
|
* Assert that an SAppConfig has a valid schema signature.
|
|
32
32
|
* Throws SchemaVerificationError on failure.
|
|
33
33
|
*
|
|
34
|
+
* A `schemaVersion` that is not a positive safe integer is refused with reason
|
|
35
|
+
* `'invalid schemaVersion'` under either policy.
|
|
36
|
+
*
|
|
34
37
|
* Fail-closed by default: when `options.requireSignature` is not explicitly
|
|
35
38
|
* `false`, an absent signature is rejected with reason `'missing signature'`,
|
|
36
39
|
* distinct from the `'invalid signature'` (tampered/wrong-key) case. The
|
|
@@ -39,7 +42,7 @@ export declare function verifySchema(schema: string, version: string, signature:
|
|
|
39
42
|
*
|
|
40
43
|
* @param sAppConfig - The sApp configuration to verify
|
|
41
44
|
* @param options - Verification policy; `requireSignature` defaults to `true`
|
|
42
|
-
* @throws SchemaVerificationError if the signature is missing (when required) or invalid
|
|
45
|
+
* @throws SchemaVerificationError if the schema version is malformed, or the signature is missing (when required) or invalid
|
|
43
46
|
*/
|
|
44
47
|
export declare function assertSchemaSignature(sAppConfig: SAppConfig, options?: {
|
|
45
48
|
requireSignature?: boolean;
|
|
@@ -5,57 +5,61 @@ const log = debug('sereus:cadre:schema-verify');
|
|
|
5
5
|
* Error thrown when sApp schema signature verification fails.
|
|
6
6
|
*/
|
|
7
7
|
export class SchemaVerificationError extends Error {
|
|
8
|
-
constructor(sAppId, version, reason) {
|
|
9
|
-
super(`sApp schema verification failed for ${sAppId} v${version}: ${reason}`);
|
|
8
|
+
constructor(sAppId, version, schemaVersion, reason) {
|
|
9
|
+
super(`sApp schema verification failed for ${sAppId} v${version} (schema version ${String(schemaVersion)}): ${reason}`);
|
|
10
10
|
this.sAppId = sAppId;
|
|
11
11
|
this.version = version;
|
|
12
12
|
this.name = 'SchemaVerificationError';
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Compute the canonical digest of
|
|
17
|
-
* The payload is deterministic JSON
|
|
16
|
+
* Compute the canonical digest of the signed sApp fields for signing/verification.
|
|
17
|
+
* The payload is deterministic JSON, keys in this order:
|
|
18
|
+
* `{"schema":"...","schemaVersion":N,"version":"..."}`.
|
|
18
19
|
*/
|
|
19
|
-
function schemaDigest(schema, version) {
|
|
20
|
-
const payload = JSON.stringify({ schema, version });
|
|
20
|
+
function schemaDigest({ schema, schemaVersion, version }) {
|
|
21
|
+
const payload = JSON.stringify({ schema, schemaVersion, version });
|
|
21
22
|
return digest([payload], 'sha256', 'base64url');
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
|
-
* Sign an sApp schema with the author's ed25519
|
|
25
|
-
* Used by sApp authors when publishing their schema.
|
|
25
|
+
* Sign an sApp schema, its release version and its schema version with the author's ed25519
|
|
26
|
+
* private key. Used by sApp authors when publishing their schema.
|
|
26
27
|
*
|
|
27
|
-
* @param
|
|
28
|
-
* @param version - Schema version string
|
|
28
|
+
* @param sApp - The declarative schema DDL, the release version string and the schema version
|
|
29
29
|
* @param authorPrivateKey - Author's ed25519 private key (base64url)
|
|
30
30
|
* @returns Signature (base64url)
|
|
31
31
|
*/
|
|
32
|
-
export function signSchema(
|
|
33
|
-
|
|
34
|
-
return sign(d, authorPrivateKey, 'ed25519', 'base64url', 'base64url', 'base64url');
|
|
32
|
+
export function signSchema(sApp, authorPrivateKey) {
|
|
33
|
+
return sign(schemaDigest(sApp), authorPrivateKey, 'ed25519', 'base64url', 'base64url', 'base64url');
|
|
35
34
|
}
|
|
36
35
|
/**
|
|
37
36
|
* Verify an sApp schema signature against the author's ed25519 public key.
|
|
38
37
|
*
|
|
39
|
-
* @param
|
|
40
|
-
* @param version - Schema version string
|
|
38
|
+
* @param sApp - The declarative schema DDL, the release version string and the schema version
|
|
41
39
|
* @param signature - Signature to verify (base64url)
|
|
42
40
|
* @param authorPublicKey - Author's ed25519 public key (base64url)
|
|
43
41
|
* @returns true if the signature is valid
|
|
44
42
|
*/
|
|
45
|
-
export function verifySchema(
|
|
43
|
+
export function verifySchema(sApp, signature, authorPublicKey) {
|
|
46
44
|
try {
|
|
47
|
-
|
|
48
|
-
return verify(d, signature, authorPublicKey, 'ed25519', 'base64url', 'base64url', 'base64url');
|
|
45
|
+
return verify(schemaDigest(sApp), signature, authorPublicKey, 'ed25519', 'base64url', 'base64url', 'base64url');
|
|
49
46
|
}
|
|
50
47
|
catch (error) {
|
|
51
48
|
log('Schema verification error: %o', error);
|
|
52
49
|
return false;
|
|
53
50
|
}
|
|
54
51
|
}
|
|
52
|
+
/** A schema version is a positive safe integer; anything else could not be compared against a strand's. */
|
|
53
|
+
function isValidSchemaVersion(schemaVersion) {
|
|
54
|
+
return Number.isSafeInteger(schemaVersion) && schemaVersion >= 1;
|
|
55
|
+
}
|
|
55
56
|
/**
|
|
56
57
|
* Assert that an SAppConfig has a valid schema signature.
|
|
57
58
|
* Throws SchemaVerificationError on failure.
|
|
58
59
|
*
|
|
60
|
+
* A `schemaVersion` that is not a positive safe integer is refused with reason
|
|
61
|
+
* `'invalid schemaVersion'` under either policy.
|
|
62
|
+
*
|
|
59
63
|
* Fail-closed by default: when `options.requireSignature` is not explicitly
|
|
60
64
|
* `false`, an absent signature is rejected with reason `'missing signature'`,
|
|
61
65
|
* distinct from the `'invalid signature'` (tampered/wrong-key) case. The
|
|
@@ -64,23 +68,27 @@ export function verifySchema(schema, version, signature, authorPublicKey) {
|
|
|
64
68
|
*
|
|
65
69
|
* @param sAppConfig - The sApp configuration to verify
|
|
66
70
|
* @param options - Verification policy; `requireSignature` defaults to `true`
|
|
67
|
-
* @throws SchemaVerificationError if the signature is missing (when required) or invalid
|
|
71
|
+
* @throws SchemaVerificationError if the schema version is malformed, or the signature is missing (when required) or invalid
|
|
68
72
|
*/
|
|
69
73
|
export function assertSchemaSignature(sAppConfig, options) {
|
|
70
|
-
const { id, version,
|
|
74
|
+
const { id, version, schemaVersion, signature } = sAppConfig;
|
|
71
75
|
const requireSignature = options?.requireSignature ?? true;
|
|
76
|
+
const refuse = (reason) => new SchemaVerificationError(id ?? '', version, schemaVersion, reason);
|
|
77
|
+
if (!isValidSchemaVersion(schemaVersion)) {
|
|
78
|
+
throw refuse('invalid schemaVersion');
|
|
79
|
+
}
|
|
72
80
|
if (!signature) {
|
|
73
81
|
if (requireSignature) {
|
|
74
|
-
throw
|
|
82
|
+
throw refuse('missing signature');
|
|
75
83
|
}
|
|
76
84
|
log('No signature provided for %s v%s — skipping verification (policy relaxed)', id, version);
|
|
77
85
|
return;
|
|
78
86
|
}
|
|
79
87
|
if (!id) {
|
|
80
|
-
throw
|
|
88
|
+
throw refuse('missing author public key');
|
|
81
89
|
}
|
|
82
|
-
if (!verifySchema(
|
|
83
|
-
throw
|
|
90
|
+
if (!verifySchema(sAppConfig, signature, id)) {
|
|
91
|
+
throw refuse('invalid signature');
|
|
84
92
|
}
|
|
85
93
|
}
|
|
86
94
|
//# sourceMappingURL=schema-verification.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-verification.js","sourceRoot":"","sources":["../src/schema-verification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAGzE,MAAM,GAAG,GAAG,KAAK,CAAC,4BAA4B,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"schema-verification.js","sourceRoot":"","sources":["../src/schema-verification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAGzE,MAAM,GAAG,GAAG,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAKhD;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD,YACkB,MAAc,EACd,OAAe,EAC/B,aAAqB,EACrB,MAAc;QAEd,KAAK,CAAC,uCAAuC,MAAM,KAAK,OAAO,oBAAoB,MAAM,CAAC,aAAa,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC;QALxG,WAAM,GAAN,MAAM,CAAQ;QACd,YAAO,GAAP,OAAO,CAAQ;QAK/B,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF;AAED;;;;GAIG;AACH,SAAS,YAAY,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAoB;IACxE,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC;IACnE,OAAO,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAW,CAAC;AAC5D,CAAC;AAED;;;;;;;GAOG;AACH,MAA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AE,CAAC;YACrB,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;QACpC,CAAC;QACD,GAAG,CAAC,2EAA2E,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QAC9F,OAAO;IACT,CAAC;IAED,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC;QAC7C,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;IACpC,CAAC;AACH,CAAC"}
|
package/dist/sealed-party-key.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The pending party key, sealed to the machines that remain: how `PendingStrandPartyKey.SealedKey`
|
|
3
|
-
* carries the key a party moves to after a machine removal (`docs/
|
|
3
|
+
* carries the key a party moves to after a machine removal (`docs/cadre/membership.md` → "Removing a
|
|
4
4
|
* machine"). The row is written in the same control transaction as the removed machine's
|
|
5
5
|
* tombstone, so it reaches that machine; what it carries must open only for the others.
|
|
6
6
|
*
|
package/dist/seed-bootstrap.d.ts
CHANGED
|
@@ -593,7 +593,7 @@ export declare class SeedBootstrapService {
|
|
|
593
593
|
* A connection to `peerId` for {@link deliverSeed}, from {@link dialPeerAddrs}: one already
|
|
594
594
|
* open without relay limits, or one dialed from `addrs` — each address on
|
|
595
595
|
* `dialBudget.perAddressMs`, the whole peer within `dialBudget.totalMs`, direct addresses
|
|
596
|
-
*
|
|
596
|
+
* first, then relayed, then WebRTC, and the given order within each group.
|
|
597
597
|
*
|
|
598
598
|
* @throws {PeerUnreachableError} when no connection formed, with the dial's error as `cause`.
|
|
599
599
|
*/
|
|
@@ -621,8 +621,9 @@ export declare class SeedBootstrapService {
|
|
|
621
621
|
*/
|
|
622
622
|
private readSeedAck;
|
|
623
623
|
/**
|
|
624
|
-
*
|
|
625
|
-
*
|
|
624
|
+
* This node's one relayed address for a seed, or null when it holds no reservation:
|
|
625
|
+
* {@link firstRelayedAddr} of its announced addresses, so the plain relayed address
|
|
626
|
+
* is named ahead of a WebRTC one that needs ICE after the same relay hop.
|
|
626
627
|
*/
|
|
627
628
|
getRelayAddress(): Promise<string | null>;
|
|
628
629
|
/**
|