@serfab/cadre-core 1.10.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 +0 -27
- package/dist/cadre-node.js +2 -94
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-schema.js +1066 -1066
- 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 +3 -2
- package/dist/index.js +6 -4
- package/dist/index.js.map +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.js +4 -4
- package/dist/strand-membership-writer.js +32 -32
- package/package.json +2 -2
- package/src/cadre-node.ts +8654 -8753
- package/src/control-authorization.ts +117 -117
- package/src/control-cohort.ts +128 -128
- package/src/control-formation-recorder.ts +353 -353
- package/src/control-read-retry.ts +216 -216
- package/src/control-schema.ts +1078 -1078
- package/src/control-write-retry.ts +567 -567
- 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 -647
- package/src/invitation-bootstrap.ts +40 -40
- package/src/joined-strand-store.ts +498 -498
- package/src/link-budget.ts +684 -684
- package/src/membership-connection-gater.ts +570 -570
- package/src/node-local-snapshot.ts +298 -298
- package/src/peer-dial.ts +315 -315
- package/src/peer-join-backfill.ts +710 -710
- package/src/pending-join-runner.ts +735 -735
- 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 -725
- package/src/strand-fret-addrs.ts +145 -145
- package/src/strand-instance-manager.ts +1789 -1789
- 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 -532
- package/src/strand-wake-protocol.ts +401 -401
- package/src/types.ts +2222 -2222
- 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
|
@@ -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;IAC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ACH,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';
|
|
@@ -58,6 +58,7 @@ export { StrandFormationManager, createStrandFormationManager, MEMBERSHIP_INVITE
|
|
|
58
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';
|
|
59
59
|
export { RelayReservationFailedError, UnbindableListenAddressError, RELAY_SEARCH_LISTEN_ADDR, resolveListenAddrs } from './relay-addrs.js';
|
|
60
60
|
export { strandNodeAddrs, type StrandNodeAddrs } from './strand-network-config.js';
|
|
61
|
+
export { RELAY_STUN_PORT, relayStunUrl, resolveStunServers, type StunServer } from './relay-stun.js';
|
|
61
62
|
export { resolveRelayServer, PARTY_RELAY_MAX_RESERVATIONS, PARTY_RELAY_RESERVATION_TTL_MS, type ResolvedRelayServer, type ResolvedRelayReservations } from './relay-server.js';
|
|
62
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';
|
|
63
|
-
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
|
|
@@ -186,6 +185,9 @@ export { createMembershipConnectionGater, STRANGER_OPEN_PROTOCOLS, DEFAULT_ENROL
|
|
|
186
185
|
// spelling.
|
|
187
186
|
export { RelayReservationFailedError, UnbindableListenAddressError, RELAY_SEARCH_LISTEN_ADDR, resolveListenAddrs } from './relay-addrs.js';
|
|
188
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';
|
|
189
191
|
// The circuit-relay SERVER a node runs, and with which init — one resolution shared by the
|
|
190
192
|
// control node and every strand node. Exported alongside the listen derivations above for the
|
|
191
193
|
// same reason: an embedder can assert on what its `network` block resolves to.
|
|
@@ -195,5 +197,5 @@ export { resolveRelayServer, PARTY_RELAY_MAX_RESERVATIONS, PARTY_RELAY_RESERVATI
|
|
|
195
197
|
// (see relay-reservation.ts)
|
|
196
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';
|
|
197
199
|
// Connection-path diagnostics (relayed vs direct classification + summary)
|
|
198
|
-
export { classifyTransport,
|
|
200
|
+
export { classifyTransport, summarizeConnectionPaths, emptyConnectionPathSummary, DEFAULT_SETTLE_WINDOW_MS } from './diagnostics/connection-path.js';
|
|
199
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,EAC9B,4BAA4B,EAC5B,iBAAiB,EAElB,MAAM,0BAA0B,CAAC;AAElC,gFAAgF;AAChF,yFAAyF;AACzF,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,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AAkC,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,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The UDP port a Sereus relay answers STUN on (`STUN_PORT` in `ops/docker/libp2p-infra`).
|
|
3
|
+
* Fixed rather than discovered: a relay advertises only its libp2p listeners, so a relay
|
|
4
|
+
* that publishes STUN elsewhere needs the app's explicit override.
|
|
5
|
+
*/
|
|
6
|
+
export declare const RELAY_STUN_PORT = 3478;
|
|
7
|
+
/** A STUN-only `RTCIceServer`, declared structurally so non-DOM builds can use it. */
|
|
8
|
+
export interface StunServer {
|
|
9
|
+
urls: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The `stun:` URL for the relay at `relayAddr`, or `undefined` when the address names no
|
|
13
|
+
* host. An unparsable address only logs: `CadreNode.start()` rejects the same `relayAddrs`
|
|
14
|
+
* entry with an error naming it.
|
|
15
|
+
*/
|
|
16
|
+
export declare function relayStunUrl(relayAddr: string): string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* The STUN servers for a node's WebRTC transport: the comma-separated `override` URLs when
|
|
19
|
+
* it names any, otherwise one per distinct relay host — each Sereus relay also answers
|
|
20
|
+
* STUN. Empty with no relay and no override, which leaves host/LAN candidates only and
|
|
21
|
+
* tells no third party who this node talks to. No TURN: a WebRTC upgrade that fails stays
|
|
22
|
+
* on the circuit relay.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveStunServers(relayAddrs: readonly string[], override?: string): StunServer[];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import debug from 'debug';
|
|
2
|
+
import { multiaddr } from '@multiformats/multiaddr';
|
|
3
|
+
const log = debug('sereus:cadre:relay-stun');
|
|
4
|
+
/**
|
|
5
|
+
* The UDP port a Sereus relay answers STUN on (`STUN_PORT` in `ops/docker/libp2p-infra`).
|
|
6
|
+
* Fixed rather than discovered: a relay advertises only its libp2p listeners, so a relay
|
|
7
|
+
* that publishes STUN elsewhere needs the app's explicit override.
|
|
8
|
+
*/
|
|
9
|
+
export const RELAY_STUN_PORT = 3478;
|
|
10
|
+
/**
|
|
11
|
+
* Multiaddr protocols that name a host a `stun:` URL can carry. For `dnsaddr` that is the
|
|
12
|
+
* name the TXT records sit under, which is the relay's own host when one relay publishes
|
|
13
|
+
* `_dnsaddr.<host>` for itself (`ops/docs/dnsaddr.md`). A pool published under one name
|
|
14
|
+
* (`relay-1.…`, `relay-2.…`) needs that name to resolve to one of its relays, or the
|
|
15
|
+
* embedder's override.
|
|
16
|
+
*/
|
|
17
|
+
const HOST_PROTOCOLS = new Set(['dns', 'dns4', 'dns6', 'dnsaddr', 'ip4', 'ip6']);
|
|
18
|
+
/**
|
|
19
|
+
* The `stun:` URL for the relay at `relayAddr`, or `undefined` when the address names no
|
|
20
|
+
* host. An unparsable address only logs: `CadreNode.start()` rejects the same `relayAddrs`
|
|
21
|
+
* entry with an error naming it.
|
|
22
|
+
*/
|
|
23
|
+
export function relayStunUrl(relayAddr) {
|
|
24
|
+
let first;
|
|
25
|
+
try {
|
|
26
|
+
first = multiaddr(relayAddr).getComponents()[0];
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
log('no STUN server for unparsable relay address %s: %o', relayAddr, err);
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
if (first?.value === undefined || !HOST_PROTOCOLS.has(first.name))
|
|
33
|
+
return undefined;
|
|
34
|
+
const host = first.name === 'ip6' ? `[${first.value}]` : first.value;
|
|
35
|
+
return `stun:${host}:${RELAY_STUN_PORT}`;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The STUN servers for a node's WebRTC transport: the comma-separated `override` URLs when
|
|
39
|
+
* it names any, otherwise one per distinct relay host — each Sereus relay also answers
|
|
40
|
+
* STUN. Empty with no relay and no override, which leaves host/LAN candidates only and
|
|
41
|
+
* tells no third party who this node talks to. No TURN: a WebRTC upgrade that fails stays
|
|
42
|
+
* on the circuit relay.
|
|
43
|
+
*/
|
|
44
|
+
export function resolveStunServers(relayAddrs, override) {
|
|
45
|
+
const overrideUrls = (override ?? '').split(',').map((s) => s.trim()).filter((s) => s.length > 0);
|
|
46
|
+
const urls = overrideUrls.length > 0
|
|
47
|
+
? overrideUrls
|
|
48
|
+
: relayAddrs.map(relayStunUrl).filter((url) => url !== undefined);
|
|
49
|
+
return [...new Set(urls)].map((url) => ({ urls: url }));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=relay-stun.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-stun.js","sourceRoot":"","sources":["../src/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CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAClG,MAAM,IAAI,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC;QAClC,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAiB,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC;IACnF,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAC1D,CAAC"}
|
package/dist/seed-bootstrap.js
CHANGED
|
@@ -272,10 +272,10 @@ export class SeedBootstrapService {
|
|
|
272
272
|
if (!this.controlDatabase) {
|
|
273
273
|
throw new Error('Control database not initialized');
|
|
274
274
|
}
|
|
275
|
-
await this.controlDatabase.execWrite(`
|
|
276
|
-
insert into CadreControl.DeviceToken (PeerId, Platform, Token, UpdatedAt, Sig, StampId)
|
|
277
|
-
with context OwnerKey = ?, Signature = ?
|
|
278
|
-
values (?, ?, ?, ?, ?, ?)
|
|
275
|
+
await this.controlDatabase.execWrite(`
|
|
276
|
+
insert into CadreControl.DeviceToken (PeerId, Platform, Token, UpdatedAt, Sig, StampId)
|
|
277
|
+
with context OwnerKey = ?, Signature = ?
|
|
278
|
+
values (?, ?, ?, ?, ?, ?)
|
|
279
279
|
`, [this.ownerPublicKey, signature, record.peerId, record.platform, record.token, record.updatedAt, record.sig, stampId], 'device-token-insert');
|
|
280
280
|
log('Device token inserted (owner-signed): %s', record.peerId);
|
|
281
281
|
}
|
|
@@ -219,8 +219,8 @@ async function execStrandTransaction(db, statements, options) {
|
|
|
219
219
|
*/
|
|
220
220
|
function revocationStatement(tableName, stampId, retiree) {
|
|
221
221
|
return {
|
|
222
|
-
sql: `insert into Strand.Revocation (TableName, StampId)
|
|
223
|
-
with context MemberKey = :revocationSignerKey, Signature = :revocationSignature
|
|
222
|
+
sql: `insert into Strand.Revocation (TableName, StampId)
|
|
223
|
+
with context MemberKey = :revocationSignerKey, Signature = :revocationSignature
|
|
224
224
|
values (:revocationTable, :revocationStampId);`,
|
|
225
225
|
params: {
|
|
226
226
|
revocationSignerKey: retiree.publicKeyB64,
|
|
@@ -305,8 +305,8 @@ async function insertHeaderIfAbsent(db, params) {
|
|
|
305
305
|
log('Header already present for strand %s; skipping', params.strandId);
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
|
-
await db.exec(`insert into Strand.Header
|
|
309
|
-
(Id, Type, sAppId, sAppVersion, sAppSchema, sAppSignature, Engine, EngineVersion)
|
|
308
|
+
await db.exec(`insert into Strand.Header
|
|
309
|
+
(Id, Type, sAppId, sAppVersion, sAppSchema, sAppSignature, Engine, EngineVersion)
|
|
310
310
|
values (?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
311
311
|
params.strandId,
|
|
312
312
|
params.type,
|
|
@@ -336,8 +336,8 @@ async function insertFounderMemberIfAbsent(db, memberKey, strandId) {
|
|
|
336
336
|
log('Member already present for strand %s; skipping founder Member', strandId);
|
|
337
337
|
return;
|
|
338
338
|
}
|
|
339
|
-
await db.exec(`insert into Strand.Member (Key, StampId)
|
|
340
|
-
with context ManagerKey = null, ManagerSignature = null, MemberSignature = null
|
|
339
|
+
await db.exec(`insert into Strand.Member (Key, StampId)
|
|
340
|
+
with context ManagerKey = null, ManagerSignature = null, MemberSignature = null
|
|
341
341
|
values (?, ?)`, [memberKey, generateStrandStampId()]);
|
|
342
342
|
log('Inserted founding Member for strand %s', strandId);
|
|
343
343
|
}
|
|
@@ -378,8 +378,8 @@ async function insertFounderManagerIfAbsent(db, memberKey, strandId) {
|
|
|
378
378
|
log('Strand %s has retired a manager seat (sealed); skipping founder Manager', strandId);
|
|
379
379
|
return;
|
|
380
380
|
}
|
|
381
|
-
await db.exec(`insert into Strand.Manager (MemberKey, Generation, StampId)
|
|
382
|
-
with context ManagerKey = null, Signature = null
|
|
381
|
+
await db.exec(`insert into Strand.Manager (MemberKey, Generation, StampId)
|
|
382
|
+
with context ManagerKey = null, Signature = null
|
|
383
383
|
values (?, 0, ?)`, [memberKey, generateStrandStampId()]);
|
|
384
384
|
log('Inserted founding Manager for strand %s', strandId);
|
|
385
385
|
}
|
|
@@ -489,8 +489,8 @@ export async function issueInvite(db, params) {
|
|
|
489
489
|
const payload = `${inviteKey}|${expirationSegment}`;
|
|
490
490
|
const managerSignature = signStrandPayload(payload, managerKeyPair.privateKeyB64);
|
|
491
491
|
const inviteSignature = signStrandPayload(payload, invitePrivateKey);
|
|
492
|
-
await db.exec(`insert into Strand.Invite (Key, Expiration)
|
|
493
|
-
with context ManagerKey = ?, ManagerSignature = ?, InviteSignature = ?
|
|
492
|
+
await db.exec(`insert into Strand.Invite (Key, Expiration)
|
|
493
|
+
with context ManagerKey = ?, ManagerSignature = ?, InviteSignature = ?
|
|
494
494
|
values (?, ?)`, [managerKeyPair.publicKeyB64, managerSignature, inviteSignature, inviteKey, expirationColumn]);
|
|
495
495
|
log('Issued invite %s (expires=%s)', inviteKey, expirationColumn ?? 'never');
|
|
496
496
|
return { inviteKey, invitePrivateKey };
|
|
@@ -547,8 +547,8 @@ export async function consumeInvite(db, params, options) {
|
|
|
547
547
|
// Member first — admitted by the deferred invite branch (the matching ConsumedInvite
|
|
548
548
|
// after it), so no manager signature is supplied.
|
|
549
549
|
const member = {
|
|
550
|
-
sql: `insert into Strand.Member (Key, StampId)
|
|
551
|
-
with context ManagerKey = null, ManagerSignature = null, MemberSignature = null
|
|
550
|
+
sql: `insert into Strand.Member (Key, StampId)
|
|
551
|
+
with context ManagerKey = null, ManagerSignature = null, MemberSignature = null
|
|
552
552
|
values (:memberKey, :memberStampId);`,
|
|
553
553
|
params: { memberKey, memberStampId: generateStrandStampId() },
|
|
554
554
|
};
|
|
@@ -569,8 +569,8 @@ export async function consumeInvite(db, params, options) {
|
|
|
569
569
|
async function consumedInviteStatement(db, params) {
|
|
570
570
|
const { inviteKey, invitePrivateKey, memberKey, nowMs } = params;
|
|
571
571
|
return {
|
|
572
|
-
sql: `insert into Strand.ConsumedInvite (InviteKey, MemberKey)
|
|
573
|
-
with context InviteSignature = :consumedSignature, Now = :consumedNow
|
|
572
|
+
sql: `insert into Strand.ConsumedInvite (InviteKey, MemberKey)
|
|
573
|
+
with context InviteSignature = :consumedSignature, Now = :consumedNow
|
|
574
574
|
values (:consumedInviteKey, :consumedMemberKey);`,
|
|
575
575
|
params: {
|
|
576
576
|
consumedSignature: signStrandPayload(`${inviteKey}|${memberKey}`, invitePrivateKey),
|
|
@@ -676,8 +676,8 @@ export async function cancelInvite(db, params) {
|
|
|
676
676
|
return;
|
|
677
677
|
}
|
|
678
678
|
const signature = signStrandApproval(['Strand.CancelledInvite', 'cancel', inviteKey], managerKeyPair.privateKeyB64);
|
|
679
|
-
await db.exec(`insert into Strand.CancelledInvite (InviteKey)
|
|
680
|
-
with context ManagerKey = ?, ManagerSignature = ?
|
|
679
|
+
await db.exec(`insert into Strand.CancelledInvite (InviteKey)
|
|
680
|
+
with context ManagerKey = ?, ManagerSignature = ?
|
|
681
681
|
values (?)`, [managerKeyPair.publicKeyB64, signature, inviteKey]);
|
|
682
682
|
log('Cancelled invite %s by manager %s', inviteKey, managerKeyPair.publicKeyB64);
|
|
683
683
|
}
|
|
@@ -790,8 +790,8 @@ function memberAddByManagerStatement(params) {
|
|
|
790
790
|
const { managerKeyPair, memberKey } = params;
|
|
791
791
|
const stampId = generateStrandStampId();
|
|
792
792
|
return {
|
|
793
|
-
sql: `insert into Strand.Member (Key, StampId)
|
|
794
|
-
with context ManagerKey = :memberAdmitterKey, ManagerSignature = :memberAdmitterSignature, MemberSignature = null
|
|
793
|
+
sql: `insert into Strand.Member (Key, StampId)
|
|
794
|
+
with context ManagerKey = :memberAdmitterKey, ManagerSignature = :memberAdmitterSignature, MemberSignature = null
|
|
795
795
|
values (:memberKey, :memberStampId);`,
|
|
796
796
|
params: {
|
|
797
797
|
memberAdmitterKey: managerKeyPair.publicKeyB64,
|
|
@@ -860,8 +860,8 @@ export async function revokeMember(db, params, options) {
|
|
|
860
860
|
return;
|
|
861
861
|
}
|
|
862
862
|
const removal = {
|
|
863
|
-
sql: `delete from Strand.Member
|
|
864
|
-
with context ManagerKey = :memberRemoverKey, ManagerSignature = :memberRemoverSignature, MemberSignature = null
|
|
863
|
+
sql: `delete from Strand.Member
|
|
864
|
+
with context ManagerKey = :memberRemoverKey, ManagerSignature = :memberRemoverSignature, MemberSignature = null
|
|
865
865
|
where Key = :memberKey;`,
|
|
866
866
|
params: {
|
|
867
867
|
memberRemoverKey: managerKeyPair.publicKeyB64,
|
|
@@ -906,8 +906,8 @@ export async function leaveStrand(db, params, options) {
|
|
|
906
906
|
return;
|
|
907
907
|
}
|
|
908
908
|
const departure = {
|
|
909
|
-
sql: `delete from Strand.Member
|
|
910
|
-
with context ManagerKey = null, ManagerSignature = null, MemberSignature = :memberSignature
|
|
909
|
+
sql: `delete from Strand.Member
|
|
910
|
+
with context ManagerKey = null, ManagerSignature = null, MemberSignature = :memberSignature
|
|
911
911
|
where Key = :memberKey;`,
|
|
912
912
|
params: {
|
|
913
913
|
memberSignature: signStrandApproval(['Strand.Member', 'leave', memberKey, stampId], memberKeyPair.privateKeyB64),
|
|
@@ -962,8 +962,8 @@ export async function registerMemberPeer(db, params, options) {
|
|
|
962
962
|
}
|
|
963
963
|
const stampId = generateStrandStampId();
|
|
964
964
|
await execStrandTransaction(db, {
|
|
965
|
-
sql: `insert into Strand.MemberPeer (MemberKey, PeerId, StampId)
|
|
966
|
-
with context Signature = :peerSignature, ManagerKey = null, ManagerSignature = null
|
|
965
|
+
sql: `insert into Strand.MemberPeer (MemberKey, PeerId, StampId)
|
|
966
|
+
with context Signature = :peerSignature, ManagerKey = null, ManagerSignature = null
|
|
967
967
|
values (:peerMemberKey, :peerId, :peerStampId);`,
|
|
968
968
|
params: {
|
|
969
969
|
peerSignature: signStrandApproval(['Strand.MemberPeer', 'add', memberKey, peerId, stampId], memberKeyPair.privateKeyB64),
|
|
@@ -1114,8 +1114,8 @@ function ownMemberPeerRemovalStatements(params, stampId) {
|
|
|
1114
1114
|
const { memberKeyPair, peerId } = params;
|
|
1115
1115
|
const memberKey = memberKeyPair.publicKeyB64;
|
|
1116
1116
|
const removal = {
|
|
1117
|
-
sql: `delete from Strand.MemberPeer
|
|
1118
|
-
with context Signature = :peerSignature, ManagerKey = null, ManagerSignature = null
|
|
1117
|
+
sql: `delete from Strand.MemberPeer
|
|
1118
|
+
with context Signature = :peerSignature, ManagerKey = null, ManagerSignature = null
|
|
1119
1119
|
where MemberKey = :peerMemberKey and PeerId = :peerId;`,
|
|
1120
1120
|
params: {
|
|
1121
1121
|
peerSignature: signStrandApproval(['Strand.MemberPeer', 'remove', memberKey, peerId, stampId], memberKeyPair.privateKeyB64),
|
|
@@ -1139,8 +1139,8 @@ function ownMemberPeerRemovalStatements(params, stampId) {
|
|
|
1139
1139
|
function memberPeerRemovalByManagerStatements(params, stampId) {
|
|
1140
1140
|
const { managerKeyPair, memberKey, peerId } = params;
|
|
1141
1141
|
const removal = {
|
|
1142
|
-
sql: `delete from Strand.MemberPeer
|
|
1143
|
-
with context Signature = null, ManagerKey = :peerManagerKey, ManagerSignature = :peerManagerSignature
|
|
1142
|
+
sql: `delete from Strand.MemberPeer
|
|
1143
|
+
with context Signature = null, ManagerKey = :peerManagerKey, ManagerSignature = :peerManagerSignature
|
|
1144
1144
|
where MemberKey = :peerMemberKey and PeerId = :peerId;`,
|
|
1145
1145
|
params: {
|
|
1146
1146
|
peerManagerKey: managerKeyPair.publicKeyB64,
|
|
@@ -1226,8 +1226,8 @@ async function managerAddStatement(db, params) {
|
|
|
1226
1226
|
const generation = authorizer == null ? 1 : authorizer.generation + 1;
|
|
1227
1227
|
const stampId = generateStrandStampId();
|
|
1228
1228
|
return {
|
|
1229
|
-
sql: `insert into Strand.Manager (MemberKey, Generation, StampId)
|
|
1230
|
-
with context ManagerKey = :managerAuthorizerKey, Signature = :managerSignature
|
|
1229
|
+
sql: `insert into Strand.Manager (MemberKey, Generation, StampId)
|
|
1230
|
+
with context ManagerKey = :managerAuthorizerKey, Signature = :managerSignature
|
|
1231
1231
|
values (:managerMemberKey, :managerGeneration, :managerStampId);`,
|
|
1232
1232
|
params: {
|
|
1233
1233
|
managerAuthorizerKey: byManagerKeyPair.publicKeyB64,
|
|
@@ -1371,8 +1371,8 @@ export async function removeManager(db, params, options) {
|
|
|
1371
1371
|
*/
|
|
1372
1372
|
function managerRemovalStatements(signer, signature, targetManagerKey, targetStampId) {
|
|
1373
1373
|
const removal = {
|
|
1374
|
-
sql: `delete from Strand.Manager
|
|
1375
|
-
with context ManagerKey = :managerRemoverKey, Signature = :managerRemoverSignature
|
|
1374
|
+
sql: `delete from Strand.Manager
|
|
1375
|
+
with context ManagerKey = :managerRemoverKey, Signature = :managerRemoverSignature
|
|
1376
1376
|
where MemberKey = :managerMemberKey;`,
|
|
1377
1377
|
params: {
|
|
1378
1378
|
managerRemoverKey: signer.publicKeyB64,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serfab/cadre-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core library for Sereus cadre nodes - manages control networks and strand participation",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"@optimystic/quereus-plugin-crypto": "^1.9.0",
|
|
99
99
|
"@optimystic/quereus-plugin-optimystic": "^1.9.0",
|
|
100
100
|
"@quereus/quereus": "^4.20.0",
|
|
101
|
-
"@serfab/quereus-plugin-sereus": "^1.
|
|
101
|
+
"@serfab/quereus-plugin-sereus": "^1.11.0",
|
|
102
102
|
"debug": "^4.4.3",
|
|
103
103
|
"libp2p": "^3.3.11",
|
|
104
104
|
"uint8arrays": "^6.1.1"
|