@serfab/cadre-core 0.9.0 → 0.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/README.md +255 -253
- package/dist/bootstrap-peer-store-file.d.ts +13 -0
- package/dist/bootstrap-peer-store-file.js +42 -0
- package/dist/bootstrap-peer-store-file.js.map +1 -0
- package/dist/bootstrap-peer-store.d.ts +73 -0
- package/dist/bootstrap-peer-store.js +128 -0
- package/dist/bootstrap-peer-store.js.map +1 -0
- package/dist/cadre-node.d.ts +1121 -81
- package/dist/cadre-node.js +2276 -262
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-authorization.d.ts +93 -0
- package/dist/control-authorization.js +57 -0
- package/dist/control-authorization.js.map +1 -0
- package/dist/control-cohort.d.ts +26 -0
- package/dist/control-cohort.js +26 -0
- package/dist/control-cohort.js.map +1 -1
- package/dist/control-database.d.ts +959 -54
- package/dist/control-database.js +1421 -148
- package/dist/control-database.js.map +1 -1
- package/dist/control-formation-recorder.d.ts +90 -10
- package/dist/control-formation-recorder.js +130 -14
- package/dist/control-formation-recorder.js.map +1 -1
- package/dist/control-schema.d.ts +1 -1
- package/dist/control-schema.js +651 -72
- package/dist/control-schema.js.map +1 -1
- package/dist/control-stream.d.ts +38 -4
- package/dist/control-stream.js +70 -4
- package/dist/control-stream.js.map +1 -1
- package/dist/control-write-retry.d.ts +161 -0
- package/dist/control-write-retry.js +412 -0
- package/dist/control-write-retry.js.map +1 -0
- package/dist/delegate-admission.d.ts +134 -0
- package/dist/delegate-admission.js +244 -0
- package/dist/delegate-admission.js.map +1 -0
- package/dist/device-token.d.ts +11 -11
- package/dist/device-token.js +14 -13
- package/dist/device-token.js.map +1 -1
- package/dist/ed25519-key.d.ts +26 -0
- package/dist/ed25519-key.js +56 -1
- package/dist/ed25519-key.js.map +1 -1
- package/dist/file-durable-slot.d.ts +20 -0
- package/dist/file-durable-slot.js +53 -0
- package/dist/file-durable-slot.js.map +1 -0
- package/dist/formation-approval.d.ts +157 -0
- package/dist/formation-approval.js +375 -0
- package/dist/formation-approval.js.map +1 -0
- package/dist/fs-atomic.d.ts +38 -0
- package/dist/fs-atomic.js +97 -0
- package/dist/fs-atomic.js.map +1 -0
- package/dist/identity-key.d.ts +49 -0
- package/dist/identity-key.js +81 -0
- package/dist/identity-key.js.map +1 -0
- package/dist/index.d.ts +17 -7
- package/dist/index.js +40 -6
- package/dist/index.js.map +1 -1
- package/dist/key-store-file.d.ts +2 -24
- package/dist/key-store-file.js +10 -77
- package/dist/key-store-file.js.map +1 -1
- package/dist/membership-connection-gater.d.ts +146 -0
- package/dist/membership-connection-gater.js +180 -0
- package/dist/membership-connection-gater.js.map +1 -0
- package/dist/node-local-snapshot.d.ts +109 -0
- package/dist/node-local-snapshot.js +182 -0
- package/dist/node-local-snapshot.js.map +1 -0
- package/dist/peer-addr-book.d.ts +92 -0
- package/dist/peer-addr-book.js +220 -0
- package/dist/peer-addr-book.js.map +1 -0
- package/dist/peer-authorization.d.ts +135 -18
- package/dist/peer-authorization.js +152 -21
- package/dist/peer-authorization.js.map +1 -1
- package/dist/peer-record.d.ts +21 -8
- package/dist/peer-record.js +26 -10
- package/dist/peer-record.js.map +1 -1
- package/dist/relay-addrs.d.ts +45 -0
- package/dist/relay-addrs.js +103 -0
- package/dist/relay-addrs.js.map +1 -0
- package/dist/relay-reservation.d.ts +266 -0
- package/dist/relay-reservation.js +613 -0
- package/dist/relay-reservation.js.map +1 -0
- package/dist/seed-bootstrap.d.ts +228 -56
- package/dist/seed-bootstrap.js +340 -198
- package/dist/seed-bootstrap.js.map +1 -1
- package/dist/seed-trust-policy.d.ts +47 -21
- package/dist/seed-trust-policy.js +24 -15
- package/dist/seed-trust-policy.js.map +1 -1
- package/dist/strand-addr-protocol.d.ts +42 -13
- package/dist/strand-addr-protocol.js +58 -52
- package/dist/strand-addr-protocol.js.map +1 -1
- package/dist/strand-backfill.d.ts +109 -0
- package/dist/strand-backfill.js +279 -0
- package/dist/strand-backfill.js.map +1 -0
- package/dist/strand-cohort.d.ts +4 -37
- package/dist/strand-cohort.js +4 -15
- package/dist/strand-cohort.js.map +1 -1
- package/dist/strand-database.d.ts +11 -16
- package/dist/strand-database.js +19 -7
- package/dist/strand-database.js.map +1 -1
- package/dist/strand-formation-manager.d.ts +36 -7
- package/dist/strand-formation-manager.js +115 -15
- package/dist/strand-formation-manager.js.map +1 -1
- package/dist/strand-formation-protocol.d.ts +103 -4
- package/dist/strand-formation-protocol.js +232 -4
- package/dist/strand-formation-protocol.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +88 -19
- package/dist/strand-instance-manager.js +178 -34
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-member-registry.d.ts +5 -5
- package/dist/strand-member-registry.js +18 -10
- package/dist/strand-member-registry.js.map +1 -1
- package/dist/strand-membership-writer.d.ts +484 -88
- package/dist/strand-membership-writer.js +751 -128
- package/dist/strand-membership-writer.js.map +1 -1
- package/dist/strand-solicitation.d.ts +99 -33
- package/dist/strand-solicitation.js +100 -52
- package/dist/strand-solicitation.js.map +1 -1
- package/dist/strand-transport-key.d.ts +40 -0
- package/dist/strand-transport-key.js +56 -0
- package/dist/strand-transport-key.js.map +1 -0
- package/dist/strand-wake-protocol.d.ts +9 -7
- package/dist/strand-wake-protocol.js +22 -46
- package/dist/strand-wake-protocol.js.map +1 -1
- package/dist/strand-watcher.d.ts +17 -2
- package/dist/strand-watcher.js +47 -3
- package/dist/strand-watcher.js.map +1 -1
- package/dist/trusted-owner-store-file.d.ts +12 -0
- package/dist/trusted-owner-store-file.js +39 -0
- package/dist/trusted-owner-store-file.js.map +1 -0
- package/dist/trusted-owner-store.d.ts +64 -0
- package/dist/trusted-owner-store.js +126 -0
- package/dist/trusted-owner-store.js.map +1 -0
- package/dist/types.d.ts +307 -44
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -1
- package/package.json +20 -8
- package/src/arachnode-stub.ts +159 -159
- package/src/bootstrap-peer-store-file.ts +44 -0
- package/src/bootstrap-peer-store.ts +172 -0
- package/src/cadre-node.ts +5158 -2981
- package/src/canonical-json.ts +30 -30
- package/src/control-authorization.ts +114 -0
- package/src/control-cohort.ts +130 -103
- package/src/control-database.ts +2406 -948
- package/src/control-formation-recorder.ts +305 -151
- package/src/control-schema.ts +651 -72
- package/src/control-stream.ts +205 -128
- package/src/control-write-retry.ts +483 -0
- package/src/delegate-admission.ts +302 -0
- package/src/device-token.ts +94 -89
- package/src/diagnostics/connection-path.ts +277 -277
- package/src/diagnostics/webrtc-turn-tracker.ts +222 -222
- package/src/ed25519-key.ts +66 -1
- package/src/enrollment.ts +199 -199
- package/src/file-durable-slot.ts +61 -0
- package/src/formation-approval.ts +604 -0
- package/src/fs-atomic.ts +107 -0
- package/src/hibernation-manager.ts +437 -437
- package/src/identity-key.ts +109 -0
- package/src/index.ts +137 -5
- package/src/key-store-file.ts +132 -203
- package/src/key-store.ts +99 -99
- package/src/membership-connection-gater.ts +204 -0
- package/src/node-local-snapshot.ts +260 -0
- package/src/peer-addr-book.ts +250 -0
- package/src/peer-authorization.ts +259 -81
- package/src/peer-record.ts +164 -146
- package/src/push-credentials.ts +84 -84
- package/src/push-node.ts +64 -64
- package/src/push-notifier-apns.ts +247 -247
- package/src/push-notifier-fcm.ts +220 -220
- package/src/push-notifier-shared.ts +28 -28
- package/src/push-notifier.ts +52 -52
- package/src/relay-addrs.ts +111 -0
- package/src/relay-reservation.ts +823 -0
- package/src/seed-bootstrap.ts +409 -209
- package/src/seed-trust-policy.ts +140 -107
- package/src/strand-addr-protocol.ts +441 -410
- package/src/strand-backfill.ts +366 -0
- package/src/strand-cohort.ts +38 -77
- package/src/strand-database.ts +202 -204
- package/src/strand-formation-manager.ts +491 -368
- package/src/strand-formation-protocol.ts +692 -391
- package/src/strand-instance-manager.ts +201 -46
- package/src/strand-member-key.ts +39 -39
- package/src/strand-member-registry.ts +182 -177
- package/src/strand-membership-writer.ts +938 -146
- package/src/strand-solicitation.ts +472 -407
- package/src/strand-transport-key.ts +58 -0
- package/src/strand-wake-payload.ts +32 -32
- package/src/strand-wake-protocol.ts +314 -331
- package/src/strand-watcher.ts +314 -251
- package/src/trusted-owner-store-file.ts +41 -0
- package/src/trusted-owner-store.ts +171 -0
- package/src/types.ts +1309 -1032
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
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
|
+
* identity.
|
|
11
|
+
*
|
|
12
|
+
* Dependency-free beyond `@libp2p/crypto` + `uint8arrays` (both already core
|
|
13
|
+
* dependencies), so this module is safe in every (RN / browser / Node) entry graph.
|
|
14
|
+
*/
|
|
15
|
+
import debug from 'debug';
|
|
16
|
+
import { generateKeyPair, privateKeyToProtobuf, privateKeyFromProtobuf, publicKeyToProtobuf } from '@libp2p/crypto/keys';
|
|
17
|
+
import { toString as uint8ArrayToString } from 'uint8arrays';
|
|
18
|
+
import type { PrivateKey } from '@libp2p/interface';
|
|
19
|
+
import { DEFAULT_IDENTITY_KEY_ID, type KeyId, type KeyStore } from './key-store.js';
|
|
20
|
+
|
|
21
|
+
const log = debug('sereus:cadre:identity-key');
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Load the node identity key from `keyStore`, generating and persisting a fresh
|
|
25
|
+
* Ed25519 key when the slot is empty.
|
|
26
|
+
*
|
|
27
|
+
* A rejected `get` (e.g. {@link KeyStoreAccessError} from a cancelled biometric
|
|
28
|
+
* prompt) **propagates** — we never fall through to generation on a read error,
|
|
29
|
+
* because that would silently orphan an existing but momentarily unreadable
|
|
30
|
+
* identity. Corrupt bytes in the slot likewise throw rather than regenerate.
|
|
31
|
+
*
|
|
32
|
+
* Idempotent in effect: a second call on a populated store loads the stored key
|
|
33
|
+
* and writes nothing.
|
|
34
|
+
*
|
|
35
|
+
* @param keyStore - Backend the identity is read from / persisted to.
|
|
36
|
+
* @param keyId - Slot id; defaults to {@link DEFAULT_IDENTITY_KEY_ID}.
|
|
37
|
+
* @returns The resolved libp2p private key.
|
|
38
|
+
*/
|
|
39
|
+
export async function loadOrCreateIdentityKey(
|
|
40
|
+
keyStore: KeyStore,
|
|
41
|
+
keyId: KeyId = DEFAULT_IDENTITY_KEY_ID
|
|
42
|
+
): Promise<PrivateKey> {
|
|
43
|
+
// A rejection here (e.g. KeyStoreAccessError) must propagate — do NOT fall
|
|
44
|
+
// through to generation, which would orphan an existing but unreadable key.
|
|
45
|
+
const bytes = await keyStore.get(keyId);
|
|
46
|
+
if (bytes) {
|
|
47
|
+
// Corrupt/garbage bytes throw here; surface loudly rather than
|
|
48
|
+
// regenerating (which would orphan the real identity).
|
|
49
|
+
const loaded = privateKeyFromProtobuf(bytes);
|
|
50
|
+
log('Identity key loaded from key store (slot present)');
|
|
51
|
+
return loaded;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const generated = await generateKeyPair('Ed25519');
|
|
55
|
+
await keyStore.set(keyId, privateKeyToProtobuf(generated));
|
|
56
|
+
log('Identity key generated and persisted to key store (first run)');
|
|
57
|
+
return generated;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Proof-of-possession signer for a node key, for out-of-band HTTP services that
|
|
62
|
+
* want to attribute a request to a peer id.
|
|
63
|
+
*
|
|
64
|
+
* Deliberately generic — it carries no ICE/TURN vocabulary, and the message it
|
|
65
|
+
* signs is the caller's business. The one consumer today is the reference apps'
|
|
66
|
+
* `loadIceConfig`, which signs the TURN credential issuer's peer assertion; those
|
|
67
|
+
* files mirror this interface structurally rather than importing it, so they stay
|
|
68
|
+
* dependency-free.
|
|
69
|
+
*/
|
|
70
|
+
export interface PeerKeySigner {
|
|
71
|
+
/** base58btc peer id — the same string libp2p reports for this node. */
|
|
72
|
+
readonly peerId: string;
|
|
73
|
+
/** base64url of the libp2p protobuf-encoded public key. */
|
|
74
|
+
readonly publicKeyB64: string;
|
|
75
|
+
/** Sign the UTF-8 bytes of `message`; resolves to a base64url signature. */
|
|
76
|
+
sign(message: string): Promise<string>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Wrap a libp2p private key as a {@link PeerKeySigner}.
|
|
81
|
+
*
|
|
82
|
+
* Ed25519 only: the peer id is derived as an identity multihash (so
|
|
83
|
+
* `publicKey.toString()` already *is* the base58btc peer id — no `@libp2p/peer-id`
|
|
84
|
+
* round trip needed), and verifiers of this proof accept nothing else.
|
|
85
|
+
*
|
|
86
|
+
* @param privateKey - The node's libp2p Ed25519 private key.
|
|
87
|
+
* @returns A signer exposing the peer id, the encoded public key, and `sign`.
|
|
88
|
+
* @throws If the key is not Ed25519.
|
|
89
|
+
*/
|
|
90
|
+
export function peerKeySigner(privateKey: PrivateKey): PeerKeySigner {
|
|
91
|
+
if (privateKey.type !== 'Ed25519') {
|
|
92
|
+
throw new Error(`peerKeySigner requires an Ed25519 key, got ${privateKey.type}`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const publicKey = privateKey.publicKey;
|
|
96
|
+
// For Ed25519 the public key's digest is an identity multihash, so its string
|
|
97
|
+
// form is the peer id itself — the same value `peerIdFromPrivateKey` produces.
|
|
98
|
+
const peerId = publicKey.toString();
|
|
99
|
+
const publicKeyB64 = uint8ArrayToString(publicKeyToProtobuf(publicKey), 'base64url');
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
peerId,
|
|
103
|
+
publicKeyB64,
|
|
104
|
+
async sign(message: string): Promise<string> {
|
|
105
|
+
const signature = await privateKey.sign(new TextEncoder().encode(message));
|
|
106
|
+
return uint8ArrayToString(signature, 'base64url');
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -8,10 +8,27 @@ export { canonicalJson } from './canonical-json.js';
|
|
|
8
8
|
export { CadreNode } from './cadre-node.js';
|
|
9
9
|
|
|
10
10
|
// Control database
|
|
11
|
-
export { ControlDatabase, buildAuthorizationMessage, type ControlDatabaseConfig, type ControlTable } from './control-database.js';
|
|
11
|
+
export { ControlDatabase, MissingHostStrandError, buildAuthorizationMessage, formationVouchMessage, formationConsentMessage, REAPABLE_TABLES, type ReapableTable, type ControlDatabaseConfig, type ControlTable, type RevocableTable, type FormationUsageResult, type MembershipChangeListener, type GuardedDeleteListener, type RevokedRowRef } from './control-database.js';
|
|
12
|
+
|
|
13
|
+
// Bounded retry for transient control-write failures (classifier + loop behind
|
|
14
|
+
// ControlDatabase.lockedWithRetry; exported so the integration package can drive the
|
|
15
|
+
// classifier against real engine errors)
|
|
16
|
+
export {
|
|
17
|
+
CONTROL_WRITE_ATTEMPTS,
|
|
18
|
+
CONTROL_WRITE_RETRY_BUDGET_MS,
|
|
19
|
+
SCHEMA_INIT_ATTEMPTS,
|
|
20
|
+
SCHEMA_INIT_RETRY_POLICY,
|
|
21
|
+
isRetriableControlWriteFailure,
|
|
22
|
+
isRetriableSchemaInitFailure,
|
|
23
|
+
retryControlWrite,
|
|
24
|
+
type ControlWriteRetryOptions
|
|
25
|
+
} from './control-write-retry.js';
|
|
26
|
+
|
|
27
|
+
// Control-plane authorization field vector (the domain/action tagging every signer shares)
|
|
28
|
+
export { controlAuthorizationFields, type ControlDomain, type ControlAction } from './control-authorization.js';
|
|
12
29
|
|
|
13
30
|
// Ed25519 key bridge (libp2p Ed25519 -> base64url keypair)
|
|
14
|
-
export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, type Ed25519KeyPair } from './ed25519-key.js';
|
|
31
|
+
export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, requireEd25519PublicKeyB64, type Ed25519KeyPair } from './ed25519-key.js';
|
|
15
32
|
|
|
16
33
|
// Pluggable key store (backend-agnostic identity/owner key material seam).
|
|
17
34
|
// Dependency-free: the interface, error, default slot id, and in-memory backend
|
|
@@ -26,6 +43,46 @@ export {
|
|
|
26
43
|
type KeyId
|
|
27
44
|
} from './key-store.js';
|
|
28
45
|
|
|
46
|
+
// The KeyStore-backed identity rule, shared with embedding apps that need the
|
|
47
|
+
// node key BEFORE `CadreNode` exists (RN resolves it to sign its ICE-manifest
|
|
48
|
+
// request), plus the generic "prove you hold this node key" signer built on it.
|
|
49
|
+
export {
|
|
50
|
+
loadOrCreateIdentityKey,
|
|
51
|
+
peerKeySigner,
|
|
52
|
+
type PeerKeySigner
|
|
53
|
+
} from './identity-key.js';
|
|
54
|
+
|
|
55
|
+
// Node-local trusted-owner anchor: the NON-replicated, per-party record of
|
|
56
|
+
// out-of-band-established owner keys (the trust anchor the replicated OwnerKey
|
|
57
|
+
// table cannot be). Cross-platform: interface + in-memory store only — the
|
|
58
|
+
// file-backed store is the Node-only subpath
|
|
59
|
+
// '@serfab/cadre-core/trusted-owner-store-file' (same isolation as
|
|
60
|
+
// key-store-file) so node:fs never lands in this graph.
|
|
61
|
+
export {
|
|
62
|
+
MemoryTrustedOwnerStore,
|
|
63
|
+
PersistentTrustedOwnerStore,
|
|
64
|
+
type TrustedOwnerStore,
|
|
65
|
+
type TrustSource
|
|
66
|
+
} from './trusted-owner-store.js';
|
|
67
|
+
|
|
68
|
+
// The one platform-specific piece of a persistent node-local store: a single
|
|
69
|
+
// durable text slot the embedding app supplies (IndexedDB / SecureStore /
|
|
70
|
+
// SQLite / a file). Everything else — envelope, load policy, snapshot write
|
|
71
|
+
// chain — is cross-platform in node-local-snapshot.ts.
|
|
72
|
+
export type { DurableSlot } from './node-local-snapshot.js';
|
|
73
|
+
|
|
74
|
+
// Node-local cold-start bootstrap-peer store: the dial targets retained from an
|
|
75
|
+
// applied seed so a node that could not connect on its first try keeps retrying
|
|
76
|
+
// across restarts. Same cross-platform split as the trusted-owner anchor above —
|
|
77
|
+
// interface + in-memory store here, Node-only file backend behind the subpath
|
|
78
|
+
// '@serfab/cadre-core/bootstrap-peer-store-file'.
|
|
79
|
+
export {
|
|
80
|
+
MemoryBootstrapPeerStore,
|
|
81
|
+
PersistentBootstrapPeerStore,
|
|
82
|
+
type BootstrapPeerStore,
|
|
83
|
+
type BootstrapPeerEntry
|
|
84
|
+
} from './bootstrap-peer-store.js';
|
|
85
|
+
|
|
29
86
|
// Strand database
|
|
30
87
|
export { StrandDatabase, type StrandDatabaseConfig } from './strand-database.js';
|
|
31
88
|
|
|
@@ -44,6 +101,18 @@ export {
|
|
|
44
101
|
getStrandStoragePath
|
|
45
102
|
} from './strand-instance-manager.js';
|
|
46
103
|
|
|
104
|
+
// Strand peer-join block catch-up (push this strand's own blocks to each newly
|
|
105
|
+
// connected strand peer, so a late joiner physically holds pre-join blocks).
|
|
106
|
+
export {
|
|
107
|
+
StrandBackfill,
|
|
108
|
+
DEFAULT_STRAND_BACKFILL,
|
|
109
|
+
MAX_BLOCK_MESSAGE_BYTES,
|
|
110
|
+
type StrandBackfillConfig,
|
|
111
|
+
type StrandBackfillDeps,
|
|
112
|
+
type StrandBackfillResult,
|
|
113
|
+
type StrandBackfillPushClient
|
|
114
|
+
} from './strand-backfill.js';
|
|
115
|
+
|
|
47
116
|
// Hibernation
|
|
48
117
|
export {
|
|
49
118
|
HibernationManager,
|
|
@@ -72,11 +141,24 @@ export {
|
|
|
72
141
|
type FormationUsageRecorder,
|
|
73
142
|
type ResolvedHostStrand,
|
|
74
143
|
type StrandProvisioner,
|
|
75
|
-
type FormationSigner,
|
|
76
144
|
type FormationResponseValidator,
|
|
77
145
|
type StrandSolicitationServiceOptions
|
|
78
146
|
} from './strand-solicitation.js';
|
|
79
147
|
|
|
148
|
+
// Formation approval client: asks an invite's ValidationUrl hook whether ONE redemption
|
|
149
|
+
// may proceed, and checks the answer against the bytes the control database will verify.
|
|
150
|
+
export {
|
|
151
|
+
createHttpFormationApprover,
|
|
152
|
+
signFormationApproval,
|
|
153
|
+
verifyFormationApproval,
|
|
154
|
+
FormationApprovalError,
|
|
155
|
+
type FormationApprovalRequest,
|
|
156
|
+
type FormationVouchFields,
|
|
157
|
+
type FormationApproval,
|
|
158
|
+
type FormationApprover,
|
|
159
|
+
type FormationApprovalFailure
|
|
160
|
+
} from './formation-approval.js';
|
|
161
|
+
|
|
80
162
|
// DB-backed FormationUsageRecorder (reads/writes the real CadreControl tables)
|
|
81
163
|
export { ControlFormationUsageRecorder } from './control-formation-recorder.js';
|
|
82
164
|
|
|
@@ -90,12 +172,21 @@ export { generateStrandMemberKey, strandMemberKeyPair } from './strand-member-ke
|
|
|
90
172
|
export {
|
|
91
173
|
signStrandPayload,
|
|
92
174
|
verifyStrandPayload,
|
|
175
|
+
signStrandApproval,
|
|
176
|
+
generateStrandStampId,
|
|
93
177
|
bootstrapFounderMembership,
|
|
94
178
|
issueInvite,
|
|
95
179
|
consumeInvite,
|
|
180
|
+
cancelInvite,
|
|
181
|
+
listOutstandingInvites,
|
|
96
182
|
addMemberByManager,
|
|
183
|
+
revokeMember,
|
|
184
|
+
leaveStrand,
|
|
97
185
|
registerMemberPeer,
|
|
186
|
+
listMemberPeers,
|
|
187
|
+
removeMemberPeer,
|
|
98
188
|
addManager,
|
|
189
|
+
admitManager,
|
|
99
190
|
removeManager,
|
|
100
191
|
STRAND_ENGINE,
|
|
101
192
|
STRAND_ENGINE_VERSION,
|
|
@@ -103,9 +194,17 @@ export {
|
|
|
103
194
|
type IssueInviteParams,
|
|
104
195
|
type IssuedInvite,
|
|
105
196
|
type ConsumeInviteParams,
|
|
197
|
+
type CancelInviteParams,
|
|
198
|
+
type OutstandingInvite,
|
|
106
199
|
type AddMemberByManagerParams,
|
|
200
|
+
type RevokeMemberParams,
|
|
201
|
+
type LeaveStrandParams,
|
|
107
202
|
type RegisterMemberPeerParams,
|
|
203
|
+
type RemoveOwnPeerParams,
|
|
204
|
+
type RemoveMemberPeerByManagerParams,
|
|
205
|
+
type RemoveMemberPeerParams,
|
|
108
206
|
type AddManagerParams,
|
|
207
|
+
type AdmitManagerParams,
|
|
109
208
|
type RemoveManagerParams
|
|
110
209
|
} from './strand-membership-writer.js';
|
|
111
210
|
|
|
@@ -136,7 +235,13 @@ export {
|
|
|
136
235
|
peerAuthorizationDigest,
|
|
137
236
|
cadrePeerVoucherDigest,
|
|
138
237
|
cadrePeerRemoveDigest,
|
|
139
|
-
|
|
238
|
+
deviceTokenAddDigest,
|
|
239
|
+
deviceTokenRemoveDigest,
|
|
240
|
+
formationConsentDigest,
|
|
241
|
+
verifyPeerAuthorization,
|
|
242
|
+
verifyCadrePeerVoucher,
|
|
243
|
+
verifyFormationConsent,
|
|
244
|
+
type DeviceTokenAuthorizedRow
|
|
140
245
|
} from './peer-authorization.js';
|
|
141
246
|
|
|
142
247
|
// Strand Wake (control-network push-wake protocol)
|
|
@@ -212,6 +317,7 @@ export {
|
|
|
212
317
|
// the cadence/degree defaults the proactive reconcile routine reads.
|
|
213
318
|
export {
|
|
214
319
|
selectControlCohortDials,
|
|
320
|
+
DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS,
|
|
215
321
|
DEFAULT_CONTROL_COHORT_RECONCILE_MS,
|
|
216
322
|
DEFAULT_CONTROL_COHORT_TARGET_DEGREE,
|
|
217
323
|
type ControlCohortSelection
|
|
@@ -219,7 +325,7 @@ export {
|
|
|
219
325
|
|
|
220
326
|
// Seed trust policy (trust anchor for incoming seeds)
|
|
221
327
|
export {
|
|
222
|
-
|
|
328
|
+
anchoredTrustPolicy,
|
|
223
329
|
pinnedKeyTrustPolicy,
|
|
224
330
|
tofuTrustPolicy,
|
|
225
331
|
type SeedTrustPolicy,
|
|
@@ -260,6 +366,32 @@ export {
|
|
|
260
366
|
type StrandFormationManagerOptions
|
|
261
367
|
} from './strand-formation-manager.js';
|
|
262
368
|
|
|
369
|
+
// Control-network inbound connection gate (membership defense-in-depth)
|
|
370
|
+
export {
|
|
371
|
+
createMembershipConnectionGater,
|
|
372
|
+
STRANGER_OPEN_PROTOCOLS,
|
|
373
|
+
DEFAULT_ENROLLMENT_WINDOW_MS,
|
|
374
|
+
ADMISSION_DECISION_TIMEOUT_MS,
|
|
375
|
+
type InboundAdmissionPolicy
|
|
376
|
+
} from './membership-connection-gater.js';
|
|
377
|
+
|
|
378
|
+
// Relay reservation via the bare `/p2p-circuit` search listener (fail-soft;
|
|
379
|
+
// the fail-fast alternative is `network.relayAddrs`, see relay-reservation.ts)
|
|
380
|
+
export {
|
|
381
|
+
circuitMultiaddrs,
|
|
382
|
+
superviseRelayReservation,
|
|
383
|
+
DEFAULT_RELAY_RESERVE_TIMEOUT_MS,
|
|
384
|
+
DEFAULT_RELAY_RESERVE_POLL_MS,
|
|
385
|
+
DEFAULT_RELAY_CHECK_MS,
|
|
386
|
+
DEFAULT_RELAY_MIN_BACKOFF_MS,
|
|
387
|
+
DEFAULT_RELAY_MAX_BACKOFF_MS,
|
|
388
|
+
type RelayReservationStatus,
|
|
389
|
+
type RelayReservationState,
|
|
390
|
+
type RelayReserveOptions,
|
|
391
|
+
type RelayReservationSupervisor,
|
|
392
|
+
type RelayReservationSupervisorOptions
|
|
393
|
+
} from './relay-reservation.js';
|
|
394
|
+
|
|
263
395
|
// Connection-path diagnostics (relayed vs direct classification + summary)
|
|
264
396
|
export {
|
|
265
397
|
classifyTransport,
|