@serfab/cadre-core 1.13.0 → 1.15.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 +293 -274
- package/dist/cadre-invite-protocol.d.ts +383 -0
- package/dist/cadre-invite-protocol.js +774 -0
- package/dist/cadre-invite-protocol.js.map +1 -0
- package/dist/cadre-join-request.d.ts +42 -0
- package/dist/cadre-join-request.js +144 -0
- package/dist/cadre-join-request.js.map +1 -0
- package/dist/cadre-node.d.ts +849 -210
- package/dist/cadre-node.js +1574 -374
- package/dist/cadre-node.js.map +1 -1
- package/dist/claim-proof.d.ts +45 -0
- package/dist/claim-proof.js +132 -0
- package/dist/claim-proof.js.map +1 -0
- package/dist/control-authorization.d.ts +80 -19
- package/dist/control-authorization.js +55 -13
- package/dist/control-authorization.js.map +1 -1
- package/dist/control-cohort.js +1 -1
- package/dist/control-cohort.js.map +1 -1
- package/dist/control-database.d.ts +605 -108
- package/dist/control-database.js +1299 -280
- package/dist/control-database.js.map +1 -1
- package/dist/control-protocol-guard.d.ts +142 -0
- package/dist/control-protocol-guard.js +293 -0
- package/dist/control-protocol-guard.js.map +1 -0
- package/dist/control-schema.d.ts +1 -1
- package/dist/control-schema.js +817 -1067
- package/dist/control-schema.js.map +1 -1
- package/dist/control-stream.d.ts +4 -0
- package/dist/control-stream.js +22 -7
- package/dist/control-stream.js.map +1 -1
- package/dist/delegate-admission.d.ts +1 -1
- package/dist/delegate-admission.js +1 -1
- package/dist/device-token.d.ts +11 -9
- package/dist/device-token.js +14 -12
- package/dist/device-token.js.map +1 -1
- package/dist/ed25519-key.d.ts +22 -9
- package/dist/ed25519-key.js +47 -10
- package/dist/ed25519-key.js.map +1 -1
- package/dist/fetch-impl.d.ts +12 -0
- package/dist/fetch-impl.js +23 -0
- package/dist/fetch-impl.js.map +1 -0
- package/dist/file-durable-slot.js +2 -1
- package/dist/file-durable-slot.js.map +1 -1
- package/dist/file-safe-name.d.ts +25 -0
- package/dist/file-safe-name.js +29 -0
- package/dist/file-safe-name.js.map +1 -0
- package/dist/formation-approval.js +5 -11
- package/dist/formation-approval.js.map +1 -1
- package/dist/fs-atomic.d.ts +0 -19
- package/dist/fs-atomic.js +3 -24
- package/dist/fs-atomic.js.map +1 -1
- package/dist/index.d.ts +22 -10
- package/dist/index.js +54 -11
- package/dist/index.js.map +1 -1
- package/dist/invitation-bootstrap.d.ts +50 -12
- package/dist/invitation-bootstrap.js +76 -13
- package/dist/invitation-bootstrap.js.map +1 -1
- package/dist/joined-strand-store.d.ts +7 -0
- package/dist/joined-strand-store.js +9 -0
- package/dist/joined-strand-store.js.map +1 -1
- package/dist/key-store-file.js +2 -1
- package/dist/key-store-file.js.map +1 -1
- package/dist/link-budget.d.ts +25 -33
- package/dist/link-budget.js +25 -35
- package/dist/link-budget.js.map +1 -1
- package/dist/machine-removal.d.ts +78 -0
- package/dist/machine-removal.js +166 -0
- package/dist/machine-removal.js.map +1 -0
- package/dist/membership-connection-gater.d.ts +191 -151
- package/dist/membership-connection-gater.js +236 -173
- package/dist/membership-connection-gater.js.map +1 -1
- package/dist/node-claim-payload.d.ts +74 -0
- package/dist/node-claim-payload.js +224 -0
- package/dist/node-claim-payload.js.map +1 -0
- package/dist/node-default-transports.d.ts +27 -0
- package/dist/node-default-transports.js +35 -0
- package/dist/node-default-transports.js.map +1 -0
- package/dist/node-transports.d.ts +30 -0
- package/dist/node-transports.js +40 -0
- package/dist/node-transports.js.map +1 -0
- package/dist/owner-anchor-sync.d.ts +22 -0
- package/dist/owner-anchor-sync.js +143 -0
- package/dist/owner-anchor-sync.js.map +1 -0
- package/dist/peer-authorization.d.ts +113 -18
- package/dist/peer-authorization.js +225 -29
- package/dist/peer-authorization.js.map +1 -1
- package/dist/peer-dial.d.ts +143 -27
- package/dist/peer-dial.js +276 -31
- package/dist/peer-dial.js.map +1 -1
- package/dist/peer-join-backfill.d.ts +26 -2
- package/dist/peer-join-backfill.js +60 -12
- package/dist/peer-join-backfill.js.map +1 -1
- package/dist/peer-record.d.ts +17 -52
- package/dist/peer-record.js +20 -58
- package/dist/peer-record.js.map +1 -1
- package/dist/pending-join-runner.d.ts +66 -58
- package/dist/pending-join-runner.js +136 -145
- package/dist/pending-join-runner.js.map +1 -1
- package/dist/primary-lan-address.d.ts +8 -0
- package/dist/primary-lan-address.js +46 -0
- package/dist/primary-lan-address.js.map +1 -0
- package/dist/provider/client.d.ts +131 -0
- package/dist/provider/client.js +226 -0
- package/dist/provider/client.js.map +1 -0
- package/dist/provider/descriptor.d.ts +41 -0
- package/dist/provider/descriptor.js +103 -0
- package/dist/provider/descriptor.js.map +1 -0
- package/dist/provider/index.d.ts +9 -0
- package/dist/provider/index.js +10 -0
- package/dist/provider/index.js.map +1 -0
- package/dist/provider/oauth.d.ts +125 -0
- package/dist/provider/oauth.js +199 -0
- package/dist/provider/oauth.js.map +1 -0
- package/dist/provider/rent-node.d.ts +101 -0
- package/dist/provider/rent-node.js +220 -0
- package/dist/provider/rent-node.js.map +1 -0
- package/dist/push-fanout.d.ts +8 -2
- package/dist/push-fanout.js +8 -2
- package/dist/push-fanout.js.map +1 -1
- package/dist/relay-addrs.d.ts +9 -4
- package/dist/relay-addrs.js +9 -4
- package/dist/relay-addrs.js.map +1 -1
- package/dist/relay-reservation.d.ts +51 -16
- package/dist/relay-reservation.js +107 -24
- package/dist/relay-reservation.js.map +1 -1
- package/dist/seed-bootstrap.d.ts +165 -123
- package/dist/seed-bootstrap.js +313 -275
- package/dist/seed-bootstrap.js.map +1 -1
- package/dist/seed-trust-policy.d.ts +98 -37
- package/dist/seed-trust-policy.js +188 -2
- package/dist/seed-trust-policy.js.map +1 -1
- package/dist/strand-addr-protocol.d.ts +24 -26
- package/dist/strand-addr-protocol.js +19 -26
- package/dist/strand-addr-protocol.js.map +1 -1
- package/dist/strand-commit-durability.d.ts +54 -0
- package/dist/strand-commit-durability.js +74 -0
- package/dist/strand-commit-durability.js.map +1 -0
- package/dist/strand-database.d.ts +23 -8
- package/dist/strand-database.js +41 -13
- package/dist/strand-database.js.map +1 -1
- package/dist/strand-first-sync-gate.d.ts +7 -1
- package/dist/strand-first-sync-gate.js +7 -1
- package/dist/strand-first-sync-gate.js.map +1 -1
- package/dist/strand-formation-protocol.js +5 -2
- package/dist/strand-formation-protocol.js.map +1 -1
- package/dist/strand-fret-addrs.d.ts +19 -1
- package/dist/strand-fret-addrs.js +27 -9
- package/dist/strand-fret-addrs.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +81 -19
- package/dist/strand-instance-manager.js +216 -105
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-move.d.ts +124 -0
- package/dist/strand-move.js +438 -0
- package/dist/strand-move.js.map +1 -0
- package/dist/strand-network-config.js +7 -6
- package/dist/strand-network-config.js.map +1 -1
- package/dist/strand-peer-redial.d.ts +113 -0
- package/dist/strand-peer-redial.js +236 -0
- package/dist/strand-peer-redial.js.map +1 -0
- package/dist/strand-revocation-enforcer.d.ts +11 -11
- package/dist/strand-revocation-enforcer.js +11 -11
- package/dist/strand-wake-protocol.d.ts +13 -16
- package/dist/strand-wake-protocol.js +23 -27
- package/dist/strand-wake-protocol.js.map +1 -1
- package/dist/trusted-owner-store.d.ts +35 -5
- package/dist/trusted-owner-store.js +50 -8
- package/dist/trusted-owner-store.js.map +1 -1
- package/dist/types.d.ts +512 -89
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -1
- package/package.json +19 -10
- package/src/cadre-invite-protocol.ts +1052 -0
- package/src/cadre-join-request.ts +167 -0
- package/src/cadre-node.ts +1703 -386
- package/src/claim-proof.ts +147 -0
- package/src/control-authorization.ts +203 -117
- package/src/control-cohort.ts +1 -1
- package/src/control-database.ts +4663 -3453
- package/src/control-protocol-guard.ts +348 -0
- package/src/control-schema.ts +828 -1078
- package/src/control-stream.ts +26 -7
- package/src/delegate-admission.ts +1 -1
- package/src/device-token.ts +14 -10
- package/src/ed25519-key.ts +47 -10
- package/src/fetch-impl.ts +23 -0
- package/src/file-durable-slot.ts +64 -63
- package/src/file-safe-name.ts +32 -0
- package/src/formation-approval.ts +604 -610
- package/src/fs-atomic.ts +92 -117
- package/src/index.ts +789 -648
- package/src/invitation-bootstrap.ts +91 -13
- package/src/joined-strand-store.ts +508 -498
- package/src/key-store-file.ts +142 -141
- package/src/link-budget.ts +25 -36
- package/src/machine-removal.ts +216 -0
- package/src/membership-connection-gater.ts +259 -191
- package/src/node-claim-payload.ts +259 -0
- package/src/node-default-transports.ts +38 -0
- package/src/node-transports.ts +49 -0
- package/src/owner-anchor-sync.ts +171 -0
- package/src/peer-authorization.ts +258 -29
- package/src/peer-dial.ts +604 -315
- package/src/peer-join-backfill.ts +62 -11
- package/src/peer-record.ts +159 -197
- package/src/pending-join-runner.ts +729 -735
- package/src/primary-lan-address.ts +47 -0
- package/src/provider/client.ts +326 -0
- package/src/provider/descriptor.ts +129 -0
- package/src/provider/index.ts +59 -0
- package/src/provider/oauth.ts +285 -0
- package/src/provider/rent-node.ts +275 -0
- package/src/push-fanout.ts +8 -2
- package/src/relay-addrs.ts +9 -4
- package/src/relay-reservation.ts +1211 -1121
- package/src/seed-bootstrap.ts +1502 -1448
- package/src/seed-trust-policy.ts +353 -140
- package/src/strand-addr-protocol.ts +26 -35
- package/src/strand-commit-durability.ts +116 -0
- package/src/strand-database.ts +46 -14
- package/src/strand-first-sync-gate.ts +7 -1
- package/src/strand-formation-protocol.ts +1039 -1036
- package/src/strand-fret-addrs.ts +179 -145
- package/src/strand-instance-manager.ts +2026 -1883
- package/src/strand-move.ts +585 -0
- package/src/strand-network-config.ts +7 -6
- package/src/strand-peer-redial.ts +307 -0
- package/src/strand-revocation-enforcer.ts +11 -11
- package/src/strand-wake-protocol.ts +23 -30
- package/src/trusted-owner-store.ts +242 -171
- package/src/types.ts +2687 -2242
package/dist/fs-atomic.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Node-only filesystem helpers: atomic file write
|
|
3
|
-
*
|
|
2
|
+
* Node-only filesystem helpers: atomic file write and the ENOENT check, shared
|
|
3
|
+
* by `key-store-file.ts` and `file-durable-slot.ts`. The filename-safe encoding
|
|
4
|
+
* they also use is cross-platform and lives in `file-safe-name.ts`.
|
|
4
5
|
*
|
|
5
6
|
* This module imports `node:fs/promises`, so — like its consumers — it is kept
|
|
6
7
|
* OUT of the package's cross-platform default entry and is not itself an
|
|
@@ -12,28 +13,6 @@ const log = debug('sereus:cadre:fs-atomic');
|
|
|
12
13
|
/** Best-effort POSIX permissions (ignored on Windows / unsupported FSes). */
|
|
13
14
|
export const DIR_MODE = 0o700;
|
|
14
15
|
export const FILE_MODE = 0o600;
|
|
15
|
-
/**
|
|
16
|
-
* Percent-encode a string into a filesystem-safe filename component. Beyond
|
|
17
|
-
* `encodeURIComponent` (which already escapes `/`, spaces, and unicode), this
|
|
18
|
-
* also escapes the unreserved characters `encodeURIComponent` leaves intact but
|
|
19
|
-
* that are unsafe in filenames on some platforms (notably `*` on Windows) — and
|
|
20
|
-
* `.`, so a file suffix appended by the caller is the only literal dot, making
|
|
21
|
-
* suffix-stripping unambiguous — and every uppercase letter, because Windows
|
|
22
|
-
* (NTFS) and macOS (APFS/HFS+ by default) ignore case in file names. Reversed by
|
|
23
|
-
* `decodeURIComponent`.
|
|
24
|
-
*
|
|
25
|
-
* The result contains only `a-z0-9-_` and `%XX` escapes (uppercase hex). Since a
|
|
26
|
-
* literal `%` is itself escaped, every `%` starts an escape, so ignoring case
|
|
27
|
-
* can change only escape hex digits — which decode case-insensitively — and two
|
|
28
|
-
* different inputs never yield names equal ignoring case. The escapes keep
|
|
29
|
-
* `encodeURIComponent`'s uppercase hex so a name built from an id with no
|
|
30
|
-
* capital letters (the identity slot `cadre%2Fidentity.key`, a lowercase party
|
|
31
|
-
* id) is the same as before uppercase letters were escaped.
|
|
32
|
-
*/
|
|
33
|
-
export function encodeFileSafeComponent(component) {
|
|
34
|
-
// NOTE: a file left from before uppercase letters were escaped (`trusted-owners.Alice.json`) has, ignoring case, the new name of the all-lowercase id (`alice`), so on Windows/macOS a lookup for that id opens it; the per-party records' envelope party-id check rejects it (cold start), and `FileKeyStore` needs two parties in one key directory whose ids fold to the same lowercase string. The release note says to delete old files; if a store ever reads another id's old file in practice, rename or remove old-format files when the store opens.
|
|
35
|
-
return encodeURIComponent(component).replace(/(%[0-9A-F]{2})|[!'()*~.A-Z]/g, (c, escape) => escape ?? `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
36
|
-
}
|
|
37
16
|
/** Whether an unknown error is a Node "file/dir not found" (ENOENT). */
|
|
38
17
|
export function isNotFound(error) {
|
|
39
18
|
return typeof error === 'object' && error !== null
|
package/dist/fs-atomic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs-atomic.js","sourceRoot":"","sources":["../src/fs-atomic.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fs-atomic.js","sourceRoot":"","sources":["../src/fs-atomic.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG3D,MAAM,GAAG,GAAG,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAE5C,6EAA6E;AAC7E,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC;AAC9B,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC;AAE/B,wEAAwE;AACxE,MAAM,UAAU,UAAU,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;WAC7C,KAA4B,CAAC,IAAI,KAAK,QAAQ,CAAC;AACrD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACxC,GAAW,EACX,OAAe,EACf,SAAiB,EACjB,IAAg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K,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC1C,CAAC;AACF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
2
|
export { canonicalJson } from './canonical-json.js';
|
|
3
|
-
export { CadreNode } from './cadre-node.js';
|
|
4
|
-
export {
|
|
3
|
+
export { CadreNode, OWNER_INVITATION_DEFAULT_TTL_MS, CADRE_INVITATION_DEFAULT_TTL_MS } from './cadre-node.js';
|
|
4
|
+
export { MachineRemovalRefusedError } from './machine-removal.js';
|
|
5
|
+
export { ControlDatabase, parseNullableStoredDatetimeMs, MissingHostStrandError, InvitationExhaustedError, CadreInviteIssuerUnknownError, buildAuthorizationMessage, registerPartyIdFunction, formationVouchMessage, formationConsentMessage, cadreInviteAddMessage, cadreInviteRedeemMessage, cadreInviteConsentMessage, projectSeedPeers, REAPABLE_TABLES, type ReapableTable, type ControlDatabaseConfig, type ControlTable, type RevocableTable, type FormationUsageResult, type FormationInviteRow, type MembershipChangeListener, type GuardedDeleteListener, type ControlWriteAbandonedListener, type RevokedRowRef, type MachineRemovalWrites } from './control-database.js';
|
|
5
6
|
export { CONTROL_WRITE_ATTEMPTS, CONTROL_WRITE_RETRY_BUDGET_MS, SCHEMA_INIT_ATTEMPTS, SCHEMA_INIT_RETRY_POLICY, isRetriableControlWriteFailure, isRetriableSchemaInitFailure, retryControlWrite, type ControlWriteRetryOptions } from './control-write-retry.js';
|
|
6
7
|
export { CONTROL_READ_ATTEMPTS, CONTROL_READ_RETRY_DELAYS_MS, CONTROL_READ_RETRY_BUDGET_MS, isRetriableControlReadFailure, retryControlRead, type ControlReadRetryOptions } from './control-read-retry.js';
|
|
7
8
|
export type { ControlRetryAbandonment, ControlRetryAbandonReason, ControlRetryAbandonListener } from './control-retry.js';
|
|
8
|
-
export { controlAuthorizationFields, type ControlDomain, type ControlAction } from './control-authorization.js';
|
|
9
|
-
export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, requireEd25519PublicKeyB64, type Ed25519KeyPair } from './ed25519-key.js';
|
|
9
|
+
export { controlAuthorizationFields, unboundAuthorizationFields, cadreInviteRowFields, type ControlDomain, type BoundControlDomain, type UnboundControlDomain, type ControlAction, type CadreInviteSignedFields } from './control-authorization.js';
|
|
10
|
+
export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, ed25519PublicKeyB64FromPeerId, requireEd25519PublicKeyB64, type Ed25519KeyPair } from './ed25519-key.js';
|
|
10
11
|
export { InMemoryKeyStore, KeyStoreAccessError, DEFAULT_IDENTITY_KEY_ID, type KeyStore, type KeyId } from './key-store.js';
|
|
12
|
+
export { encodeFileSafeComponent } from './file-safe-name.js';
|
|
11
13
|
export { loadOrCreateIdentityKey } from './identity-key.js';
|
|
12
14
|
export { MemoryTrustedOwnerStore, PersistentTrustedOwnerStore, type TrustedOwnerStore, type TrustSource } from './trusted-owner-store.js';
|
|
13
15
|
export type { DurableSlot } from './node-local-snapshot.js';
|
|
@@ -18,6 +20,7 @@ export { MemoryStrandNetworkStateStore, PersistentStrandNetworkStateStore, stran
|
|
|
18
20
|
export { strandFretPeerAddrs, type FretAddrHost, type FretPeerAddrs } from './strand-fret-addrs.js';
|
|
19
21
|
export { controlStorageScope, isControlStorageScope, isValidStrandScopeKey, assertStrandScopeKey, InvalidStrandIdError } from './storage-scope.js';
|
|
20
22
|
export { StrandDatabase, type StrandDatabaseConfig } from './strand-database.js';
|
|
23
|
+
export type { StrandCommitDurability, StrandCommitHeld } from './strand-commit-durability.js';
|
|
21
24
|
export { StrandWatcher, type StrandWatcherCallbacks, type StrandQueryable, type SAppIdLookup, type StrandRowWithApp } from './strand-watcher.js';
|
|
22
25
|
export { StrandInstanceManager, type StartStrandConfig, type ResumeStrandOverrides, getStrandStoragePath, isAwaitingFirstSync, liveStrandStatus } from './strand-instance-manager.js';
|
|
23
26
|
export { StrandAwaitingFirstSyncError, DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS, DEFAULT_STRAND_FIRST_SYNC_POLL_MS, strandHeaderHeld, appTablesReadable, strandFirstSyncComplete, type StrandFirstSyncConfig } from './strand-first-sync-gate.js';
|
|
@@ -36,27 +39,36 @@ export { generateStrandMemberKey, strandMemberKeyPair } from './strand-member-ke
|
|
|
36
39
|
export { signStrandPayload, verifyStrandPayload, signStrandApproval, generateStrandStampId, bootstrapFounderMembership, PreSplitStrandIdentityError, issueInvite, consumeInvite, burnInvite, isStrandMember, cancelInvite, listOutstandingInvites, addMemberByManager, revokeMember, leaveStrand, registerMemberPeer, listMemberPeers, removeMemberPeer, addManager, admitManager, removeManager, sealStrand, isStrandSealed, StrandTransactionBusyError, STRAND_ENGINE, STRAND_ENGINE_VERSION, type FounderBootstrapParams, type IssueInviteParams, type IssuedInvite, type ConsumeInviteParams, type CancelInviteParams, type OutstandingInvite, type AddMemberByManagerParams, type RevokeMemberParams, type LeaveStrandParams, type RegisterMemberPeerParams, type RemoveOwnPeerParams, type RemoveMemberPeerByManagerParams, type RemoveMemberPeerParams, type AddManagerParams, type AdmitManagerParams, type RemoveManagerParams, type SealStrandParams, type StrandWriteOptions } from './strand-membership-writer.js';
|
|
37
40
|
export { canonicalDatetime } from './canonical-datetime.js';
|
|
38
41
|
export { StrandMemberRegistry, StrandMemberVerifier, memberRegistrationPayload, type StrandAdmission } from './strand-member-registry.js';
|
|
39
|
-
export { SeedBootstrapService, SEED_PROTOCOL,
|
|
40
|
-
export { peerAuthorizationDigest, cadrePeerVoucherDigest, cadrePeerRemoveDigest, deviceTokenAddDigest, deviceTokenRemoveDigest, formationConsentDigest, verifyPeerAuthorization, verifyCadrePeerVoucher, verifyFormationConsent, type DeviceTokenAuthorizedRow } from './peer-authorization.js';
|
|
42
|
+
export { SeedBootstrapService, SEED_PROTOCOL, mergeSeedPeers, seedDigest, type SeedBootstrapConfig, type SeedEventCallbacks } from './seed-bootstrap.js';
|
|
43
|
+
export { peerAuthorizationDigest, cadrePeerVoucherDigest, cadrePeerRemoveDigest, deviceTokenAddDigest, deviceTokenRemoveDigest, formationConsentDigest, cadreInviteAddDigest, cadreInviteRedeemDigest, cadreInviteConsentDigest, ownerKeyAddDigest, verifyPeerAuthorization, verifyCadrePeerVoucher, verifyOwnerKeyVoucher, verifyRevocationSigner, verifyFormationConsent, verifyInvitationAdmission, verifyInvitationOwnerAdmission, verifyCadreInviteRow, verifyCadreInviteRedemption, type DeviceTokenAuthorizedRow } from './peer-authorization.js';
|
|
44
|
+
export { deriveOwnerAnchor, type OwnerAnchorInputs, type OwnerAnchorDerivation } from './owner-anchor-sync.js';
|
|
41
45
|
export { StrandWakeService, dialWake, WAKE_PROTOCOL, DEFAULT_WAKE_DIAL_BUDGET_MS, type StrandWakeServiceOptions, type DialWakeOptions } from './strand-wake-protocol.js';
|
|
42
46
|
export { StrandAddrService, collectStrandAddrs, STRAND_ADDR_PROTOCOL, type StrandAddrServiceOptions, type StrandAddrPeer, type CollectStrandAddrsOptions, type StrandAddrOutcome, type StrandAddrCollection } from './strand-addr-protocol.js';
|
|
43
|
-
export { peerRecordSignedPayload, signPeerRecord, verifyPeerRecordSignature, isPeerRecordFresh, isSignalingAddr, orderSignalingFirst,
|
|
47
|
+
export { peerRecordSignedPayload, signPeerRecord, verifyPeerRecordSignature, isPeerRecordFresh, isSignalingAddr, orderSignalingFirst, currentMemberTrustPolicy, DEFAULT_PEER_RECORD_MAX_AGE_MS, DEFAULT_PEER_RECORD_HEARTBEAT_MS } from './peer-record.js';
|
|
44
48
|
export { deviceTokenSignedPayload, signDeviceTokenRecord, verifyDeviceTokenSignature, isPushPlatform } from './device-token.js';
|
|
45
49
|
export { STRAND_WAKE_TYPE, type StrandWakePayload } from './strand-wake-payload.js';
|
|
46
50
|
export type { PushNotifier, PushMessage, PushSendResult } from './push-notifier.js';
|
|
47
51
|
export { validatePushCredentials, redactPushCredentials, REDACTED } from './push-credentials.js';
|
|
48
52
|
export { PushFanoutService, DEFAULT_PUSH_COOLDOWN_MS, DEFAULT_PUSH_DEBOUNCE_MS, type PushFanoutOptions, type FanoutMember } from './push-fanout.js';
|
|
49
53
|
export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE, type ControlCohortSelection, type ControlCohortReconcileResult } from './control-cohort.js';
|
|
50
|
-
export { dialPeerAddrs, SelfRelayOnlyError, tryAddrsInTurn, directBeforeRelayed, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS, CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS, DEFAULT_PEER_DIAL_BUDGET, type PeerDialBudget, type AddrDialer } from './peer-dial.js';
|
|
54
|
+
export { dialAddr, withTrailingPeerId, dialPeerAddrs, SelfRelayOnlyError, PeerUnreachableError, tryAddrsInTurn, directBeforeRelayed, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS, CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS, DEFAULT_PEER_DIAL_BUDGET, type PeerDialBudget, type AddrDialer } from './peer-dial.js';
|
|
51
55
|
export { DECLARED_LINK_ROUND_TRIP_MS, CIRCUIT_DIAL_ROUND_TRIPS, RELAY_DIAL_ROUND_TRIPS, RELAYED_DIAL_ROUND_TRIPS, RELAY_RESERVATION_ROUND_TRIPS, CIRCUIT_REQUEST_ROUND_TRIPS, RELAYED_REQUEST_ROUND_TRIPS, PUSH_TRANSFER_ALLOWANCE_MS, ADMISSION_DECISION_TIMEOUT_MS, resolveLinkRoundTripMs, relayedDialBudgetMs, relayReservationBudgetMs, circuitRequestBudgetMs, relayedRequestBudgetMs, peerJoinPushBudget, type PeerJoinPushBudget, DIAL_ADMISSION_DECISIONS, optimysticDialLimits, type OptimysticDialLimits } from './link-budget.js';
|
|
52
|
-
export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy, type SeedTrustPolicy, type SeedTrustContext, type SeedTrustDecision } from './seed-trust-policy.js';
|
|
56
|
+
export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy, claimSecretTrustPolicy, type SeedTrustPolicy, type SeedTrustContext, type SeedTrustDecision, type ClaimSecretTrustPolicyOptions } from './seed-trust-policy.js';
|
|
57
|
+
export { parseClaimSecret, claimProof, verifyClaimProof, ClaimRefusedError, CLAIM_SECRET_BYTES } from './claim-proof.js';
|
|
58
|
+
export { encodeNodeClaimPayload, decodeNodeClaimPayload, selectNodeClaimAddresses, withClaimDestination, destinationPeerIdOf, classifyDialAddress, NODE_CLAIM_PAYLOAD_PREFIX, type NodeClaimPayload, type NodeClaimAddressOptions, type DialAddressKind } from './node-claim-payload.js';
|
|
59
|
+
export { exportStrandBundle, adoptStrandBundle, readStrandHoldings, unheldBundleContent, StrandMoveNotOwnerError, StrandMoveSamePartyError, type StrandHoldings, type StrandBundle, type StrandBundleEntry, type FormationInviteEntry, type StrandMoveReport, type StrandMoveFailure } from './strand-move.js';
|
|
60
|
+
export { encodeCadreJoinRequest, decodeCadreJoinRequest, requireCadreJoinReply, CADRE_JOIN_REQUEST_PREFIX, CADRE_INVITATION_PREFIX, CADRE_JOIN_REQUEST_MAX_APP_NAME, type CadreJoinReply, type CadreJoinRequest } from './cadre-join-request.js';
|
|
61
|
+
export * from './provider/index.js';
|
|
53
62
|
export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
|
|
54
63
|
export { FormationListener, dialFormation, dialFormationByMachine, isValidResponderCreatesResult, isWellFormedMembershipInvite, sanitizeStrandAddrs, FORMATION_PROTOCOL, type FormationParty, type FormationContactMessage, type FormationResultMessage, type FormationProvisionResult, type FormationStrandInfo, type FormationDbConnectionInfo, type FormationListenerOptions, type FormationDialOptions, type FormationDialResult, type FormationRejection, type FormationTokenCheck, type ResponderProvisionOutcome } from './strand-formation-protocol.js';
|
|
55
64
|
export { FormationRejectedError, FormationUnreachableError, FormationPostApprovalError, FORMATION_REJECTION_RETRYABLE, isFormationRejectionCode, type FormationRejectionCode } from './strand-formation-rejection.js';
|
|
56
65
|
export { formationDeadlines, type FormationDeadlines } from './strand-formation-deadlines.js';
|
|
66
|
+
export { CadreInviteHandler, redeemAtMembers, redeemInPasses, signRedeemRequest, verifyRedeemReply, encodeCadreInvitation, decodeCadreInvitation, isWellFormedCadreInviteRow, sanitizeAddrs, CadreInviteRejectedError, CadreInviteUnreachableError, CadreInviteReplyInvalidError, CADRE_INVITE_PROTOCOL, CADRE_INVITE_REJECTION_RETRYABLE, isCadreInviteRejectionCode, type CadreInvitation, type CadreInviteRedeemRequest, type CadreInviteRedeemReply, type CadreInviteAccepted, type CadreInviteRejectionCode, type CadreInviteAddressOutcome, type CadreInviteHandlerOptions, type CadreInviteStore, type RedeemAtMembersOptions, type RedeemInPassesOptions, type RedeemSigner, type CadreInviteRedemption } from './cadre-invite-protocol.js';
|
|
67
|
+
export { selectCadreInvitationMembers, cadreInvitationReach, CADRE_INVITATION_MAX_ADDRS, CADRE_INVITATION_ADDRS_PER_SIBLING } from './invitation-bootstrap.js';
|
|
57
68
|
export { PENDING_JOIN_POLL_MS, PENDING_JOIN_MAX_BACKOFF_MS, MAX_PENDING_JOIN_MS } from './pending-join-runner.js';
|
|
58
69
|
export { StrandFormationManager, createStrandFormationManager, MEMBERSHIP_INVITE_TTL_MS, MEMBERSHIP_INVITE_UNAVAILABLE_REASON, HOST_STRAND_MUST_BE_RECREATED_REASON, type CadrePeerAddrsSource, type MembershipInviteIssuer, type StrandFormationManagerConfig, type StrandFormationManagerOptions } from './strand-formation-manager.js';
|
|
59
|
-
export {
|
|
70
|
+
export { controlProtocolClasses, type ControlProtocolClass } from './control-protocol-guard.js';
|
|
71
|
+
export { createMembershipConnectionGater, PROVISIONAL_ADMISSION_DEADLINE_MS, PROVISIONAL_ADMISSION_CLOSE_TIMEOUT_MS, MAX_UNAUTHORIZED_RELAY_RESERVATIONS, UnauthorizedReservationBudget, type InboundAdmissionPolicy, type InboundConnectionVerdict } from './membership-connection-gater.js';
|
|
60
72
|
export { RelayReservationFailedError, UnbindableListenAddressError, RELAY_SEARCH_LISTEN_ADDR, resolveListenAddrs } from './relay-addrs.js';
|
|
61
73
|
export { strandNodeAddrs, type StrandNodeAddrs } from './strand-network-config.js';
|
|
62
74
|
export { RELAY_STUN_PORT, relayStunUrl, resolveStunServers, type StunServer } from './relay-stun.js';
|
package/dist/index.js
CHANGED
|
@@ -3,9 +3,12 @@ export * from './types.js';
|
|
|
3
3
|
// Canonical JSON serialization (shared signing payload format)
|
|
4
4
|
export { canonicalJson } from './canonical-json.js';
|
|
5
5
|
// Main CadreNode class
|
|
6
|
-
export { CadreNode } from './cadre-node.js';
|
|
6
|
+
export { CadreNode, OWNER_INVITATION_DEFAULT_TTL_MS, CADRE_INVITATION_DEFAULT_TTL_MS } from './cadre-node.js';
|
|
7
|
+
// Removing a machine from a cadre: the by-name refusal `CadreNode.removeMachine` throws
|
|
8
|
+
// (the listing, plan and result types are in types.ts)
|
|
9
|
+
export { MachineRemovalRefusedError } from './machine-removal.js';
|
|
7
10
|
// Control database
|
|
8
|
-
export { ControlDatabase, MissingHostStrandError, buildAuthorizationMessage, formationVouchMessage, formationConsentMessage, REAPABLE_TABLES } from './control-database.js';
|
|
11
|
+
export { ControlDatabase, parseNullableStoredDatetimeMs, MissingHostStrandError, InvitationExhaustedError, CadreInviteIssuerUnknownError, buildAuthorizationMessage, registerPartyIdFunction, formationVouchMessage, formationConsentMessage, cadreInviteAddMessage, cadreInviteRedeemMessage, cadreInviteConsentMessage, projectSeedPeers, REAPABLE_TABLES } from './control-database.js';
|
|
9
12
|
// Bounded retry for transient control-write failures (classifier + loop behind
|
|
10
13
|
// ControlDatabase.lockedWithRetry; exported so the integration package can drive the
|
|
11
14
|
// classifier against real engine errors)
|
|
@@ -14,15 +17,18 @@ export { CONTROL_WRITE_ATTEMPTS, CONTROL_WRITE_RETRY_BUDGET_MS, SCHEMA_INIT_ATTE
|
|
|
14
17
|
// ControlDatabase.readRows; the loop is shared with the write side via control-retry.ts)
|
|
15
18
|
export { CONTROL_READ_ATTEMPTS, CONTROL_READ_RETRY_DELAYS_MS, CONTROL_READ_RETRY_BUDGET_MS, isRetriableControlReadFailure, retryControlRead } from './control-read-retry.js';
|
|
16
19
|
// Control-plane authorization field vector (the domain/action tagging every signer shares)
|
|
17
|
-
export { controlAuthorizationFields } from './control-authorization.js';
|
|
20
|
+
export { controlAuthorizationFields, unboundAuthorizationFields, cadreInviteRowFields } from './control-authorization.js';
|
|
18
21
|
// Ed25519 key bridge (libp2p Ed25519 -> base64url keypair)
|
|
19
|
-
export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, requireEd25519PublicKeyB64 } from './ed25519-key.js';
|
|
22
|
+
export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, ed25519PublicKeyB64FromPeerId, requireEd25519PublicKeyB64 } from './ed25519-key.js';
|
|
20
23
|
// Pluggable key store (backend-agnostic identity/owner key material seam).
|
|
21
24
|
// Dependency-free: the interface, error, default slot id, and in-memory backend
|
|
22
25
|
// are safe in every (RN/browser/Node) entry graph. The Node FileKeyStore is a
|
|
23
26
|
// separate subpath module ('@serfab/cadre-core/key-store-file') so its node:fs
|
|
24
27
|
// import never lands here.
|
|
25
28
|
export { InMemoryKeyStore, KeyStoreAccessError, DEFAULT_IDENTITY_KEY_ID } from './key-store.js';
|
|
29
|
+
// The filename-safe form of an id that every Node-only per-party file store names its file
|
|
30
|
+
// with (`<name>.<encoded party>.json`), for an embedder keeping its own file beside theirs.
|
|
31
|
+
export { encodeFileSafeComponent } from './file-safe-name.js';
|
|
26
32
|
// The KeyStore-backed identity rule, shared with embedding apps that need the
|
|
27
33
|
// node key BEFORE `CadreNode` exists.
|
|
28
34
|
export { loadOrCreateIdentityKey } from './identity-key.js';
|
|
@@ -127,16 +133,20 @@ export { canonicalDatetime } from './canonical-datetime.js';
|
|
|
127
133
|
// MemberVerifier that write/read the real Strand.* membership tables.
|
|
128
134
|
export { StrandMemberRegistry, StrandMemberVerifier, memberRegistrationPayload } from './strand-member-registry.js';
|
|
129
135
|
// Seed Bootstrap
|
|
130
|
-
export { SeedBootstrapService, SEED_PROTOCOL,
|
|
136
|
+
export { SeedBootstrapService, SEED_PROTOCOL, mergeSeedPeers, seedDigest } from './seed-bootstrap.js';
|
|
131
137
|
// Peer Authorization (shared owner-signature digest + offline verifier)
|
|
132
|
-
export { peerAuthorizationDigest, cadrePeerVoucherDigest, cadrePeerRemoveDigest, deviceTokenAddDigest, deviceTokenRemoveDigest, formationConsentDigest, verifyPeerAuthorization, verifyCadrePeerVoucher, verifyFormationConsent } from './peer-authorization.js';
|
|
138
|
+
export { peerAuthorizationDigest, cadrePeerVoucherDigest, cadrePeerRemoveDigest, deviceTokenAddDigest, deviceTokenRemoveDigest, formationConsentDigest, cadreInviteAddDigest, cadreInviteRedeemDigest, cadreInviteConsentDigest, ownerKeyAddDigest, verifyPeerAuthorization, verifyCadrePeerVoucher, verifyOwnerKeyVoucher, verifyRevocationSigner, verifyFormationConsent, verifyInvitationAdmission, verifyInvitationOwnerAdmission, verifyCadreInviteRow, verifyCadreInviteRedemption } from './peer-authorization.js';
|
|
139
|
+
// How the trusted-owner anchor follows the replicated OwnerKey table along verifiable
|
|
140
|
+
// chains: the pure derivation rule `CadreNode.syncOwnerAnchor` applies on every membership
|
|
141
|
+
// refresh (owner-anchor-sync.ts).
|
|
142
|
+
export { deriveOwnerAnchor } from './owner-anchor-sync.js';
|
|
133
143
|
// Strand Wake (control-network push-wake protocol)
|
|
134
144
|
export { StrandWakeService, dialWake, WAKE_PROTOCOL, DEFAULT_WAKE_DIAL_BUDGET_MS } from './strand-wake-protocol.js';
|
|
135
145
|
// Strand Address (control-network strand-address RPC) — wire types come via
|
|
136
146
|
// `export * from './types.js'` (StrandAddrRequest / StrandAddrResponse / StrandAddrStatus).
|
|
137
147
|
export { StrandAddrService, collectStrandAddrs, STRAND_ADDR_PROTOCOL } from './strand-addr-protocol.js';
|
|
138
148
|
// Peer-address record (self-published, signed, freshness-stamped CadrePeer row)
|
|
139
|
-
export { peerRecordSignedPayload, signPeerRecord, verifyPeerRecordSignature, isPeerRecordFresh, isSignalingAddr, orderSignalingFirst,
|
|
149
|
+
export { peerRecordSignedPayload, signPeerRecord, verifyPeerRecordSignature, isPeerRecordFresh, isSignalingAddr, orderSignalingFirst, currentMemberTrustPolicy, DEFAULT_PEER_RECORD_MAX_AGE_MS, DEFAULT_PEER_RECORD_HEARTBEAT_MS } from './peer-record.js';
|
|
140
150
|
// Device-token record (self-published, signed FCM/APNs push token — CadrePeer sibling)
|
|
141
151
|
export { deviceTokenSignedPayload, signDeviceTokenRecord, verifyDeviceTokenSignature, isPushPlatform } from './device-token.js';
|
|
142
152
|
// Strand-wake payload contract (canonical; shared by the server sender + RN receiver)
|
|
@@ -153,13 +163,39 @@ export { PushFanoutService, DEFAULT_PUSH_COOLDOWN_MS, DEFAULT_PUSH_DEBOUNCE_MS }
|
|
|
153
163
|
// the cadence/degree defaults the proactive reconcile routine reads.
|
|
154
164
|
export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE } from './control-cohort.js';
|
|
155
165
|
// Dialing one peer from several candidate addresses, each under its own time
|
|
156
|
-
// limit, so an address that never answers cannot starve the rest.
|
|
157
|
-
|
|
166
|
+
// limit, so an address that never answers cannot starve the rest. Each address is
|
|
167
|
+
// bound to the peer expected and dialed outside libp2p's dial queue (`dialAddr`),
|
|
168
|
+
// so another dial of the same peer in flight cannot capture the attempt.
|
|
169
|
+
export { dialAddr, withTrailingPeerId, dialPeerAddrs, SelfRelayOnlyError, PeerUnreachableError, tryAddrsInTurn, directBeforeRelayed, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS, CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS, DEFAULT_PEER_DIAL_BUDGET } from './peer-dial.js';
|
|
158
170
|
// Dial and reservation budgets counted in link round trips rather than fixed milliseconds, so
|
|
159
171
|
// one declared assumption about the link moves them all — see `NetworkConfig.linkRoundTripMs`.
|
|
160
172
|
export { DECLARED_LINK_ROUND_TRIP_MS, CIRCUIT_DIAL_ROUND_TRIPS, RELAY_DIAL_ROUND_TRIPS, RELAYED_DIAL_ROUND_TRIPS, RELAY_RESERVATION_ROUND_TRIPS, CIRCUIT_REQUEST_ROUND_TRIPS, RELAYED_REQUEST_ROUND_TRIPS, PUSH_TRANSFER_ALLOWANCE_MS, ADMISSION_DECISION_TIMEOUT_MS, resolveLinkRoundTripMs, relayedDialBudgetMs, relayReservationBudgetMs, circuitRequestBudgetMs, relayedRequestBudgetMs, peerJoinPushBudget, DIAL_ADMISSION_DECISIONS, optimysticDialLimits } from './link-budget.js';
|
|
161
173
|
// Seed trust policy (trust anchor for incoming seeds)
|
|
162
|
-
export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy } from './seed-trust-policy.js';
|
|
174
|
+
export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy, claimSecretTrustPolicy } from './seed-trust-policy.js';
|
|
175
|
+
// Claim proof: how a brand-new node's first seed proves its sender holds the node's
|
|
176
|
+
// one-time claim secret. The owner side builds the proof over `seedDigest` (exported
|
|
177
|
+
// with the seed bootstrap above); `claimSecretTrustPolicy` verifies it.
|
|
178
|
+
// `ClaimRefusedError` is what `CadreNode.claimNode` throws when the node said no;
|
|
179
|
+
// `PeerUnreachableError` (exported with the peer dial above) when it was never reached.
|
|
180
|
+
export { parseClaimSecret, claimProof, verifyClaimProof, ClaimRefusedError, CLAIM_SECRET_BYTES } from './claim-proof.js';
|
|
181
|
+
// The claim payload: the node's peer id, addresses and claim secret as the text a host
|
|
182
|
+
// shows as a QR code and a phone scans (`CadreNode.claimNode` takes the decoded form).
|
|
183
|
+
export { encodeNodeClaimPayload, decodeNodeClaimPayload, selectNodeClaimAddresses, withClaimDestination, destinationPeerIdOf, classifyDialAddress, NODE_CLAIM_PAYLOAD_PREFIX } from './node-claim-payload.js';
|
|
184
|
+
// Moving a party's strands into another party of the same owner, so an app's strands follow
|
|
185
|
+
// the app into the user's main cadre: the bundle one node exports from the party it leaves,
|
|
186
|
+
// its adoption by a node of the party it joined, and the check that the party it left holds
|
|
187
|
+
// nothing the joined one lacks before it is dissolved.
|
|
188
|
+
export { exportStrandBundle, adoptStrandBundle, readStrandHoldings, unheldBundleContent, StrandMoveNotOwnerError, StrandMoveSamePartyError } from './strand-move.js';
|
|
189
|
+
// The join request: what an app that wants to join a cadre copies to the app that manages it,
|
|
190
|
+
// which mints an invitation targeted at the request's peer id. Both paste-text prefixes live here.
|
|
191
|
+
export { encodeCadreJoinRequest, decodeCadreJoinRequest, requireCadreJoinReply, CADRE_JOIN_REQUEST_PREFIX, CADRE_INVITATION_PREFIX, CADRE_JOIN_REQUEST_MAX_APP_NAME } from './cadre-join-request.js';
|
|
192
|
+
// Renting a node from a hosting provider: the provider's descriptor, the app's side of the
|
|
193
|
+
// OAuth 2 + PKCE sign-in, the typed client for its container API, and `rentNode` /
|
|
194
|
+
// `finishRental`, which add the rented container to this node's cadre by invitation or by
|
|
195
|
+
// claim. Global `fetch` and `crypto.getRandomValues` only, so the whole set loads on React
|
|
196
|
+
// Native and in the browser (`docs/architecture.md` → "Renting a node from an app"). The
|
|
197
|
+
// barrel is the curated list; it is not repeated here.
|
|
198
|
+
export * from './provider/index.js';
|
|
163
199
|
// Schema Verification
|
|
164
200
|
export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
|
|
165
201
|
// Strand Formation transport (native cadre-core protocol)
|
|
@@ -167,12 +203,19 @@ export { FormationListener, dialFormation, dialFormationByMachine, isValidRespon
|
|
|
167
203
|
// How a formation dial fails: a typed refusal (with a fixed code) or no answer at all
|
|
168
204
|
export { FormationRejectedError, FormationUnreachableError, FormationPostApprovalError, FORMATION_REJECTION_RETRYABLE, isFormationRejectionCode } from './strand-formation-rejection.js';
|
|
169
205
|
export { formationDeadlines } from './strand-formation-deadlines.js';
|
|
206
|
+
// Cadre invitation redemption transport: the bundle an owner hands out, the wire messages, the
|
|
207
|
+
// member-side handler and the device-side dialer, and how a redemption fails
|
|
208
|
+
export { CadreInviteHandler, redeemAtMembers, redeemInPasses, signRedeemRequest, verifyRedeemReply, encodeCadreInvitation, decodeCadreInvitation, isWellFormedCadreInviteRow, sanitizeAddrs, CadreInviteRejectedError, CadreInviteUnreachableError, CadreInviteReplyInvalidError, CADRE_INVITE_PROTOCOL, CADRE_INVITE_REJECTION_RETRYABLE, isCadreInviteRejectionCode } from './cadre-invite-protocol.js';
|
|
209
|
+
// Which machines, and how many addresses of each, an invitation names; how far a cadre invitation reaches
|
|
210
|
+
export { selectCadreInvitationMembers, cadreInvitationReach, CADRE_INVITATION_MAX_ADDRS, CADRE_INVITATION_ADDRS_PER_SIBLING } from './invitation-bootstrap.js';
|
|
170
211
|
// The pending-join retry loop behind CadreNode.requestJoin (PendingJoinStatus is in types.ts)
|
|
171
212
|
export { PENDING_JOIN_POLL_MS, PENDING_JOIN_MAX_BACKOFF_MS, MAX_PENDING_JOIN_MS } from './pending-join-runner.js';
|
|
172
213
|
// Strand Formation manager (drives the native transport)
|
|
173
214
|
export { StrandFormationManager, createStrandFormationManager, MEMBERSHIP_INVITE_TTL_MS, MEMBERSHIP_INVITE_UNAVAILABLE_REASON, HOST_STRAND_MUST_BE_RECREATED_REASON } from './strand-formation-manager.js';
|
|
215
|
+
// Control-network per-stream protocol guard (which peers may open which protocol)
|
|
216
|
+
export { controlProtocolClasses } from './control-protocol-guard.js';
|
|
174
217
|
// Control-network inbound connection gate (membership defense-in-depth)
|
|
175
|
-
export { createMembershipConnectionGater,
|
|
218
|
+
export { createMembershipConnectionGater, PROVISIONAL_ADMISSION_DEADLINE_MS, PROVISIONAL_ADMISSION_CLOSE_TIMEOUT_MS, MAX_UNAUTHORIZED_RELAY_RESERVATIONS, UnauthorizedReservationBudget } from './membership-connection-gater.js';
|
|
176
219
|
// Thrown out of `CadreNode.start()` when a `network.relayAddrs` reservation does
|
|
177
220
|
// not land on its first attempt — the fail-fast posture of that config field now
|
|
178
221
|
// that the control node reserves AFTER control-database bring-up (relay-addrs.ts).
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,cAAc,YAAY,CAAC;AAE3B,+DAA+D;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,uBAAuB;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
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,+BAA+B,EAAE,+BAA+B,EAAE,MAAM,iBAAiB,CAAC;AAE9G,wFAAwF;AACxF,uDAAuD;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,mBAAmB;AACnB,OAAO,EAAE,eAAe,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,eAAe,EAA4R,MAAM,uBAAuB,CAAC;AAErpB,+EAA+E;AAC/E,qFAAqF;AACrF,yCAAyC;AACzC,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,oBAAoB,EACpB,wBAAwB,EACxB,8B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AC9D,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"}
|
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Which of the inviting party's
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Which of the inviting party's machines an invitation names, so a joiner can still form or
|
|
3
|
+
* join while the machine that minted it is offline: an open strand invitation
|
|
4
|
+
* (`CadreNode.createOpenInvitation`, which puts the minting machine's own addresses first
|
|
5
|
+
* itself) and a cadre invitation ({@link selectCadreInvitationMembers}). Also how far a cadre
|
|
6
|
+
* invitation reaches once its minting machine is gone ({@link cadreInvitationReach}).
|
|
5
7
|
*/
|
|
8
|
+
import type { CadreInvitationReach } from './types.js';
|
|
6
9
|
/**
|
|
7
10
|
* At most this many of the party's other machines are named, each with at most
|
|
8
11
|
* {@link INVITATION_ADDRS_PER_SIBLING} addresses: 12 extra addresses of roughly 100–200
|
|
9
12
|
* characters, base64url-encoded into an invitation shared as text.
|
|
10
13
|
*
|
|
11
|
-
* NOTE:
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* NOTE: a cadre invitation, which may be carried in a QR code, is capped harder
|
|
15
|
+
* ({@link CADRE_INVITATION_MAX_ADDRS}); an open strand invitation keeps these caps. If open
|
|
16
|
+
* invitations are ever carried in a QR code too, cap them the same way.
|
|
17
|
+
* NOTE: for an open strand invitation the per-machine cap keeps the record's order (relay first,
|
|
18
|
+
* then direct addresses as the machine published them, loopback included); a cadre invitation
|
|
19
|
+
* ranks them first. If an open invitation's sibling is seen to have its reachable address cut,
|
|
20
|
+
* rank the same way.
|
|
16
21
|
*/
|
|
17
22
|
export declare const INVITATION_SIBLING_MACHINES = 3;
|
|
18
23
|
export declare const INVITATION_ADDRS_PER_SIBLING = 4;
|
|
24
|
+
/**
|
|
25
|
+
* Most addresses a cadre invitation names in total, so its text fits one QR code. Measured
|
|
26
|
+
* with three owner keys: 2,206 characters encoded at 6 relayed addresses of about 155
|
|
27
|
+
* characters (the worst case, since ranking puts relayed addresses first), 1,972 with relayed
|
|
28
|
+
* and direct WebSocket addresses alternating, against 2,331 bytes in the largest QR code at
|
|
29
|
+
* error-correction level M (2,953 at L). Each further address costs about 170 characters, each
|
|
30
|
+
* further owner key about 60.
|
|
31
|
+
*/
|
|
32
|
+
export declare const CADRE_INVITATION_MAX_ADDRS = 6;
|
|
33
|
+
/** Most addresses a cadre invitation names for each of the party's other machines. */
|
|
34
|
+
export declare const CADRE_INVITATION_ADDRS_PER_SIBLING = 2;
|
|
19
35
|
/** One other machine of the party whose signed address record resolved. */
|
|
20
36
|
export interface InvitationSibling {
|
|
21
37
|
peerId: string;
|
|
@@ -25,8 +41,30 @@ export interface InvitationSibling {
|
|
|
25
41
|
addrs: string[];
|
|
26
42
|
}
|
|
27
43
|
/**
|
|
28
|
-
* The addresses of the siblings an invitation names
|
|
29
|
-
* now come first, since a live connection is the best evidence that
|
|
30
|
-
* shows only that it was up within the freshness window. Within each
|
|
44
|
+
* The addresses of the siblings an invitation names, at most `perSibling` each. Machines this
|
|
45
|
+
* node is connected to right now come first, since a live connection is the best evidence that
|
|
46
|
+
* a machine is up; a record shows only that it was up within the freshness window. Within each
|
|
47
|
+
* half, newest record first.
|
|
48
|
+
*/
|
|
49
|
+
export declare function selectInvitationSiblingAddrs(siblings: InvitationSibling[], connected: ReadonlySet<string>, perSibling?: number): string[];
|
|
50
|
+
/**
|
|
51
|
+
* The `members` of a cadre invitation: the minting machine's own addresses first (at most
|
|
52
|
+
* {@link INVITATION_ADDRS_PER_SIBLING}), then the other machines' in
|
|
53
|
+
* {@link selectInvitationSiblingAddrs} order (at most {@link CADRE_INVITATION_ADDRS_PER_SIBLING}
|
|
54
|
+
* each), the whole list cut to {@link CADRE_INVITATION_MAX_ADDRS}. Each machine's addresses are
|
|
55
|
+
* ranked for a phone before they are cut ({@link rankForPhone}): libp2p reports a machine
|
|
56
|
+
* listening on every interface with its loopback and private addresses ahead of its relayed one.
|
|
57
|
+
*
|
|
58
|
+
* NOTE: accepted tradeoff — with two or more other machines, only the best two addresses of
|
|
59
|
+
* each survive, connected machines first, so a reachable address of a sibling can be cut. Size
|
|
60
|
+
* was weighed over completeness, so the text fits a QR code; revisit if redemptions are seen
|
|
61
|
+
* failing for want of a sibling address the record held.
|
|
62
|
+
*/
|
|
63
|
+
export declare function selectCadreInvitationMembers(own: readonly string[], siblings: InvitationSibling[], connected: ReadonlySet<string>): string[];
|
|
64
|
+
/**
|
|
65
|
+
* Where a phone could redeem an invitation naming `members` from, judged on the machines other
|
|
66
|
+
* than `issuerPeerId`: in the app flows the minting app is the one closed or in the background
|
|
67
|
+
* when the other app redeems, and two apps on one phone cannot reach each other. An address
|
|
68
|
+
* names its machine by its last `/p2p/`.
|
|
31
69
|
*/
|
|
32
|
-
export declare function
|
|
70
|
+
export declare function cadreInvitationReach(members: readonly string[], issuerPeerId: string): CadreInvitationReach;
|
|
@@ -1,30 +1,93 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Which of the inviting party's
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Which of the inviting party's machines an invitation names, so a joiner can still form or
|
|
3
|
+
* join while the machine that minted it is offline: an open strand invitation
|
|
4
|
+
* (`CadreNode.createOpenInvitation`, which puts the minting machine's own addresses first
|
|
5
|
+
* itself) and a cadre invitation ({@link selectCadreInvitationMembers}). Also how far a cadre
|
|
6
|
+
* invitation reaches once its minting machine is gone ({@link cadreInvitationReach}).
|
|
5
7
|
*/
|
|
8
|
+
import { classifyDialAddress, destinationPeerIdOf } from './node-claim-payload.js';
|
|
6
9
|
/**
|
|
7
10
|
* At most this many of the party's other machines are named, each with at most
|
|
8
11
|
* {@link INVITATION_ADDRS_PER_SIBLING} addresses: 12 extra addresses of roughly 100–200
|
|
9
12
|
* characters, base64url-encoded into an invitation shared as text.
|
|
10
13
|
*
|
|
11
|
-
* NOTE:
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* NOTE: a cadre invitation, which may be carried in a QR code, is capped harder
|
|
15
|
+
* ({@link CADRE_INVITATION_MAX_ADDRS}); an open strand invitation keeps these caps. If open
|
|
16
|
+
* invitations are ever carried in a QR code too, cap them the same way.
|
|
17
|
+
* NOTE: for an open strand invitation the per-machine cap keeps the record's order (relay first,
|
|
18
|
+
* then direct addresses as the machine published them, loopback included); a cadre invitation
|
|
19
|
+
* ranks them first. If an open invitation's sibling is seen to have its reachable address cut,
|
|
20
|
+
* rank the same way.
|
|
16
21
|
*/
|
|
17
22
|
export const INVITATION_SIBLING_MACHINES = 3;
|
|
18
23
|
export const INVITATION_ADDRS_PER_SIBLING = 4;
|
|
19
24
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
25
|
+
* Most addresses a cadre invitation names in total, so its text fits one QR code. Measured
|
|
26
|
+
* with three owner keys: 2,206 characters encoded at 6 relayed addresses of about 155
|
|
27
|
+
* characters (the worst case, since ranking puts relayed addresses first), 1,972 with relayed
|
|
28
|
+
* and direct WebSocket addresses alternating, against 2,331 bytes in the largest QR code at
|
|
29
|
+
* error-correction level M (2,953 at L). Each further address costs about 170 characters, each
|
|
30
|
+
* further owner key about 60.
|
|
23
31
|
*/
|
|
24
|
-
export
|
|
32
|
+
export const CADRE_INVITATION_MAX_ADDRS = 6;
|
|
33
|
+
/** Most addresses a cadre invitation names for each of the party's other machines. */
|
|
34
|
+
export const CADRE_INVITATION_ADDRS_PER_SIBLING = 2;
|
|
35
|
+
/**
|
|
36
|
+
* The addresses of the siblings an invitation names, at most `perSibling` each. Machines this
|
|
37
|
+
* node is connected to right now come first, since a live connection is the best evidence that
|
|
38
|
+
* a machine is up; a record shows only that it was up within the freshness window. Within each
|
|
39
|
+
* half, newest record first.
|
|
40
|
+
*/
|
|
41
|
+
export function selectInvitationSiblingAddrs(siblings, connected, perSibling = INVITATION_ADDRS_PER_SIBLING) {
|
|
25
42
|
return [...siblings]
|
|
26
43
|
.sort((a, b) => Number(connected.has(b.peerId)) - Number(connected.has(a.peerId)) || b.updatedAt - a.updatedAt)
|
|
27
44
|
.slice(0, INVITATION_SIBLING_MACHINES)
|
|
28
|
-
.flatMap((sibling) => sibling.addrs.slice(0,
|
|
45
|
+
.flatMap((sibling) => sibling.addrs.slice(0, perSibling));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The `members` of a cadre invitation: the minting machine's own addresses first (at most
|
|
49
|
+
* {@link INVITATION_ADDRS_PER_SIBLING}), then the other machines' in
|
|
50
|
+
* {@link selectInvitationSiblingAddrs} order (at most {@link CADRE_INVITATION_ADDRS_PER_SIBLING}
|
|
51
|
+
* each), the whole list cut to {@link CADRE_INVITATION_MAX_ADDRS}. Each machine's addresses are
|
|
52
|
+
* ranked for a phone before they are cut ({@link rankForPhone}): libp2p reports a machine
|
|
53
|
+
* listening on every interface with its loopback and private addresses ahead of its relayed one.
|
|
54
|
+
*
|
|
55
|
+
* NOTE: accepted tradeoff — with two or more other machines, only the best two addresses of
|
|
56
|
+
* each survive, connected machines first, so a reachable address of a sibling can be cut. Size
|
|
57
|
+
* was weighed over completeness, so the text fits a QR code; revisit if redemptions are seen
|
|
58
|
+
* failing for want of a sibling address the record held.
|
|
59
|
+
*/
|
|
60
|
+
export function selectCadreInvitationMembers(own, siblings, connected) {
|
|
61
|
+
const ranked = siblings.map((sibling) => ({ ...sibling, addrs: rankForPhone(sibling.addrs) }));
|
|
62
|
+
return [
|
|
63
|
+
...rankForPhone(own).slice(0, INVITATION_ADDRS_PER_SIBLING),
|
|
64
|
+
...selectInvitationSiblingAddrs(ranked, connected, CADRE_INVITATION_ADDRS_PER_SIBLING),
|
|
65
|
+
].slice(0, CADRE_INVITATION_MAX_ADDRS);
|
|
66
|
+
}
|
|
67
|
+
/** Order in which a phone is likeliest to reach an address: from anywhere, on its network, on that machine, not at all. */
|
|
68
|
+
const PHONE_DIAL_RANK = { relay: 0, name: 0, public: 0, private: 1, loopback: 2 };
|
|
69
|
+
/** `addrs` best first for a phone dialing them ({@link PHONE_DIAL_RANK}), ties in their given order; one a phone cannot dial (plain TCP) last. */
|
|
70
|
+
function rankForPhone(addrs) {
|
|
71
|
+
const rankOf = (addr) => {
|
|
72
|
+
const kind = classifyDialAddress(addr);
|
|
73
|
+
return kind === undefined ? 3 : PHONE_DIAL_RANK[kind];
|
|
74
|
+
};
|
|
75
|
+
return addrs.map((addr) => ({ addr, rank: rankOf(addr) })).sort((a, b) => a.rank - b.rank).map(({ addr }) => addr);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Where a phone could redeem an invitation naming `members` from, judged on the machines other
|
|
79
|
+
* than `issuerPeerId`: in the app flows the minting app is the one closed or in the background
|
|
80
|
+
* when the other app redeems, and two apps on one phone cannot reach each other. An address
|
|
81
|
+
* names its machine by its last `/p2p/`.
|
|
82
|
+
*/
|
|
83
|
+
export function cadreInvitationReach(members, issuerPeerId) {
|
|
84
|
+
const others = members.flatMap((addr) => {
|
|
85
|
+
const kind = classifyDialAddress(addr);
|
|
86
|
+
// Classified, so it parses and `destinationPeerIdOf` cannot throw.
|
|
87
|
+
return kind === undefined || destinationPeerIdOf(addr) === issuerPeerId ? [] : [kind];
|
|
88
|
+
});
|
|
89
|
+
if (others.some((kind) => kind === 'relay' || kind === 'name' || kind === 'public'))
|
|
90
|
+
return 'anywhere';
|
|
91
|
+
return others.length > 0 ? 'local-network' : 'issuer-only';
|
|
29
92
|
}
|
|
30
93
|
//# sourceMappingURL=invitation-bootstrap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitation-bootstrap.js","sourceRoot":"","sources":["../src/invitation-bootstrap.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"invitation-bootstrap.js","sourceRoot":"","sources":["../src/invitation-bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAwB,MAAM,yBAAyB,CAAC;AAGzG;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAC7C,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC;AAE5C,sFAAsF;AACtF,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC;AAWpD;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAC3C,QAA6B,EAC7B,SAA8B,EAC9B,aAAqB,4BAA4B;IAEjD,OAAO,CAAC,GAAG,QAAQ,CAAC;SAClB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;SAC9G,KAAK,CAAC,CAAC,EAAE,2BAA2B,CAAC;SACrC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC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C,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AACpH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAA0B,EAAE,YAAoB;IACpF,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACvC,MAAM,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACvC,mEAAmE;QACnE,OAAO,IAAI,KAAK,SAAS,IAAI,mBAAmB,CAAC,IAAI,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACvF,CAAC,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,QAAQ,CAAC;QAAE,OAAO,UAAU,CAAC;IACvG,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,CAAC;AAC5D,CAAC"}
|
|
@@ -128,6 +128,13 @@ export declare class JoinedStrandSession {
|
|
|
128
128
|
* predate a leave the record re-joined after.
|
|
129
129
|
*/
|
|
130
130
|
withControlRows(control: readonly StrandRow[]): Promise<StrandRow[]>;
|
|
131
|
+
/**
|
|
132
|
+
* This machine's unpublished joins, straight from the store (never the last-good list a
|
|
133
|
+
* failed read stands in with). What a strand move exports beside the `JoinedStrand`
|
|
134
|
+
* table: a machine publishes only while it holds a control connection, so until then its
|
|
135
|
+
* joins live only here.
|
|
136
|
+
*/
|
|
137
|
+
unpublishedRecords(): Promise<JoinedStrandRecord[]>;
|
|
131
138
|
/** Record a join `formStrand` just made. A re-join also cancels a removal a revocation queued. */
|
|
132
139
|
remember(record: JoinedStrandRecord): Promise<void>;
|
|
133
140
|
/**
|
|
@@ -257,6 +257,15 @@ export class JoinedStrandSession {
|
|
|
257
257
|
}
|
|
258
258
|
return [...offered.values()];
|
|
259
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* This machine's unpublished joins, straight from the store (never the last-good list a
|
|
262
|
+
* failed read stands in with). What a strand move exports beside the `JoinedStrand`
|
|
263
|
+
* table: a machine publishes only while it holds a control connection, so until then its
|
|
264
|
+
* joins live only here.
|
|
265
|
+
*/
|
|
266
|
+
unpublishedRecords() {
|
|
267
|
+
return this.store.list();
|
|
268
|
+
}
|
|
260
269
|
/** Record a join `formStrand` just made. A re-join also cancels a removal a revocation queued. */
|
|
261
270
|
async remember(record) {
|
|
262
271
|
this.pendingRemovals.delete(record.Id);
|