wire-mesh-core 1.53.0 → 1.54.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/adapters/frame-codec.d.cts +1 -1
- package/dist/adapters/frame-codec.d.mts +1 -1
- package/dist/adapters/node-identity.d.cts +2 -2
- package/dist/adapters/node-identity.d.mts +2 -2
- package/dist/adapters/tcp-transport.d.cts +1 -1
- package/dist/adapters/tcp-transport.d.mts +1 -1
- package/dist/adapters/threshold-identity.d.cts +2 -2
- package/dist/adapters/threshold-identity.d.mts +2 -2
- package/dist/adapters/threshold-wasm.d.cts +1 -1
- package/dist/adapters/threshold-wasm.d.mts +1 -1
- package/dist/adapters/tls-transport.d.cts +1 -1
- package/dist/adapters/tls-transport.d.mts +1 -1
- package/dist/domain/bulk.d.cts +2 -2
- package/dist/domain/bulk.d.mts +2 -2
- package/dist/domain/capability-grant.d.cts +3 -3
- package/dist/domain/capability-grant.d.mts +3 -3
- package/dist/domain/capability-request.d.cts +2 -2
- package/dist/domain/capability-request.d.mts +2 -2
- package/dist/domain/data-sync.d.cts +2 -2
- package/dist/domain/data-sync.d.mts +2 -2
- package/dist/domain/device-id.d.cts +1 -1
- package/dist/domain/device-id.d.mts +1 -1
- package/dist/domain/grant-candidates.d.cts +1 -1
- package/dist/domain/grant-candidates.d.mts +1 -1
- package/dist/domain/handshake.d.cts +1 -1
- package/dist/domain/handshake.d.mts +1 -1
- package/dist/domain/mesh-session.cjs +67 -8
- package/dist/domain/mesh-session.d.cts +5 -3
- package/dist/domain/mesh-session.d.mts +5 -3
- package/dist/domain/mesh-session.mjs +67 -8
- package/dist/domain/notice-board.d.cts +3 -3
- package/dist/domain/notice-board.d.mts +3 -3
- package/dist/domain/relay-hub.cjs +6 -0
- package/dist/domain/relay-hub.d.cts +3 -3
- package/dist/domain/relay-hub.d.mts +3 -3
- package/dist/domain/relay-hub.mjs +6 -0
- package/dist/domain/relay-use-gate.d.cts +2 -2
- package/dist/domain/relay-use-gate.d.mts +2 -2
- package/dist/domain/revocation-view.d.cts +2 -2
- package/dist/domain/revocation-view.d.mts +2 -2
- package/dist/domain/room-rekey.d.cts +3 -3
- package/dist/domain/room-rekey.d.mts +3 -3
- package/dist/domain/room-token-verification.d.cts +1 -1
- package/dist/domain/room-token-verification.d.mts +1 -1
- package/dist/domain/room.d.cts +4 -4
- package/dist/domain/room.d.mts +4 -4
- package/dist/domain/shard-manifest.d.cts +1 -1
- package/dist/domain/shard-manifest.d.mts +1 -1
- package/dist/domain/tokens.d.cts +1 -1
- package/dist/domain/tokens.d.mts +1 -1
- package/dist/domain/webrtc-signaling.d.cts +2 -2
- package/dist/domain/webrtc-signaling.d.mts +2 -2
- package/dist/generated/protocol.cjs +12 -0
- package/dist/generated/protocol.d.cts +2 -2
- package/dist/generated/protocol.d.mts +2 -2
- package/dist/generated/protocol.mjs +10 -1
- package/dist/{identity-9TmmK7vP.d.mts → identity-BXrJ6_YM.d.mts} +1 -1
- package/dist/{identity-CUkDHCRK.d.cts → identity-CmD4l_Mp.d.cts} +1 -1
- package/dist/ports/identity.d.cts +1 -1
- package/dist/ports/identity.d.mts +1 -1
- package/dist/ports/transport.d.cts +1 -1
- package/dist/ports/transport.d.mts +1 -1
- package/dist/{protocol-CNFRVx9w.d.cts → protocol-PhUVprXA.d.cts} +34 -6
- package/dist/{protocol-CNFRVx9w.d.mts → protocol-PhUVprXA.d.mts} +34 -6
- package/dist/{room-token-verification-BdtM1rQ4.d.mts → room-token-verification-D8HndWYM.d.cts} +2 -2
- package/dist/{room-token-verification-DpOfZOdl.d.cts → room-token-verification-Dv1O6-FV.d.mts} +2 -2
- package/dist/{tokens-CVyPoJ6l.d.mts → tokens-BVrgBeqF.d.mts} +2 -2
- package/dist/{tokens-Cl8sQo7o.d.cts → tokens-DIPzZ9JJ.d.cts} +2 -2
- package/dist/{transport-C7KVkhgb.d.mts → transport-CbXX1Xd-.d.cts} +1 -1
- package/dist/{transport-De0zHlaA.d.cts → transport-DG9ouGe-.d.mts} +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, N as Frame,
|
|
1
|
+
import { D as DeviceId, N as Frame, ht as RelayDataFrame } from "../protocol-PhUVprXA.cjs";
|
|
2
2
|
//#region src/adapters/frame-codec.d.ts
|
|
3
3
|
export declare function messageFromFrame(frame: Frame): Uint8Array<ArrayBuffer>;
|
|
4
4
|
/** Wraps frame as a relay-data-frame's own opaque payload, stamping to-device when the caller knows which established pairing to address it to (wire-mesh#30) -- the outbound counterpart to tryDecodeFrame's own doc comment below, which describes the inbound side of the same relay-data envelope. Omitting toDevice leaves the frame unaddressed, which the receiving hub then routes via its own most-recently-established-pairing fallback. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, N as Frame,
|
|
1
|
+
import { D as DeviceId, N as Frame, ht as RelayDataFrame } from "../protocol-PhUVprXA.mjs";
|
|
2
2
|
//#region src/adapters/frame-codec.d.ts
|
|
3
3
|
export declare function messageFromFrame(frame: Frame): Uint8Array<ArrayBuffer>;
|
|
4
4
|
/** Wraps frame as a relay-data-frame's own opaque payload, stamping to-device when the caller knows which established pairing to address it to (wire-mesh#30) -- the outbound counterpart to tryDecodeFrame's own doc comment below, which describes the inbound side of the same relay-data envelope. Omitting toDevice leaves the frame unaddressed, which the receiving hub then routes via its own most-recently-established-pairing fallback. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as IdentityKey, D as DeviceId } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { B as IdentityKey, D as DeviceId } from "../protocol-PhUVprXA.cjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-CmD4l_Mp.cjs";
|
|
3
3
|
import { webcrypto } from "node:crypto";
|
|
4
4
|
//#region src/adapters/node-identity.d.ts
|
|
5
5
|
export declare function deriveDeviceId(publicKey: Uint8Array): Promise<DeviceId>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as IdentityKey, D as DeviceId } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { B as IdentityKey, D as DeviceId } from "../protocol-PhUVprXA.mjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-BXrJ6_YM.mjs";
|
|
3
3
|
import { webcrypto } from "node:crypto";
|
|
4
4
|
//#region src/adapters/node-identity.d.ts
|
|
5
5
|
export declare function deriveDeviceId(publicKey: Uint8Array): Promise<DeviceId>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as Transport } from "../transport-
|
|
1
|
+
import { r as Transport } from "../transport-CbXX1Xd-.cjs";
|
|
2
2
|
//#region src/adapters/tcp-transport.d.ts
|
|
3
3
|
/** A Node net.Socket-based Transport: length-prefixed, CBOR-encoded frames over plain TCP -- matching Cascade's own transport shape, since interop with Cascade nodes is wire-mesh's stated goal. Framing (not TLS) is this adapter's own concern; a TLS-terminated variant is a separate adapter behind the same Transport contract. */
|
|
4
4
|
export declare function createTcpTransport(): Transport;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as Transport } from "../transport-
|
|
1
|
+
import { r as Transport } from "../transport-DG9ouGe-.mjs";
|
|
2
2
|
//#region src/adapters/tcp-transport.d.ts
|
|
3
3
|
/** A Node net.Socket-based Transport: length-prefixed, CBOR-encoded frames over plain TCP -- matching Cascade's own transport shape, since interop with Cascade nodes is wire-mesh's stated goal. Framing (not TLS) is this adapter's own concern; a TLS-terminated variant is a separate adapter behind the same Transport contract. */
|
|
4
4
|
export declare function createTcpTransport(): Transport;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId } from "../protocol-PhUVprXA.cjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-CmD4l_Mp.cjs";
|
|
3
3
|
import { DeviceKeyed } from "./threshold-wasm.cjs";
|
|
4
4
|
import { ThresholdSubject } from "../domain/threshold-subject.cjs";
|
|
5
5
|
//#region src/adapters/threshold-identity.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId } from "../protocol-PhUVprXA.mjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-BXrJ6_YM.mjs";
|
|
3
3
|
import { DeviceKeyed } from "./threshold-wasm.mjs";
|
|
4
4
|
import { ThresholdSubject } from "../domain/threshold-subject.mjs";
|
|
5
5
|
//#region src/adapters/threshold-identity.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId } from "../protocol-
|
|
1
|
+
import { D as DeviceId } from "../protocol-PhUVprXA.cjs";
|
|
2
2
|
//#region src/adapters/threshold-wasm.d.ts
|
|
3
3
|
/** One `(deviceId, bytes)` pair -- the wasm boundary's own encoding of a map keyed by participant, since wasm-bindgen has no built-in `Map<Uint8Array, Uint8Array>` marshalling. */
|
|
4
4
|
export interface DeviceKeyed<T extends Uint8Array = Uint8Array<ArrayBuffer>> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId } from "../protocol-
|
|
1
|
+
import { D as DeviceId } from "../protocol-PhUVprXA.mjs";
|
|
2
2
|
//#region src/adapters/threshold-wasm.d.ts
|
|
3
3
|
/** One `(deviceId, bytes)` pair -- the wasm boundary's own encoding of a map keyed by participant, since wasm-bindgen has no built-in `Map<Uint8Array, Uint8Array>` marshalling. */
|
|
4
4
|
export interface DeviceKeyed<T extends Uint8Array = Uint8Array<ArrayBuffer>> {
|
package/dist/domain/bulk.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DeviceId, N as Frame, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-
|
|
1
|
+
import { D as DeviceId, N as Frame, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-PhUVprXA.cjs";
|
|
2
2
|
import { KeyValueStorage } from "../ports/storage.cjs";
|
|
3
|
-
import { t as Connection } from "../transport-
|
|
3
|
+
import { t as Connection } from "../transport-CbXX1Xd-.cjs";
|
|
4
4
|
import { IncomingManageRequest, MeshSession } from "./mesh-session.cjs";
|
|
5
5
|
//#region src/domain/bulk.d.ts
|
|
6
6
|
/** The two capabilities matching the direction each manage-command actually flows (spec/bulk.cddl): the sender proves write authority to open a transfer, the receiver proves read authority to ask for one to continue. */
|
package/dist/domain/bulk.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DeviceId, N as Frame, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-
|
|
1
|
+
import { D as DeviceId, N as Frame, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-PhUVprXA.mjs";
|
|
2
2
|
import { KeyValueStorage } from "../ports/storage.mjs";
|
|
3
|
-
import { t as Connection } from "../transport-
|
|
3
|
+
import { t as Connection } from "../transport-DG9ouGe-.mjs";
|
|
4
4
|
import { IncomingManageRequest, MeshSession } from "./mesh-session.mjs";
|
|
5
5
|
//#region src/domain/bulk.d.ts
|
|
6
6
|
/** The two capabilities matching the direction each manage-command actually flows (spec/bulk.cddl): the sender proves write authority to open a transfer, the receiver proves read authority to ask for one to continue. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-PhUVprXA.cjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-CmD4l_Mp.cjs";
|
|
3
3
|
import { t as Clock } from "../clock-DiSx-WKM.cjs";
|
|
4
4
|
import { IncomingManageRequest, ManageOutcome, MeshSession } from "./mesh-session.cjs";
|
|
5
|
-
import { a as RevocationCheck } from "../tokens-
|
|
5
|
+
import { a as RevocationCheck } from "../tokens-DIPzZ9JJ.cjs";
|
|
6
6
|
//#region src/domain/capability-grant.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* Builds a capability-grant command per management.cddl. The outer `manage-command.verb` is the capability string itself, the identical convention capability-request.ts's own buildCapabilityRequestCommand already establishes -- a receiver's per-capability handler is how it knows which grant this push is even for. `params.verb` is the fixed "capability.grant" marker. No scope or invitee field: manage-request-frame's own top-level scope already carries the former, and the request's own destination already carries the latter -- naming either a second time inside params could only ever disagree with the fact it duplicates.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-PhUVprXA.mjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-BXrJ6_YM.mjs";
|
|
3
3
|
import { t as Clock } from "../clock-DiSx-WKM.mjs";
|
|
4
4
|
import { IncomingManageRequest, ManageOutcome, MeshSession } from "./mesh-session.mjs";
|
|
5
|
-
import { a as RevocationCheck } from "../tokens-
|
|
5
|
+
import { a as RevocationCheck } from "../tokens-BVrgBeqF.mjs";
|
|
6
6
|
//#region src/domain/capability-grant.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* Builds a capability-grant command per management.cddl. The outer `manage-command.verb` is the capability string itself, the identical convention capability-request.ts's own buildCapabilityRequestCommand already establishes -- a receiver's per-capability handler is how it knows which grant this push is even for. `params.verb` is the fixed "capability.grant" marker. No scope or invitee field: manage-request-frame's own top-level scope already carries the former, and the request's own destination already carries the latter -- naming either a second time inside params could only ever disagree with the fact it duplicates.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, u as CapabilityGrantOk } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, u as CapabilityGrantOk } from "../protocol-PhUVprXA.cjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-CmD4l_Mp.cjs";
|
|
3
3
|
import { t as Clock } from "../clock-DiSx-WKM.cjs";
|
|
4
4
|
import { IncomingManageRequest, MeshSession } from "./mesh-session.cjs";
|
|
5
5
|
//#region src/domain/capability-request.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, u as CapabilityGrantOk } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, u as CapabilityGrantOk } from "../protocol-PhUVprXA.mjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-BXrJ6_YM.mjs";
|
|
3
3
|
import { t as Clock } from "../clock-DiSx-WKM.mjs";
|
|
4
4
|
import { IncomingManageRequest, MeshSession } from "./mesh-session.mjs";
|
|
5
5
|
//#region src/domain/capability-request.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DeviceId, E as DataRequestFrame, T as DataHaveFrame, w as DataEntriesFrame } from "../protocol-
|
|
1
|
+
import { D as DeviceId, E as DataRequestFrame, T as DataHaveFrame, w as DataEntriesFrame } from "../protocol-PhUVprXA.cjs";
|
|
2
2
|
import { KeyValueStorage } from "../ports/storage.cjs";
|
|
3
|
-
import { t as IdentityPort } from "../identity-
|
|
3
|
+
import { t as IdentityPort } from "../identity-CmD4l_Mp.cjs";
|
|
4
4
|
//#region src/domain/data-sync.d.ts
|
|
5
5
|
export interface DataSyncOptions {
|
|
6
6
|
identity: IdentityPort;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DeviceId, E as DataRequestFrame, T as DataHaveFrame, w as DataEntriesFrame } from "../protocol-
|
|
1
|
+
import { D as DeviceId, E as DataRequestFrame, T as DataHaveFrame, w as DataEntriesFrame } from "../protocol-PhUVprXA.mjs";
|
|
2
2
|
import { KeyValueStorage } from "../ports/storage.mjs";
|
|
3
|
-
import { t as IdentityPort } from "../identity-
|
|
3
|
+
import { t as IdentityPort } from "../identity-BXrJ6_YM.mjs";
|
|
4
4
|
//#region src/domain/data-sync.d.ts
|
|
5
5
|
export interface DataSyncOptions {
|
|
6
6
|
identity: IdentityPort;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId } from "../protocol-
|
|
1
|
+
import { D as DeviceId } from "../protocol-PhUVprXA.cjs";
|
|
2
2
|
//#region src/domain/device-id.d.ts
|
|
3
3
|
/** Lowercase, byte-exact hex for an arbitrary-length byte string -- the same encoding convention deviceIdToHex uses for the fixed-length device-id case, extracted so any other byte string needing a stable, displayable, map-keyable text form (e.g. a token-id, which tokens.cddl defines as an arbitrary-length bstr rather than a 32-byte device-id) can use the identical convention without going through a device-id-shaped function. */
|
|
4
4
|
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId } from "../protocol-
|
|
1
|
+
import { D as DeviceId } from "../protocol-PhUVprXA.mjs";
|
|
2
2
|
//#region src/domain/device-id.d.ts
|
|
3
3
|
/** Lowercase, byte-exact hex for an arbitrary-length byte string -- the same encoding convention deviceIdToHex uses for the fixed-length device-id case, extracted so any other byte string needing a stable, displayable, map-keyable text form (e.g. a token-id, which tokens.cddl defines as an arbitrary-length bstr rather than a 32-byte device-id) can use the identical convention without going through a device-id-shaped function. */
|
|
4
4
|
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, f as CapabilityScope } from "../protocol-
|
|
1
|
+
import { D as DeviceId, f as CapabilityScope } from "../protocol-PhUVprXA.cjs";
|
|
2
2
|
import { DirectoryEntry, MeshSession } from "./mesh-session.cjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/domain/grant-candidates.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, f as CapabilityScope } from "../protocol-
|
|
1
|
+
import { D as DeviceId, f as CapabilityScope } from "../protocol-PhUVprXA.mjs";
|
|
2
2
|
import { DirectoryEntry, MeshSession } from "./mesh-session.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/domain/grant-candidates.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as DomainId, R as HandshakeFrame,
|
|
1
|
+
import { A as DomainId, R as HandshakeFrame, lt as ProtocolVersion } from "../protocol-PhUVprXA.cjs";
|
|
2
2
|
//#region src/domain/handshake.d.ts
|
|
3
3
|
/** The highest protocol version this build of core understands. */
|
|
4
4
|
export declare const SUPPORTED_PROTOCOL_VERSION: ProtocolVersion;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as DomainId, R as HandshakeFrame,
|
|
1
|
+
import { A as DomainId, R as HandshakeFrame, lt as ProtocolVersion } from "../protocol-PhUVprXA.mjs";
|
|
2
2
|
//#region src/domain/handshake.d.ts
|
|
3
3
|
/** The highest protocol version this build of core understands. */
|
|
4
4
|
export declare const SUPPORTED_PROTOCOL_VERSION: ProtocolVersion;
|
|
@@ -13,8 +13,43 @@ function createRelayPairings() {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
|
-
//#region src/domain/
|
|
17
|
-
|
|
16
|
+
//#region src/domain/ping-round-trips.ts
|
|
17
|
+
function createPingRoundTrips() {
|
|
18
|
+
const pending = [];
|
|
19
|
+
function cancel(sentAt) {
|
|
20
|
+
const index = pending.findIndex((entry) => entry.sentAt === sentAt);
|
|
21
|
+
if (index === -1) return false;
|
|
22
|
+
pending.splice(index, 1);
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
resolveOldest(nowMs) {
|
|
27
|
+
const entry = pending.shift();
|
|
28
|
+
if (entry !== void 0) entry.resolve(nowMs - entry.sentAt);
|
|
29
|
+
},
|
|
30
|
+
rejectAll(reason) {
|
|
31
|
+
for (const entry of pending.splice(0)) entry.reject(new Error(reason));
|
|
32
|
+
},
|
|
33
|
+
async sendAndAwait(sentAt, sendPing, timeoutMs) {
|
|
34
|
+
const rtt = new Promise((resolve, reject) => {
|
|
35
|
+
pending.push({
|
|
36
|
+
sentAt,
|
|
37
|
+
resolve,
|
|
38
|
+
reject
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
await sendPing();
|
|
42
|
+
if (timeoutMs === void 0) return rtt;
|
|
43
|
+
return Promise.race([rtt, new Promise((_resolve, reject) => {
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
if (cancel(sentAt)) reject(/* @__PURE__ */ new Error("timed out waiting for pong"));
|
|
46
|
+
}, timeoutMs);
|
|
47
|
+
})]);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/domain/gossip-extensions.ts
|
|
18
53
|
/** peer-advert's own three typed fields -- reserved so a `sendGossipUpdate` caller can never override the session's own device-id, address list, or freshness timestamp by supplying an extension of the same name. */
|
|
19
54
|
const RESERVED_PEER_ADVERT_KEYS = /* @__PURE__ */ new Set([
|
|
20
55
|
"device",
|
|
@@ -30,6 +65,9 @@ function validateGossipExtensions(extensions) {
|
|
|
30
65
|
if (!GOSSIP_EXTENSION_KEY_PATTERN.test(key)) throw new Error(`sendGossipUpdate extension key "${key}" must be domain-qualified as "<domain>/<field>" (e.g. "presence/status")`);
|
|
31
66
|
}
|
|
32
67
|
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/domain/mesh-session.ts
|
|
70
|
+
const MS_PER_SECOND = 1e3;
|
|
33
71
|
/** How long to wait for the node's handshake before calling it unanswered. A relay-only node never sends one; that is a state to display, not an error. */
|
|
34
72
|
const HANDSHAKE_TIMEOUT_MS = 3e3;
|
|
35
73
|
function localHandshake(domains) {
|
|
@@ -62,6 +100,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
62
100
|
const incomingBacklog = [];
|
|
63
101
|
const revocationWaiters = [];
|
|
64
102
|
const revocationBacklog = [];
|
|
103
|
+
const pingRoundTrips = createPingRoundTrips();
|
|
65
104
|
function snapshot() {
|
|
66
105
|
return {
|
|
67
106
|
state,
|
|
@@ -101,6 +140,11 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
101
140
|
...token !== null ? { token } : {}
|
|
102
141
|
};
|
|
103
142
|
}
|
|
143
|
+
/** The "not connected" guard every send* method on the public session needs, deduplicated into one place rather than repeated inline at each call site: throws unless there is a live connection AND the session's own state machine agrees it is "connected" (transmit's own connection===null check alone doesn't cover the latter). Returns the connection itself, narrowed non-null, for a caller that needs to send directly on it (sendPing/sendPingMeasureRtt); a caller that only needs the throwing side effect (sendManageRequest and friends, which go through transmit instead) calls this and discards the result. */
|
|
144
|
+
function requireConnectedLink() {
|
|
145
|
+
if (connection === null || state.status !== "connected") throw new Error("not connected");
|
|
146
|
+
return connection;
|
|
147
|
+
}
|
|
104
148
|
/** Sends a frame, wrapping it as relay-data first when viaRelay is set -- the single choke point every outbound manage-request/manage-response passes through, so a consumer of sendManageRequest/respond never needs its own relay-wrapping logic. When relaying, toDevice is stamped onto the outer relay-data-frame's own `to-device` field so the hub addresses it to the correct pairing directly (wire-mesh#30) rather than falling back to whichever pairing it last saw -- the one case this is omitted is a response to a request that itself arrived with no from-device to echo back, which is left to that same hub fallback exactly as an unaddressed relay-data always has been. */
|
|
105
149
|
async function transmit(frame, viaRelay, toDevice) {
|
|
106
150
|
if (connection === null) throw new Error("not connected");
|
|
@@ -178,6 +222,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
178
222
|
else if (frame.type === "relay-inbound") relayPairings.add(frame["source-device"]);
|
|
179
223
|
else if (frame.type === "manage-response") applyManageResponse(frame);
|
|
180
224
|
else if (frame.type === "manage-request") applyManageRequest(frame);
|
|
225
|
+
else if (frame.type === "pong") pingRoundTrips.resolveOldest(clock.now());
|
|
181
226
|
else if (frame.type === "revocation-announce") for (const entry of frame.entries) emitRevocationEntry(entry);
|
|
182
227
|
}
|
|
183
228
|
/** Establishes a relay-connect pairing to targetDevice if this session isn't already paired with it -- a no-op when it already is, whether that pairing was established by this session's own prior relay-connect (initiator role) or learned from an incoming relay-inbound (target role, replying back to whoever dialed it). Pairing with a new target never tears down an existing pairing with a different one: this connection can hold several simultaneously (wire-mesh#30's own multiplexed adjacency map), so a later request back to an already-paired target must not re-send relay-connect for it. relay-connect has no ack frame: the initiator proceeds to relay-data right after sending it. */
|
|
@@ -220,6 +265,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
220
265
|
function handleDisconnect(reason, address, localDomains) {
|
|
221
266
|
if (feedCancelled) return;
|
|
222
267
|
rejectPendingManageRequests("disconnected before a response arrived");
|
|
268
|
+
pingRoundTrips.rejectAll("disconnected before a pong arrived");
|
|
223
269
|
if (reconnect !== null && attempt < reconnect.maxAttempts) {
|
|
224
270
|
attempt += 1;
|
|
225
271
|
const currentAttempt = attempt;
|
|
@@ -378,20 +424,32 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
378
424
|
await doConnect(address, localDomains);
|
|
379
425
|
},
|
|
380
426
|
async sendPing() {
|
|
381
|
-
|
|
427
|
+
const link = requireConnectedLink();
|
|
382
428
|
const ping = { type: "ping" };
|
|
383
429
|
frameLog.push({
|
|
384
430
|
direction: "sent",
|
|
385
431
|
frame: ping
|
|
386
432
|
});
|
|
387
|
-
await
|
|
433
|
+
await link.send(ping);
|
|
388
434
|
emit();
|
|
389
435
|
},
|
|
436
|
+
async sendPingMeasureRtt(timeoutMs) {
|
|
437
|
+
const link = requireConnectedLink();
|
|
438
|
+
return pingRoundTrips.sendAndAwait(clock.now(), async () => {
|
|
439
|
+
const ping = { type: "ping" };
|
|
440
|
+
frameLog.push({
|
|
441
|
+
direction: "sent",
|
|
442
|
+
frame: ping
|
|
443
|
+
});
|
|
444
|
+
await link.send(ping);
|
|
445
|
+
emit();
|
|
446
|
+
}, timeoutMs);
|
|
447
|
+
},
|
|
390
448
|
setToken(token) {
|
|
391
449
|
currentToken = token;
|
|
392
450
|
},
|
|
393
451
|
async sendManageRequest(command, scope, targetDevice, token, timeoutMs) {
|
|
394
|
-
|
|
452
|
+
requireConnectedLink();
|
|
395
453
|
if (targetDevice !== void 0) await ensureRelayPairing(targetDevice);
|
|
396
454
|
const frame = buildManageRequest(command, scope, token);
|
|
397
455
|
const requestId = frame["request-id"];
|
|
@@ -418,7 +476,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
418
476
|
})]);
|
|
419
477
|
},
|
|
420
478
|
async sendRevocationAnnounce(entries) {
|
|
421
|
-
|
|
479
|
+
requireConnectedLink();
|
|
422
480
|
const frame = {
|
|
423
481
|
type: "revocation-announce",
|
|
424
482
|
entries: [...entries]
|
|
@@ -431,7 +489,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
431
489
|
emit();
|
|
432
490
|
},
|
|
433
491
|
async sendGossipUpdate(extensions) {
|
|
434
|
-
|
|
492
|
+
requireConnectedLink();
|
|
435
493
|
const frame = buildSelfAdvert(extensions);
|
|
436
494
|
frameLog.push({
|
|
437
495
|
direction: "sent",
|
|
@@ -441,7 +499,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
441
499
|
emit();
|
|
442
500
|
},
|
|
443
501
|
async sendDataFrame(frame) {
|
|
444
|
-
|
|
502
|
+
requireConnectedLink();
|
|
445
503
|
frameLog.push({
|
|
446
504
|
direction: "sent",
|
|
447
505
|
frame
|
|
@@ -460,6 +518,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
460
518
|
reconnectTimer = null;
|
|
461
519
|
}
|
|
462
520
|
rejectPendingManageRequests("connection closed before a response arrived");
|
|
521
|
+
pingRoundTrips.rejectAll("connection closed before a pong arrived");
|
|
463
522
|
if (connection !== null) await connection.close();
|
|
464
523
|
if (state.status === "connected" || state.status === "connecting" || state.status === "reconnecting") state = {
|
|
465
524
|
status: "closed",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { D as DeviceId, E as DataRequestFrame, N as Frame,
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId, E as DataRequestFrame, N as Frame, T as DataHaveFrame, U as ManageError, V as ManageCommand, W as ManageOk, bt as RevocationEntry, et as PeerAdvert, f as CapabilityScope, lt as ProtocolVersion, p as CapabilityToken, w as DataEntriesFrame } from "../protocol-PhUVprXA.cjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-CmD4l_Mp.cjs";
|
|
3
3
|
import { t as Clock } from "../clock-DiSx-WKM.cjs";
|
|
4
|
-
import { r as Transport, t as Connection } from "../transport-
|
|
4
|
+
import { r as Transport, t as Connection } from "../transport-CbXX1Xd-.cjs";
|
|
5
5
|
//#region src/domain/mesh-session.d.ts
|
|
6
6
|
/** How long to wait for the node's handshake before calling it unanswered. A relay-only node never sends one; that is a state to display, not an error. */
|
|
7
7
|
export declare const HANDSHAKE_TIMEOUT_MS = 3000;
|
|
@@ -79,6 +79,8 @@ export interface MeshSession {
|
|
|
79
79
|
readonly revocationAnnouncements: AsyncIterable<RevocationEntry>;
|
|
80
80
|
connect: (address: string, localDomains: readonly string[]) => Promise<void>;
|
|
81
81
|
sendPing: () => Promise<void>;
|
|
82
|
+
/** Sends a ping-frame and resolves with the round-trip time in milliseconds once the correlated pong-frame arrives -- FIFO-paired against this call's own ping, since ping-frame carries no correlation id of its own (spec/transport.cddl): the Nth call's own promise resolves against the Nth pong received after it, never matched by any other means. Rejects if the connection closes, or (when timeoutMs is given) if no pong arrives within timeoutMs, rather than resolving a sentinel value the way sendManageRequest's own timeout does -- there is no natural "no answer" value for a bare millisecond count to double as. Unlike sendPing (fire-and-forget, answered by nothing on an ordinary peer connection), this is answered only by a peer that replies to ping with pong -- today, relay-hub's own frame handling (wire-mesh#181) -- so calling this against a connection to a plain peer that never sends pong hangs until timeoutMs (if given) or forever. Exists to isolate the sender-to-hub leg of a relayed path.trace round trip: time this over the same connection a relayed manage-request travelled, then subtract it from path.trace's own end-to-end RTT to recover the hub-to-target leg. */
|
|
83
|
+
sendPingMeasureRtt: (timeoutMs?: number) => Promise<number>;
|
|
82
84
|
/** Attaches this token to every `manage-request` sent from now on. */
|
|
83
85
|
setToken: (token: CapabilityToken) => void;
|
|
84
86
|
/** Announces one or more already-minted revocation-entries to the peer. Sent directly over the connection, never relay-wrapped -- revocation-announce is a gossiped broadcast, not a request addressed to a specific peer, so it has no targetDevice/token parameters the way sendManageRequest does. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { D as DeviceId, E as DataRequestFrame, N as Frame,
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId, E as DataRequestFrame, N as Frame, T as DataHaveFrame, U as ManageError, V as ManageCommand, W as ManageOk, bt as RevocationEntry, et as PeerAdvert, f as CapabilityScope, lt as ProtocolVersion, p as CapabilityToken, w as DataEntriesFrame } from "../protocol-PhUVprXA.mjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-BXrJ6_YM.mjs";
|
|
3
3
|
import { t as Clock } from "../clock-DiSx-WKM.mjs";
|
|
4
|
-
import { r as Transport, t as Connection } from "../transport-
|
|
4
|
+
import { r as Transport, t as Connection } from "../transport-DG9ouGe-.mjs";
|
|
5
5
|
//#region src/domain/mesh-session.d.ts
|
|
6
6
|
/** How long to wait for the node's handshake before calling it unanswered. A relay-only node never sends one; that is a state to display, not an error. */
|
|
7
7
|
export declare const HANDSHAKE_TIMEOUT_MS = 3000;
|
|
@@ -79,6 +79,8 @@ export interface MeshSession {
|
|
|
79
79
|
readonly revocationAnnouncements: AsyncIterable<RevocationEntry>;
|
|
80
80
|
connect: (address: string, localDomains: readonly string[]) => Promise<void>;
|
|
81
81
|
sendPing: () => Promise<void>;
|
|
82
|
+
/** Sends a ping-frame and resolves with the round-trip time in milliseconds once the correlated pong-frame arrives -- FIFO-paired against this call's own ping, since ping-frame carries no correlation id of its own (spec/transport.cddl): the Nth call's own promise resolves against the Nth pong received after it, never matched by any other means. Rejects if the connection closes, or (when timeoutMs is given) if no pong arrives within timeoutMs, rather than resolving a sentinel value the way sendManageRequest's own timeout does -- there is no natural "no answer" value for a bare millisecond count to double as. Unlike sendPing (fire-and-forget, answered by nothing on an ordinary peer connection), this is answered only by a peer that replies to ping with pong -- today, relay-hub's own frame handling (wire-mesh#181) -- so calling this against a connection to a plain peer that never sends pong hangs until timeoutMs (if given) or forever. Exists to isolate the sender-to-hub leg of a relayed path.trace round trip: time this over the same connection a relayed manage-request travelled, then subtract it from path.trace's own end-to-end RTT to recover the hub-to-target leg. */
|
|
83
|
+
sendPingMeasureRtt: (timeoutMs?: number) => Promise<number>;
|
|
82
84
|
/** Attaches this token to every `manage-request` sent from now on. */
|
|
83
85
|
setToken: (token: CapabilityToken) => void;
|
|
84
86
|
/** Announces one or more already-minted revocation-entries to the peer. Sent directly over the connection, never relay-wrapped -- revocation-announce is a gossiped broadcast, not a request addressed to a specific peer, so it has no targetDevice/token parameters the way sendManageRequest does. */
|
|
@@ -12,8 +12,43 @@ function createRelayPairings() {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
//#endregion
|
|
15
|
-
//#region src/domain/
|
|
16
|
-
|
|
15
|
+
//#region src/domain/ping-round-trips.ts
|
|
16
|
+
function createPingRoundTrips() {
|
|
17
|
+
const pending = [];
|
|
18
|
+
function cancel(sentAt) {
|
|
19
|
+
const index = pending.findIndex((entry) => entry.sentAt === sentAt);
|
|
20
|
+
if (index === -1) return false;
|
|
21
|
+
pending.splice(index, 1);
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
resolveOldest(nowMs) {
|
|
26
|
+
const entry = pending.shift();
|
|
27
|
+
if (entry !== void 0) entry.resolve(nowMs - entry.sentAt);
|
|
28
|
+
},
|
|
29
|
+
rejectAll(reason) {
|
|
30
|
+
for (const entry of pending.splice(0)) entry.reject(new Error(reason));
|
|
31
|
+
},
|
|
32
|
+
async sendAndAwait(sentAt, sendPing, timeoutMs) {
|
|
33
|
+
const rtt = new Promise((resolve, reject) => {
|
|
34
|
+
pending.push({
|
|
35
|
+
sentAt,
|
|
36
|
+
resolve,
|
|
37
|
+
reject
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
await sendPing();
|
|
41
|
+
if (timeoutMs === void 0) return rtt;
|
|
42
|
+
return Promise.race([rtt, new Promise((_resolve, reject) => {
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
if (cancel(sentAt)) reject(/* @__PURE__ */ new Error("timed out waiting for pong"));
|
|
45
|
+
}, timeoutMs);
|
|
46
|
+
})]);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/domain/gossip-extensions.ts
|
|
17
52
|
/** peer-advert's own three typed fields -- reserved so a `sendGossipUpdate` caller can never override the session's own device-id, address list, or freshness timestamp by supplying an extension of the same name. */
|
|
18
53
|
const RESERVED_PEER_ADVERT_KEYS = /* @__PURE__ */ new Set([
|
|
19
54
|
"device",
|
|
@@ -29,6 +64,9 @@ function validateGossipExtensions(extensions) {
|
|
|
29
64
|
if (!GOSSIP_EXTENSION_KEY_PATTERN.test(key)) throw new Error(`sendGossipUpdate extension key "${key}" must be domain-qualified as "<domain>/<field>" (e.g. "presence/status")`);
|
|
30
65
|
}
|
|
31
66
|
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/domain/mesh-session.ts
|
|
69
|
+
const MS_PER_SECOND = 1e3;
|
|
32
70
|
/** How long to wait for the node's handshake before calling it unanswered. A relay-only node never sends one; that is a state to display, not an error. */
|
|
33
71
|
const HANDSHAKE_TIMEOUT_MS = 3e3;
|
|
34
72
|
function localHandshake(domains) {
|
|
@@ -61,6 +99,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
61
99
|
const incomingBacklog = [];
|
|
62
100
|
const revocationWaiters = [];
|
|
63
101
|
const revocationBacklog = [];
|
|
102
|
+
const pingRoundTrips = createPingRoundTrips();
|
|
64
103
|
function snapshot() {
|
|
65
104
|
return {
|
|
66
105
|
state,
|
|
@@ -100,6 +139,11 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
100
139
|
...token !== null ? { token } : {}
|
|
101
140
|
};
|
|
102
141
|
}
|
|
142
|
+
/** The "not connected" guard every send* method on the public session needs, deduplicated into one place rather than repeated inline at each call site: throws unless there is a live connection AND the session's own state machine agrees it is "connected" (transmit's own connection===null check alone doesn't cover the latter). Returns the connection itself, narrowed non-null, for a caller that needs to send directly on it (sendPing/sendPingMeasureRtt); a caller that only needs the throwing side effect (sendManageRequest and friends, which go through transmit instead) calls this and discards the result. */
|
|
143
|
+
function requireConnectedLink() {
|
|
144
|
+
if (connection === null || state.status !== "connected") throw new Error("not connected");
|
|
145
|
+
return connection;
|
|
146
|
+
}
|
|
103
147
|
/** Sends a frame, wrapping it as relay-data first when viaRelay is set -- the single choke point every outbound manage-request/manage-response passes through, so a consumer of sendManageRequest/respond never needs its own relay-wrapping logic. When relaying, toDevice is stamped onto the outer relay-data-frame's own `to-device` field so the hub addresses it to the correct pairing directly (wire-mesh#30) rather than falling back to whichever pairing it last saw -- the one case this is omitted is a response to a request that itself arrived with no from-device to echo back, which is left to that same hub fallback exactly as an unaddressed relay-data always has been. */
|
|
104
148
|
async function transmit(frame, viaRelay, toDevice) {
|
|
105
149
|
if (connection === null) throw new Error("not connected");
|
|
@@ -177,6 +221,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
177
221
|
else if (frame.type === "relay-inbound") relayPairings.add(frame["source-device"]);
|
|
178
222
|
else if (frame.type === "manage-response") applyManageResponse(frame);
|
|
179
223
|
else if (frame.type === "manage-request") applyManageRequest(frame);
|
|
224
|
+
else if (frame.type === "pong") pingRoundTrips.resolveOldest(clock.now());
|
|
180
225
|
else if (frame.type === "revocation-announce") for (const entry of frame.entries) emitRevocationEntry(entry);
|
|
181
226
|
}
|
|
182
227
|
/** Establishes a relay-connect pairing to targetDevice if this session isn't already paired with it -- a no-op when it already is, whether that pairing was established by this session's own prior relay-connect (initiator role) or learned from an incoming relay-inbound (target role, replying back to whoever dialed it). Pairing with a new target never tears down an existing pairing with a different one: this connection can hold several simultaneously (wire-mesh#30's own multiplexed adjacency map), so a later request back to an already-paired target must not re-send relay-connect for it. relay-connect has no ack frame: the initiator proceeds to relay-data right after sending it. */
|
|
@@ -219,6 +264,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
219
264
|
function handleDisconnect(reason, address, localDomains) {
|
|
220
265
|
if (feedCancelled) return;
|
|
221
266
|
rejectPendingManageRequests("disconnected before a response arrived");
|
|
267
|
+
pingRoundTrips.rejectAll("disconnected before a pong arrived");
|
|
222
268
|
if (reconnect !== null && attempt < reconnect.maxAttempts) {
|
|
223
269
|
attempt += 1;
|
|
224
270
|
const currentAttempt = attempt;
|
|
@@ -377,20 +423,32 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
377
423
|
await doConnect(address, localDomains);
|
|
378
424
|
},
|
|
379
425
|
async sendPing() {
|
|
380
|
-
|
|
426
|
+
const link = requireConnectedLink();
|
|
381
427
|
const ping = { type: "ping" };
|
|
382
428
|
frameLog.push({
|
|
383
429
|
direction: "sent",
|
|
384
430
|
frame: ping
|
|
385
431
|
});
|
|
386
|
-
await
|
|
432
|
+
await link.send(ping);
|
|
387
433
|
emit();
|
|
388
434
|
},
|
|
435
|
+
async sendPingMeasureRtt(timeoutMs) {
|
|
436
|
+
const link = requireConnectedLink();
|
|
437
|
+
return pingRoundTrips.sendAndAwait(clock.now(), async () => {
|
|
438
|
+
const ping = { type: "ping" };
|
|
439
|
+
frameLog.push({
|
|
440
|
+
direction: "sent",
|
|
441
|
+
frame: ping
|
|
442
|
+
});
|
|
443
|
+
await link.send(ping);
|
|
444
|
+
emit();
|
|
445
|
+
}, timeoutMs);
|
|
446
|
+
},
|
|
389
447
|
setToken(token) {
|
|
390
448
|
currentToken = token;
|
|
391
449
|
},
|
|
392
450
|
async sendManageRequest(command, scope, targetDevice, token, timeoutMs) {
|
|
393
|
-
|
|
451
|
+
requireConnectedLink();
|
|
394
452
|
if (targetDevice !== void 0) await ensureRelayPairing(targetDevice);
|
|
395
453
|
const frame = buildManageRequest(command, scope, token);
|
|
396
454
|
const requestId = frame["request-id"];
|
|
@@ -417,7 +475,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
417
475
|
})]);
|
|
418
476
|
},
|
|
419
477
|
async sendRevocationAnnounce(entries) {
|
|
420
|
-
|
|
478
|
+
requireConnectedLink();
|
|
421
479
|
const frame = {
|
|
422
480
|
type: "revocation-announce",
|
|
423
481
|
entries: [...entries]
|
|
@@ -430,7 +488,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
430
488
|
emit();
|
|
431
489
|
},
|
|
432
490
|
async sendGossipUpdate(extensions) {
|
|
433
|
-
|
|
491
|
+
requireConnectedLink();
|
|
434
492
|
const frame = buildSelfAdvert(extensions);
|
|
435
493
|
frameLog.push({
|
|
436
494
|
direction: "sent",
|
|
@@ -440,7 +498,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
440
498
|
emit();
|
|
441
499
|
},
|
|
442
500
|
async sendDataFrame(frame) {
|
|
443
|
-
|
|
501
|
+
requireConnectedLink();
|
|
444
502
|
frameLog.push({
|
|
445
503
|
direction: "sent",
|
|
446
504
|
frame
|
|
@@ -459,6 +517,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
|
|
|
459
517
|
reconnectTimer = null;
|
|
460
518
|
}
|
|
461
519
|
rejectPendingManageRequests("connection closed before a response arrived");
|
|
520
|
+
pingRoundTrips.rejectAll("connection closed before a pong arrived");
|
|
462
521
|
if (connection !== null) await connection.close();
|
|
463
522
|
if (state.status === "connected" || state.status === "connecting" || state.status === "reconnecting") state = {
|
|
464
523
|
status: "closed",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { D as DeviceId,
|
|
1
|
+
import { D as DeviceId, Ot as RoomNotice, T as DataHaveFrame, kt as RoomNoticeClaims, p as CapabilityToken } from "../protocol-PhUVprXA.cjs";
|
|
2
2
|
import { KeyValueStorage } from "../ports/storage.cjs";
|
|
3
|
-
import { t as IdentityPort } from "../identity-
|
|
3
|
+
import { t as IdentityPort } from "../identity-CmD4l_Mp.cjs";
|
|
4
4
|
import { t as Clock } from "../clock-DiSx-WKM.cjs";
|
|
5
|
-
import { a as RevocationCheck } from "../tokens-
|
|
5
|
+
import { a as RevocationCheck } from "../tokens-DIPzZ9JJ.cjs";
|
|
6
6
|
import { RoomNoticeVerdictReason } from "./room.cjs";
|
|
7
7
|
//#region src/domain/notice-board.d.ts
|
|
8
8
|
/**
|