openrtc 2.3.0 → 2.4.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/{ITransport-CjxCQ6q7.d.ts → Connection-DZ5eP5hL.d.ts} +445 -94
- package/dist/DelegatingRuntimeAdapter-4cgiIWMN.d.ts +150 -0
- package/dist/IpcRuntimeAdapter-Dduaxscj.d.ts +80 -0
- package/dist/WasmBridge-3W2HHADU.js +1 -0
- package/dist/{assembly-Bmi65-tK.d.ts → assembly-By3UBQsE.d.ts} +36 -19
- package/dist/{capabilities-BPuynml5.d.ts → capabilities-B2mHv_H7.d.ts} +2 -6
- package/dist/chunk-2GX6GB6L.js +1 -0
- package/dist/chunk-2LATKLCC.js +118 -0
- package/dist/{chunk-KRJECX7X.js → chunk-5XOLKH66.js} +1 -1
- package/dist/chunk-6OFAKLDB.js +2 -0
- package/dist/chunk-72NEEJQG.js +1 -0
- package/dist/chunk-BCGCJGIV.js +2 -0
- package/dist/chunk-GNW63SM6.js +2 -0
- package/dist/chunk-JPBW67B3.js +1 -0
- package/dist/chunk-MI3ZMVPK.js +2 -0
- package/dist/chunk-OT7IPLZE.js +1 -0
- package/dist/chunk-OWKAJPOI.js +1 -0
- package/dist/chunk-P2SHJMS3.js +1 -0
- package/dist/chunk-TYZS5LXQ.js +2 -0
- package/dist/chunk-WB66633N.js +1 -0
- package/dist/chunk-XEHBTMJQ.js +1 -0
- package/dist/chunk-YYI6AY6W.js +2 -0
- package/dist/{controlPlane-KVFZ7BR5.js → controlPlane-7E6KGQPP.js} +1 -1
- package/dist/coreClient.d.ts +3 -4
- package/dist/coreClient.js +1 -1
- package/dist/{deviceEnrollment-VACC64CQ.js → deviceEnrollment-CBJYXZ43.js} +2 -2
- package/dist/index.d.ts +6 -7
- package/dist/index.js +1 -1
- package/dist/{ipc-CPnNwv6f.d.ts → ipc-DgzKqHH3.d.ts} +3 -0
- package/dist/ipcFactory-4PCGKZIN.js +1 -0
- package/dist/native.d.ts +21 -0
- package/dist/native.js +1 -0
- package/dist/openrtc-5HAYVDHT.js +2 -0
- package/dist/openrtc_bg.wasm +0 -0
- package/dist/protocol-BSBjMb7p.d.ts +6 -0
- package/dist/runtime/WasmRuntimeAdapter.d.ts +4 -5
- package/dist/runtime/WasmRuntimeAdapter.js +1 -1
- package/dist/runtime/device-status.d.ts +1 -2
- package/dist/runtime/factories.d.ts +283 -8
- package/dist/runtime/factories.js +1 -1
- package/dist/runtime/index.d.ts +13 -160
- package/dist/runtime/index.js +1 -1
- package/dist/testing/native.d.ts +11 -0
- package/dist/testing/native.js +1 -0
- package/dist/testing.d.ts +13 -19
- package/dist/testing.js +1 -1
- package/dist/transport/index.d.ts +7 -18
- package/dist/transport/index.js +1 -1
- package/dist/{types--jQzenZR.d.ts → types-BArEthJr.d.ts} +178 -10
- package/package.json +11 -2
- package/dist/DelegatingRuntimeAdapter-DE4LTGAJ.d.ts +0 -399
- package/dist/IpcRuntimeAdapter-CE0va9Tr.d.ts +0 -19
- package/dist/WasmBridge-75F6GKHG.js +0 -1
- package/dist/chunk-2L6ULC32.js +0 -1
- package/dist/chunk-2SUSPEC4.js +0 -1
- package/dist/chunk-7BJKDBLP.js +0 -2
- package/dist/chunk-DUY34MGT.js +0 -1
- package/dist/chunk-HEAJ7ZUR.js +0 -1
- package/dist/chunk-HUG5AX7R.js +0 -1
- package/dist/chunk-Q6KXVTSH.js +0 -2
- package/dist/chunk-R35AWMNY.js +0 -1
- package/dist/chunk-UILOGUOU.js +0 -1
- package/dist/chunk-WA434EWD.js +0 -2
- package/dist/chunk-XAL4T6TB.js +0 -3
- package/dist/chunk-Z2IS6NH2.js +0 -2
- package/dist/ipcFactory-32R47AVK.js +0 -1
- package/dist/openrtc-4EZPCHWM.js +0 -2
- package/dist/types-DDhMQkK8.d.ts +0 -621
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openrtc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,10 +35,18 @@
|
|
|
35
35
|
"types": "./dist/index.d.ts",
|
|
36
36
|
"import": "./dist/index.js"
|
|
37
37
|
},
|
|
38
|
+
"./native": {
|
|
39
|
+
"types": "./dist/native.d.ts",
|
|
40
|
+
"import": "./dist/native.js"
|
|
41
|
+
},
|
|
38
42
|
"./testing": {
|
|
39
43
|
"types": "./dist/testing.d.ts",
|
|
40
44
|
"import": "./dist/testing.js"
|
|
41
45
|
},
|
|
46
|
+
"./testing/native": {
|
|
47
|
+
"types": "./dist/testing/native.d.ts",
|
|
48
|
+
"import": "./dist/testing/native.js"
|
|
49
|
+
},
|
|
42
50
|
"./runtime": {
|
|
43
51
|
"types": "./dist/runtime/index.d.ts",
|
|
44
52
|
"import": "./dist/runtime/index.js"
|
|
@@ -61,10 +69,11 @@
|
|
|
61
69
|
"build": "tsup",
|
|
62
70
|
"check:lightweight-entry": "node scripts/check-lightweight-entry.mjs",
|
|
63
71
|
"check:native-bundle": "node scripts/check-native-bundle.mjs",
|
|
72
|
+
"check:media-ownership": "vitest run tests/contract/MediaOwnershipAudit.test.ts --no-file-parallelism --maxWorkers=1",
|
|
64
73
|
"build:clean": "rm -rf dist && pnpm run build",
|
|
65
74
|
"release:prepare": "pnpm run build:wasm && pnpm run build:clean && pnpm run check:lightweight-entry && pnpm run check:native-bundle",
|
|
66
75
|
"build:types": "tsc --noEmit",
|
|
67
|
-
"build:wasm": "cd ../../crates/openrtc && OPENRTC_REPO_ROOT=$(cd ../.. && pwd) && CARGO_REGISTRY_ROOT=${CARGO_HOME:-$HOME/.cargo} && RUSTUP_TOOLCHAIN=nightly RUSTFLAGS=\"-Zlocation-detail=none --remap-path-prefix=$HOME=/home --remap-path-prefix=$CARGO_REGISTRY_ROOT=/cargo --remap-path-prefix=$OPENRTC_REPO_ROOT=/openrtc\" wasm-pack build --target web --out-dir ../../packages/openrtc/wasm . --features iroh-protocols-wasm,
|
|
76
|
+
"build:wasm": "cd ../../crates/openrtc && OPENRTC_REPO_ROOT=$(cd ../.. && pwd) && CARGO_REGISTRY_ROOT=${CARGO_HOME:-$HOME/.cargo} && RUSTUP_TOOLCHAIN=nightly RUSTFLAGS=\"-Zlocation-detail=none --remap-path-prefix=$HOME=/home --remap-path-prefix=$CARGO_REGISTRY_ROOT=/cargo --remap-path-prefix=$OPENRTC_REPO_ROOT=/openrtc\" wasm-pack build --target web --out-dir ../../packages/openrtc/wasm . --features iroh-protocols-wasm,transport-webrtc,transport-moq && rm -rf ../../packages/openrtc/wasm/.gitignore",
|
|
68
77
|
"test": "pnpm run test:deterministic && pnpm run test:emulator",
|
|
69
78
|
"test:deterministic": "OPENRTC_DETERMINISTIC_TESTS=1 vitest run tests/unit tests/contract",
|
|
70
79
|
"test:emulator": "node ../../tests/emulator/run-emulator-suite.mjs",
|
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
import { D as Device, k as DiscoveryMode, A as AuthMode, S as SignalingMode, h as ClientOptions, E as ExplicitFileDataSendParams, I as ISignalingBackend, L as LocalDeviceInfo, l as RoomMember, m as RuntimeIdentity, n as SignalingEnvelope, o as DeviceStatusSnapshot, d as PeerSessionSnapshot, B as BackendPeerBiStream, p as BackendPeerUniStream, M as ManagedConnectionRecord, e as ResolvedPeerIdentity, q as DeviceEvent, r as DesiredPeerProjection, s as CoreClientBridgeHost, N as NativeConnectParams, t as NativeConnectResult, u as SignalingSession, v as SessionEvent, w as BackendConnectionState, x as NativeManagedSessionStartResult, G as GrantScope } from './ITransport-CjxCQ6q7.js';
|
|
2
|
-
import { B as BrowserProtocolStore, N as NamespaceDescriptor, p as IrohMutationReceipt, q as IrohDocEntry, A as AuthContext } from './types-DDhMQkK8.js';
|
|
3
|
-
import { R as RuntimeCapabilities } from './capabilities-BPuynml5.js';
|
|
4
|
-
|
|
5
|
-
interface NativeTrustToken {
|
|
6
|
-
token: string;
|
|
7
|
-
expiresAtMs: number;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/** Internal-only gateway record before normalization; includes namespace fields omitted from the public Device type. */
|
|
11
|
-
type RawDeviceDoc = Device & {
|
|
12
|
-
appTag?: string;
|
|
13
|
-
tag?: string;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
interface WasmBridgeOptions {
|
|
17
|
-
apiKey?: string;
|
|
18
|
-
discoveryMode?: DiscoveryMode;
|
|
19
|
-
space?: string;
|
|
20
|
-
spaceKey?: string;
|
|
21
|
-
authMode?: AuthMode;
|
|
22
|
-
signalingMode?: SignalingMode;
|
|
23
|
-
projectId?: string;
|
|
24
|
-
coordinationGateway?: ClientOptions['coordinationGateway'];
|
|
25
|
-
coordinationAvenueOverride?: ClientOptions['coordinationAvenueOverride'];
|
|
26
|
-
coordinationRoomGossipFanout?: ClientOptions['coordinationRoomGossipFanout'];
|
|
27
|
-
attestationTokenProvider?: ClientOptions['attestationTokenProvider'];
|
|
28
|
-
/** Internal host hint used by the provider-neutral gateway projection. */
|
|
29
|
-
coordinationPlatformType?: string;
|
|
30
|
-
storagePrefix?: string;
|
|
31
|
-
deviceIdPersistence?: 'persistent' | 'ephemeral';
|
|
32
|
-
endpointIdPersistence?: 'persistent' | 'ephemeral';
|
|
33
|
-
nodeIdPersistence?: 'persistent' | 'ephemeral';
|
|
34
|
-
localDeviceId?: string;
|
|
35
|
-
deviceName?: string;
|
|
36
|
-
turnCredentialsProvider?: () => Promise<{
|
|
37
|
-
iceServers?: RTCIceServer[];
|
|
38
|
-
} | null | undefined>;
|
|
39
|
-
applicationCrypto?: ExplicitFileDataSendParams['applicationCrypto'];
|
|
40
|
-
spaceAuth?: 'scoped-token';
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* WasmBridge is the browser host wrapper over the Rust/WASM runtime.
|
|
44
|
-
*
|
|
45
|
-
* Allowed:
|
|
46
|
-
* - normalize JS/WASM binding shapes
|
|
47
|
-
* - forward auth, discovery, signaling, and lifecycle calls into Rust
|
|
48
|
-
* - expose typed browser-facing results
|
|
49
|
-
*
|
|
50
|
-
* Not allowed:
|
|
51
|
-
* - become a second lifecycle engine
|
|
52
|
-
* - invent peer identity or connect policy that is not backed by Rust
|
|
53
|
-
* - normalize app-specific payload protocols into runtime behavior
|
|
54
|
-
*
|
|
55
|
-
* Source of truth:
|
|
56
|
-
* - Rust/WASM owns transport/runtime connection state and lifecycle primitives
|
|
57
|
-
* - The selected coordination provider owns browser delivery projections
|
|
58
|
-
* - RuntimeClient owns app-facing orchestration across those surfaces
|
|
59
|
-
*/
|
|
60
|
-
declare class WasmBridge implements ISignalingBackend {
|
|
61
|
-
private static readonly EXPLICIT_FILE_PROTOCOL_TYPE;
|
|
62
|
-
private static readonly EXPLICIT_FILE_CHUNK_SIZE_BYTES;
|
|
63
|
-
private static readonly MAX_EXPLICIT_TRANSFER_HEADER_BYTES;
|
|
64
|
-
private static readonly FALLBACK_EXPLICIT_FILE_NAME;
|
|
65
|
-
private static readonly MAX_EXPLICIT_FILE_NAME_CHARS;
|
|
66
|
-
private static readonly FALLBACK_EXPLICIT_MIME_TYPE;
|
|
67
|
-
private static readonly MAX_EXPLICIT_MIME_TYPE_CHARS;
|
|
68
|
-
app: any | null;
|
|
69
|
-
auth: any | null;
|
|
70
|
-
private readonly appTag;
|
|
71
|
-
protected options: {
|
|
72
|
-
appTag: string;
|
|
73
|
-
apiKey?: string;
|
|
74
|
-
discoveryMode?: DiscoveryMode;
|
|
75
|
-
space?: string;
|
|
76
|
-
spaceKey?: string;
|
|
77
|
-
authMode: AuthMode;
|
|
78
|
-
signalingMode?: SignalingMode;
|
|
79
|
-
projectId: string;
|
|
80
|
-
coordinationGateway?: ClientOptions['coordinationGateway'];
|
|
81
|
-
coordinationAvenueOverride?: ClientOptions['coordinationAvenueOverride'];
|
|
82
|
-
coordinationRoomGossipFanout?: ClientOptions['coordinationRoomGossipFanout'];
|
|
83
|
-
attestationTokenProvider?: ClientOptions['attestationTokenProvider'];
|
|
84
|
-
coordinationPlatformType?: string;
|
|
85
|
-
storagePrefix?: string;
|
|
86
|
-
deviceIdPersistence?: 'persistent' | 'ephemeral';
|
|
87
|
-
endpointIdPersistence?: 'persistent' | 'ephemeral';
|
|
88
|
-
nodeIdPersistence?: 'persistent' | 'ephemeral';
|
|
89
|
-
localDeviceId?: string;
|
|
90
|
-
deviceName?: string;
|
|
91
|
-
strictMode?: boolean;
|
|
92
|
-
turnCredentialsProvider?: () => Promise<{
|
|
93
|
-
iceServers?: RTCIceServer[];
|
|
94
|
-
} | null | undefined>;
|
|
95
|
-
applicationCrypto?: ExplicitFileDataSendParams['applicationCrypto'];
|
|
96
|
-
spaceTokenProvider?: ClientOptions['spaceTokenProvider'];
|
|
97
|
-
spaceAuth?: 'scoped-token';
|
|
98
|
-
};
|
|
99
|
-
private spaceNamespaceIdPromise;
|
|
100
|
-
private cachedSpaceNamespaceId;
|
|
101
|
-
private coordinationHostAvailability;
|
|
102
|
-
private authListeners;
|
|
103
|
-
private persistenceReady;
|
|
104
|
-
wasmClient: any;
|
|
105
|
-
private readonly createdAtMs;
|
|
106
|
-
private missingWasmWarnings;
|
|
107
|
-
private readonly wasmReadyWarningDelayMs;
|
|
108
|
-
private browserCoordinationSignaling;
|
|
109
|
-
private readonly nativeTrustTokens;
|
|
110
|
-
private lastObservedFirebaseUserId;
|
|
111
|
-
private sessionReaders;
|
|
112
|
-
protected authContext: {
|
|
113
|
-
userId: string;
|
|
114
|
-
token?: string | null;
|
|
115
|
-
refreshToken?: string | null;
|
|
116
|
-
customToken?: string | null;
|
|
117
|
-
tokenProvider?: (forceRefresh?: boolean) => Promise<string | null>;
|
|
118
|
-
appCheckTokenProvider?: (forceRefresh?: boolean) => Promise<string | null>;
|
|
119
|
-
expiresAtMs?: number | null;
|
|
120
|
-
} | null;
|
|
121
|
-
private injectedBrowserAuthSessionActive;
|
|
122
|
-
private readonly presenceManager;
|
|
123
|
-
private hasSyncedAuthToWasmClient;
|
|
124
|
-
private lastWasmAuthUserId;
|
|
125
|
-
private lastWasmAuthToken;
|
|
126
|
-
private lastDeliveredConnectionStates;
|
|
127
|
-
private authScopedRuntimeGeneration;
|
|
128
|
-
private coreClient;
|
|
129
|
-
private readonly applicationRouteEscalations;
|
|
130
|
-
private applicationRouteEscalationAttemptKeys;
|
|
131
|
-
private applicationRouteEscalationUnsubscribe;
|
|
132
|
-
private routeSubscriptionGeneration;
|
|
133
|
-
private applicationRouteEscalationSubscriptionEpoch;
|
|
134
|
-
constructor(options: WasmBridgeOptions);
|
|
135
|
-
get tag(): string;
|
|
136
|
-
capabilities(): RuntimeCapabilities;
|
|
137
|
-
private static readonly WEB_DEVICE_ID_STORAGE_PREFIX;
|
|
138
|
-
private static readonly EPHEMERAL_DEVICE_ID_TTL_MS;
|
|
139
|
-
private getDeviceIdentityStorageKey;
|
|
140
|
-
private getDeviceIdPersistenceMode;
|
|
141
|
-
private isTicketOnlyMode;
|
|
142
|
-
private usesProviderNeutralGrant;
|
|
143
|
-
private createRandomDeviceId;
|
|
144
|
-
protected resolveWebLogicalDeviceId(): string;
|
|
145
|
-
private getDefaultBrowserDeviceName;
|
|
146
|
-
getLocalDeviceInfo(): Promise<LocalDeviceInfo>;
|
|
147
|
-
private getCoordinationSignaling;
|
|
148
|
-
usesCoordinationGateway(): boolean;
|
|
149
|
-
setCoordinationHostAvailability(input: {
|
|
150
|
-
available: boolean;
|
|
151
|
-
reason: string;
|
|
152
|
-
}): void;
|
|
153
|
-
/** Restore the existing gateway delivery subscription after a native host resumes. */
|
|
154
|
-
reconnectCoordinationAfterHostResume(): Promise<void>;
|
|
155
|
-
getCoordinationNativeTrustToken(forceRefresh?: boolean): Promise<NativeTrustToken>;
|
|
156
|
-
invalidateCoordinationNativeTrustToken(): void;
|
|
157
|
-
subscribeCoordinationNativeTrustToken(listener: (token: NativeTrustToken | null) => void, options?: {
|
|
158
|
-
emitCurrent?: boolean;
|
|
159
|
-
}): () => void;
|
|
160
|
-
setCoordinationLocalDeviceId(deviceId: string): void;
|
|
161
|
-
/** Internal native-host hint for provider-neutral roster presentation. */
|
|
162
|
-
setCoordinationPlatformType(platformType: string): void;
|
|
163
|
-
setCoordinationExcludedPeers(excludedPeers: string[]): Promise<void>;
|
|
164
|
-
joinCoordinationRoom(roomId: string, nodeId: string, ticket: string): Promise<void>;
|
|
165
|
-
leaveCoordinationRoom(roomId: string): Promise<void>;
|
|
166
|
-
getCoordinationRoomMembers(roomId: string): Promise<RoomMember[]>;
|
|
167
|
-
watchCoordinationRoomMembers(roomId: string, callback: (members: RoomMember[]) => void): () => void;
|
|
168
|
-
private withWebPresenceMetadata;
|
|
169
|
-
setAuthContext(context: {
|
|
170
|
-
userId: string;
|
|
171
|
-
token?: string | null;
|
|
172
|
-
refreshToken?: string | null;
|
|
173
|
-
customToken?: string | null;
|
|
174
|
-
tokenProvider?: (forceRefresh?: boolean) => Promise<string | null>;
|
|
175
|
-
appCheckTokenProvider?: (forceRefresh?: boolean) => Promise<string | null>;
|
|
176
|
-
expiresAtMs?: number | null;
|
|
177
|
-
} | null): Promise<void>;
|
|
178
|
-
private ensureBrowserPlatformAuth;
|
|
179
|
-
private syncWasmAuthToken;
|
|
180
|
-
private toRuntimeIdentity;
|
|
181
|
-
protected getCurrentUserId(): string | null;
|
|
182
|
-
getCurrentUserIdForScope(): string | null;
|
|
183
|
-
getAuthContext(): Readonly<typeof this.authContext> | null;
|
|
184
|
-
protected isSpaceMode(): boolean;
|
|
185
|
-
getResolvedOptions(): Readonly<typeof this.options>;
|
|
186
|
-
protected getDiscoveryScopeId(): string | null;
|
|
187
|
-
protected matchesTag(device: Pick<RawDeviceDoc, 'tag' | 'appTag'>): boolean;
|
|
188
|
-
matchesLegacyOrCurrentTag(device: Pick<RawDeviceDoc, 'tag' | 'appTag'>): boolean;
|
|
189
|
-
private stopSessionSubscriptions;
|
|
190
|
-
private stopRuntimeAuthScopedLoops;
|
|
191
|
-
stopAuthActivity(options?: {
|
|
192
|
-
userId?: string | null;
|
|
193
|
-
}): Promise<void>;
|
|
194
|
-
setWasmClient(client: any): void;
|
|
195
|
-
initializePersistentIrohProtocols(store: BrowserProtocolStore): Promise<void>;
|
|
196
|
-
createPersistentIrohNamespace(generation: number, shareRevision: number): Promise<NamespaceDescriptor>;
|
|
197
|
-
importPersistentIrohTicket(ticket: string, generation: number, shareRevision: number): Promise<string>;
|
|
198
|
-
sharePersistentIrohNamespace(namespaceId: string, writable: boolean): Promise<string>;
|
|
199
|
-
removePersistentIrohNamespace(namespaceId: string, generation: number, shareRevision: number): Promise<void>;
|
|
200
|
-
putPersistentIrohBytes(namespaceId: string, key: Uint8Array, value: Uint8Array): Promise<IrohMutationReceipt>;
|
|
201
|
-
setPersistentIrohHash(namespaceId: string, key: Uint8Array, contentHash: string, contentLength: number): Promise<string>;
|
|
202
|
-
deletePersistentIrohPrefix(namespaceId: string, prefix: Uint8Array): Promise<{
|
|
203
|
-
removed: number;
|
|
204
|
-
operationId: string;
|
|
205
|
-
}>;
|
|
206
|
-
queryPersistentIrohNamespace(namespaceId: string, keyPrefix: Uint8Array): Promise<IrohDocEntry[]>;
|
|
207
|
-
hydratePersistentIrohBlob(contentHash: string): Promise<void>;
|
|
208
|
-
acknowledgePersistentIrohOutbox(operationId: string): Promise<void>;
|
|
209
|
-
flushPersistentIrohProtocols(): Promise<void>;
|
|
210
|
-
shutdownPersistentIrohProtocols(): Promise<void>;
|
|
211
|
-
private requirePersistentProtocolHost;
|
|
212
|
-
private warnMissingWasmOnce;
|
|
213
|
-
private waitForWasmClient;
|
|
214
|
-
protected normalizeDevice(raw: Record<string, any>, fallbackId?: string): Device;
|
|
215
|
-
normalizeDeviceRecord(raw: Record<string, any>, fallbackId?: string): Device;
|
|
216
|
-
getResolvedWebLogicalDeviceId(): string;
|
|
217
|
-
private normalizeDeviceStatusSnapshot;
|
|
218
|
-
private normalizePeerSessionSnapshot;
|
|
219
|
-
private toBackendConnectionStateFromPeerSession;
|
|
220
|
-
private normalizeStateSnapshot;
|
|
221
|
-
private stabilizeConnectionState;
|
|
222
|
-
private sameConnectionState;
|
|
223
|
-
private deliverConnectionState;
|
|
224
|
-
private get browserPresenceLoopState();
|
|
225
|
-
private set browserPresenceLoopState(value);
|
|
226
|
-
get currentUser(): RuntimeIdentity | null;
|
|
227
|
-
onAuthChange(callback: (user: RuntimeIdentity | null) => void): () => void;
|
|
228
|
-
checkForSSOToken(): Promise<void>;
|
|
229
|
-
waitForAuth(): Promise<void>;
|
|
230
|
-
signInAnonymously(): Promise<void>;
|
|
231
|
-
signInWithPluto(): Promise<void>;
|
|
232
|
-
signOut(): Promise<void>;
|
|
233
|
-
getTurnCredentials(): Promise<any>;
|
|
234
|
-
updatePresence(localNodeId: string, ticketStr: string, isOnline?: boolean, ttlMs?: number, metadata?: string, deviceNameOverride?: string): Promise<void>;
|
|
235
|
-
refreshLivePresence(localNodeId: string, ticketStr: string, metadata?: string, deviceNameOverride?: string): Promise<void>;
|
|
236
|
-
setOffline(localNodeId: string): Promise<void>;
|
|
237
|
-
updateDevice(deviceId: string, updates: {
|
|
238
|
-
deviceName?: string;
|
|
239
|
-
capabilities?: Device['capabilities'];
|
|
240
|
-
metadata?: string;
|
|
241
|
-
excludedPeers?: string[];
|
|
242
|
-
}): Promise<void>;
|
|
243
|
-
deleteDevice(deviceId: string): Promise<void>;
|
|
244
|
-
cleanupStaleDevices(): Promise<void>;
|
|
245
|
-
sendMessage(targetId: string, payload: string, state?: string, replyPayload?: string): Promise<string>;
|
|
246
|
-
pollMessages(targetId: string): Promise<SignalingEnvelope[]>;
|
|
247
|
-
searchDevices(excludeNodeId?: string): Promise<Device[]>;
|
|
248
|
-
listDeviceStatus(): Promise<DeviceStatusSnapshot[]>;
|
|
249
|
-
getPeerSession(id: string): Promise<PeerSessionSnapshot | null>;
|
|
250
|
-
listPeerSessions(): Promise<PeerSessionSnapshot[]>;
|
|
251
|
-
waitForSettledPeer(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
|
|
252
|
-
openPeerBi(id: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
|
|
253
|
-
openPeerNativeBi(id: string, label: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
|
|
254
|
-
openPeerBiRaw(id: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
|
|
255
|
-
openPeerUni(id: string, timeoutMs?: number): Promise<BackendPeerUniStream>;
|
|
256
|
-
resolvePeerRecords(id: string): Promise<ManagedConnectionRecord[]>;
|
|
257
|
-
resolvePeerIdentity(id: string): Promise<ResolvedPeerIdentity>;
|
|
258
|
-
onDevicesChange(callback: (devices: Device[]) => void, excludeNodeId?: string): () => void;
|
|
259
|
-
subscribeDevices(userId: string): Promise<ReadableStream<DeviceEvent[]>>;
|
|
260
|
-
startAutoConnect(userId: string, localDeviceId: string): Promise<void>;
|
|
261
|
-
startAutoConnectOnce(userId: string, localDeviceId: string): Promise<void>;
|
|
262
|
-
notifyDisconnectRequested(remoteNodeId: string): void;
|
|
263
|
-
excludeAutoConnect(deviceId: string, excluded: boolean): Promise<void>;
|
|
264
|
-
disconnectDevice(deviceId: string): Promise<void>;
|
|
265
|
-
submitDesiredPeerProjection(revision: number, peers: DesiredPeerProjection[]): Promise<void>;
|
|
266
|
-
setCoreClient(client: CoreClientBridgeHost | null): void;
|
|
267
|
-
private startApplicationRouteEscalationSubscription;
|
|
268
|
-
private stopApplicationRouteEscalationSubscription;
|
|
269
|
-
private retryManagedApplicationRouteEscalations;
|
|
270
|
-
private escalateManagedApplicationRoute;
|
|
271
|
-
connectToDevice(params: NativeConnectParams): Promise<NativeConnectResult>;
|
|
272
|
-
forceReconnect(): void;
|
|
273
|
-
startPresenceLoop(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): void;
|
|
274
|
-
private ensureSpaceNamespaceIdPromise;
|
|
275
|
-
createSession(session: SignalingSession): Promise<void>;
|
|
276
|
-
updateSession(sessionId: string, updateData: any): Promise<void>;
|
|
277
|
-
subscribeSessions(localDeviceId: string): Promise<ReadableStream<SessionEvent[]>>;
|
|
278
|
-
getLocalDeviceId(): Promise<string | null>;
|
|
279
|
-
isConnected(node_id: string): Promise<boolean>;
|
|
280
|
-
private hasConnectedIndependentPeerRoute;
|
|
281
|
-
getConnectionStates(): Promise<BackendConnectionState[]>;
|
|
282
|
-
onStateChange(callback: (state: BackendConnectionState) => void): Promise<() => void> | (() => void);
|
|
283
|
-
sendExplicitFilePath(connectionId: string, filePath: string, transferId?: string): Promise<string>;
|
|
284
|
-
private sanitizeExplicitFileName;
|
|
285
|
-
private sanitizeExplicitMimeType;
|
|
286
|
-
private assertExplicitTransferHeaderSize;
|
|
287
|
-
private createWebRTCExplicitTransferId;
|
|
288
|
-
private createWebRTCExplicitTransferFrame;
|
|
289
|
-
sendExplicitFileData(params: ExplicitFileDataSendParams): Promise<void>;
|
|
290
|
-
getTransferHistory(limit?: number): Promise<Array<[string, unknown]>>;
|
|
291
|
-
deleteTransferJob(jobId: string): Promise<void>;
|
|
292
|
-
watchFriendDevices(friendUserIds: string[], callback: (friendDevices: Map<string, any[]>) => void): () => void;
|
|
293
|
-
updateFriendTicket(friendTicket: string | null): Promise<void>;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
declare abstract class DelegatingRuntimeAdapter implements ISignalingBackend {
|
|
297
|
-
protected readonly backend: ISignalingBackend;
|
|
298
|
-
protected constructor(backend: ISignalingBackend);
|
|
299
|
-
get currentUser(): RuntimeIdentity | null;
|
|
300
|
-
setAuthContext(context: AuthContext | null): Promise<void> | void;
|
|
301
|
-
signInAnonymously(): Promise<void>;
|
|
302
|
-
signInWithPluto(): Promise<void>;
|
|
303
|
-
signOut(): Promise<void>;
|
|
304
|
-
stopAuthActivity(): Promise<void>;
|
|
305
|
-
usesCoordinationGateway(): boolean;
|
|
306
|
-
joinCoordinationRoom(roomId: string, nodeId: string, ticket: string): Promise<void>;
|
|
307
|
-
leaveCoordinationRoom(roomId: string): Promise<void>;
|
|
308
|
-
getCoordinationRoomMembers(roomId: string): Promise<RoomMember[]>;
|
|
309
|
-
watchCoordinationRoomMembers(roomId: string, callback: (members: RoomMember[]) => void): () => void;
|
|
310
|
-
getTurnCredentials(): Promise<any>;
|
|
311
|
-
updatePresence(localNodeId: string, ticketStr: string, isOnline: boolean, ttlMs: number, metadata?: string): Promise<void>;
|
|
312
|
-
refreshLivePresence(localNodeId: string, ticketStr: string, metadata?: string): Promise<void>;
|
|
313
|
-
setOffline(localNodeId: string): Promise<void>;
|
|
314
|
-
cleanupStaleDevices(): Promise<void>;
|
|
315
|
-
searchDevices(excludeNodeId?: string): Promise<Device[]>;
|
|
316
|
-
listDeviceStatus(): Promise<DeviceStatusSnapshot[]>;
|
|
317
|
-
getPeerSession(id: string): Promise<PeerSessionSnapshot | null>;
|
|
318
|
-
listPeerSessions(): Promise<PeerSessionSnapshot[]>;
|
|
319
|
-
waitForSettledPeer(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
|
|
320
|
-
resolvePeerIdentity(id: string): Promise<ResolvedPeerIdentity>;
|
|
321
|
-
resolvePeerRecords(id: string): Promise<ManagedConnectionRecord[]>;
|
|
322
|
-
updateDevice(deviceId: string, updates: {
|
|
323
|
-
deviceName?: string;
|
|
324
|
-
capabilities?: Device['capabilities'];
|
|
325
|
-
metadata?: string;
|
|
326
|
-
}): Promise<void>;
|
|
327
|
-
deleteDevice(deviceId: string): Promise<void>;
|
|
328
|
-
onDevicesChange(callback: (devices: Device[]) => void, excludeNodeId?: string): () => void;
|
|
329
|
-
onAuthChange(callback: (user: RuntimeIdentity | null) => void): () => void;
|
|
330
|
-
checkForSSOToken(): Promise<void>;
|
|
331
|
-
waitForAuth(): Promise<void>;
|
|
332
|
-
sendMessage(targetId: string, payload: string, state?: string, replyPayload?: string): Promise<string>;
|
|
333
|
-
pollMessages(targetId: string): Promise<SignalingEnvelope[]>;
|
|
334
|
-
watchFriendDevices(friendUserIds: string[], callback: (friendDevices: Map<string, Device[]>) => void): () => void;
|
|
335
|
-
updateFriendTicket(friendTicket: string | null): Promise<void>;
|
|
336
|
-
subscribeDevices(userId: string): Promise<ReadableStream<DeviceEvent[]>>;
|
|
337
|
-
startAutoConnect(userId: string, localDeviceId: string): void;
|
|
338
|
-
submitDesiredPeerProjection(revision: number, peers: DesiredPeerProjection[]): Promise<void>;
|
|
339
|
-
startPresenceLoop(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): void;
|
|
340
|
-
createSession(session: SignalingSession): Promise<void>;
|
|
341
|
-
updateSession(sessionId: string, updateData: any): Promise<void>;
|
|
342
|
-
subscribeSessions(localDeviceId: string): Promise<ReadableStream<SessionEvent[]>>;
|
|
343
|
-
forceReconnect(): void;
|
|
344
|
-
getLocalDeviceId(): Promise<string | null>;
|
|
345
|
-
getLocalDeviceInfo(): Promise<LocalDeviceInfo | null>;
|
|
346
|
-
updateDeviceName(deviceName: string): Promise<LocalDeviceInfo | null>;
|
|
347
|
-
startNativeSession(options: {
|
|
348
|
-
userId: string;
|
|
349
|
-
deviceName?: string;
|
|
350
|
-
localDeviceId?: string | null;
|
|
351
|
-
metadata?: string;
|
|
352
|
-
autoConnect?: boolean;
|
|
353
|
-
presence?: boolean;
|
|
354
|
-
}): Promise<NativeManagedSessionStartResult>;
|
|
355
|
-
notifyNetworkChange(options?: {
|
|
356
|
-
reason?: string;
|
|
357
|
-
}): Promise<unknown>;
|
|
358
|
-
getManagedNodeId(options?: {
|
|
359
|
-
initializeIfMissing?: boolean;
|
|
360
|
-
}): Promise<string | null>;
|
|
361
|
-
startPresence(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): Promise<void>;
|
|
362
|
-
startAutoConnectOnce(userId: string, localDeviceId: string): Promise<void>;
|
|
363
|
-
getEndpointTicket(): Promise<string>;
|
|
364
|
-
getTicketWithToken(scope: GrantScope, maxConnections: number): Promise<string | null>;
|
|
365
|
-
registerSessionToken(token: string, scope: GrantScope, maxConnections: number, expiresAtMs?: number): Promise<void>;
|
|
366
|
-
revokeTokens(scope: GrantScope): Promise<string[]>;
|
|
367
|
-
openPeerBi(id: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
|
|
368
|
-
incoming_streams(): Promise<ReadableStream<unknown>>;
|
|
369
|
-
isCurrentTransport(endpointId: string, transportStableId: bigint): Promise<boolean>;
|
|
370
|
-
openPeerNativeBi(id: string, label: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
|
|
371
|
-
openPeerBiRaw(id: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
|
|
372
|
-
openPeerUni(id: string, timeoutMs?: number): Promise<BackendPeerUniStream>;
|
|
373
|
-
connectToDevice(params: NativeConnectParams): Promise<NativeConnectResult>;
|
|
374
|
-
disconnectDevice(deviceId: string): Promise<void>;
|
|
375
|
-
excludeAutoConnect(deviceId: string, excluded: boolean): Promise<void>;
|
|
376
|
-
isConnected(nodeId: string): Promise<boolean>;
|
|
377
|
-
getConnectionStates(): Promise<BackendConnectionState[]>;
|
|
378
|
-
onStateChange(callback: (state: BackendConnectionState) => void): Promise<() => void> | (() => void);
|
|
379
|
-
/** @deprecated Use named channels or `openrtc-file-transfer`. */
|
|
380
|
-
sendExplicitFilePath(connectionId: string, filePath: string, transferId?: string): Promise<string>;
|
|
381
|
-
/** @deprecated Use named channels or `openrtc-file-transfer`. */
|
|
382
|
-
sendExplicitFileData(params: ExplicitFileDataSendParams): Promise<void>;
|
|
383
|
-
/** @deprecated Transfer history belongs to the consumer application. */
|
|
384
|
-
getTransferHistory(limit?: number): Promise<Array<[string, unknown]>>;
|
|
385
|
-
/** @deprecated Transfer history belongs to the consumer application. */
|
|
386
|
-
deleteTransferJob(jobId: string): Promise<void>;
|
|
387
|
-
capabilities(): RuntimeCapabilities;
|
|
388
|
-
onIncomingNativeMessage(callback: (connectionId: string, remoteNodeId: string | null, message: any) => void): Promise<() => void>;
|
|
389
|
-
unwrap(): ISignalingBackend;
|
|
390
|
-
/**
|
|
391
|
-
* Forward setCoreClient() to the inner backend if it implements it. This
|
|
392
|
-
* lets the core Client inject a reference into backends (e.g. WasmBridge)
|
|
393
|
-
* that need to escalate transport-level dials into full Client.connect()
|
|
394
|
-
* handshakes.
|
|
395
|
-
*/
|
|
396
|
-
setCoreClient(client: unknown): void;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
export { DelegatingRuntimeAdapter as D, WasmBridge as W, type WasmBridgeOptions as a };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { h as ClientOptions } from './ITransport-CjxCQ6q7.js';
|
|
2
|
-
import { a as WasmBridgeOptions, D as DelegatingRuntimeAdapter } from './DelegatingRuntimeAdapter-DE4LTGAJ.js';
|
|
3
|
-
import { P as PlutoIpcBridge } from './ipc-CPnNwv6f.js';
|
|
4
|
-
|
|
5
|
-
interface NativeIpcBridgeOptions extends WasmBridgeOptions {
|
|
6
|
-
allowWasmFallback?: boolean;
|
|
7
|
-
ipcBridge?: PlutoIpcBridge;
|
|
8
|
-
transports?: ClientOptions['transports'];
|
|
9
|
-
strictMode?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface IpcAdapterOptions extends NativeIpcBridgeOptions {
|
|
13
|
-
bridge: PlutoIpcBridge;
|
|
14
|
-
}
|
|
15
|
-
declare class IpcRuntimeAdapter extends DelegatingRuntimeAdapter {
|
|
16
|
-
constructor(options: IpcAdapterOptions);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { IpcRuntimeAdapter as I, type IpcAdapterOptions as a };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{z as WasmBridge}from'./chunk-Z2IS6NH2.js';import'./chunk-AJQVMVYW.js';import'./chunk-WA434EWD.js';import'./chunk-HEAJ7ZUR.js';import'./chunk-2L6ULC32.js';import'./chunk-2SUSPEC4.js';
|
package/dist/chunk-2L6ULC32.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {b,e}from'./chunk-2SUSPEC4.js';import {xchacha20poly1305}from'@noble/ciphers/chacha.js';function I(){if(typeof globalThis<"u"&&globalThis.__OPENRTC_DEBUG__===true)return true;if(typeof localStorage<"u")try{return localStorage.getItem("openrtc:debug")==="1"}catch{return false}return false}function x(t,e,r){if(I()){if(typeof r>"u"){console[t](e);return}console[t](e,r);}}function Y(t,e){x("debug",t,e);}function $(t,e){x("info",t,e);}function G(t,e){x("log",t,e);}function H(t){return new Promise(e=>setTimeout(e,t))}function K(t){let e=new Uint8Array(t.byteLength);return e.set(t),e}function B(t){let e=t.reduce((s,c)=>s+c.byteLength,0),r=new Uint8Array(e),a=0;for(let s of t)r.set(s,a),a+=s.byteLength;return r}function Q(t,e,r){let a=e*Math.pow(2,Math.max(0,t-1));return Math.min(r,a)}function j(t){try{let e=t;return !!e&&!!e.send&&typeof e.send.getWriter=="function"&&!!e.recv&&typeof e.recv.getReader=="function"}catch{return false}}function J(t,e,r){let a=t;if(!a)return null;try{let s=a.send,c=a.recv;if(!s||typeof s.getWriter!="function"||!c||typeof c.getReader!="function")return null;let p=typeof a.endpoint_id=="string"&&a.endpoint_id.trim().length>0?a.endpoint_id:e,i=Number.isSafeInteger(a.transport_stable_id)&&Number(a.transport_stable_id)>0?Number(a.transport_stable_id):void 0,f=Number.isSafeInteger(r)&&Number(r)>0?Number(r):void 0;if(i!==void 0&&f!==void 0&&i!==f)return null;let o=i??f;return {send:s,recv:c,endpoint_id:p,...o?{transport_stable_id:o}:{}}}catch{return null}}function Z(t,e){let r={send:t.send,recv:e,endpoint_id:typeof t.endpoint_id=="string"?t.endpoint_id:"",...Number.isSafeInteger(t.transport_stable_id)&&Number(t.transport_stable_id)>0?{transport_stable_id:Number(t.transport_stable_id)}:{}};return t?.applicationCryptoWrapped===true&&(r.applicationCryptoWrapped=true),r}async function ee(t,e){if(!t)return false;try{let r=t.send?.getWriter?.();if(r)try{await r.close();}catch{}finally{try{r.releaseLock();}catch{}}}catch{}try{let r=t.recv?.getReader?.();if(r)try{await r.cancel(e);}catch{}finally{try{r.releaseLock();}catch{}}}catch{}return true}function te(t,e,r={}){let a=r.context??"prependBytesToReader",s=r.traceId,c=e.byteLength===0,p=r.pendingRead??null,i=o=>r.release?.(o),f=(o,n)=>r.log?.(o,n);return new ReadableStream({async pull(o){if(!c){c=true,o.enqueue(e);return}if(p){let l=p;p=null;let d;try{d=await l;}catch(u){o.error(u),i("pending-read-error"),f("prepend-bytes:pending-read-error",{context:a,traceId:s||null,error:u?.message||String(u)});return}if(d.done){o.close(),i("pending-done");return}d.value&&o.enqueue(d.value);return}let n;try{n=await t.read();}catch(l){o.error(l),i("read-error"),f("prepend-bytes:read-error",{context:a,traceId:s||null,error:l?.message||String(l)});return}let{done:y,value:b}=n;if(y){o.close(),i("done");return}b&&o.enqueue(b);},async cancel(o){i("cancel");}})}async function re(t,e){let r=t.read(),a=e-Date.now();if(a<=0)return {status:"timeout",pendingRead:r};let s=Symbol("probe-timeout"),c,p=new Promise(i=>{c=setTimeout(()=>i(s),a);});try{let i=await Promise.race([r,p]);if(i===s)return {status:"timeout",pendingRead:r};let{done:f,value:o}=i;return f?{status:"done"}:{status:"data",value:o&&o.byteLength>0?new Uint8Array(o):new Uint8Array(0)}}finally{c&&clearTimeout(c);}}var N=b,k=new Set(N);function w(t){if(typeof t!="string")return;let e=t.trim().toLowerCase();return k.has(e)?e:void 0}function oe(t){let e$1=w(t);return e$1?e(e$1).baseProtocol==="iroh":false}function ie(t){let e$1=w(t);if(!e$1)return false;let r=e(e$1);return r.baseProtocol==="iroh"&&(r.locality==="nearby"||r.locality==="direct-internet")}function se(t){let e$1=w(t);return e$1?e(e$1).family==="optional-route":false}function ue(t){let e$1=w(t);return e$1?e(e$1).baseProtocol==="webrtc":false}function ce(t){let e$1=w(t);if(!e$1)return false;let r=e(e$1);return r.baseProtocol==="iroh"&&r.implementation==="carrier-adapter"}function le(t,e,r=false){return t==="relay"||e==="relay"?"webrtc-turn":t==="host"&&e==="host"||r&&t&&e?"webrtc-lan":"webrtc"}function de(t){let e$1=w(t);return e$1?e(e$1).independent:false}var g=new Uint8Array([79,82,84,67,69,49]),T=2,R=8,A=24,_=32,C=3,D=16*1024*1024,q=4096;function F(t,e){if(t.byteLength<e.byteLength)return false;let r=0;for(let a=0;a<e.byteLength;a+=1)r|=t[a]^e[a];return r===0}function W(t){let e=new Uint8Array(t),r=globalThis.crypto;if(!r||typeof r.getRandomValues!="function")throw new Error("[OpenRTC] application payload crypto requires crypto.getRandomValues");return r.getRandomValues(e),e}function V(t,e){let r="";for(let a of e)r+=a.toString(16).padStart(2,"0");return `${t}:${r}`}function v(t){if(!F(t,g))return null;let e=t[g.byteLength];return e===T?e:null}function M(t){return v(t)===T&&t.byteLength>g.byteLength+1+R+A}function be(t,e={}){if(!(t instanceof Uint8Array)||t.byteLength!==_)throw new Error(`[OpenRTC] application payload crypto key must be ${_} bytes`);let r=new Uint8Array(t),a=e.requireEncrypted??true,s=e.randomBytes??W,c=e.replayProtection??true,p=0,i=new Set,f=[];return {requireEncrypted:a,protectPayload(o,n){let y=s(A);if(!(y instanceof Uint8Array)||y.byteLength!==A)throw new Error(`[OpenRTC] application payload crypto nonce must be ${A} bytes`);let b=new Uint8Array(1+n.byteLength);b[0]=o,b.set(n,1);let l=xchacha20poly1305(r,y).encrypt(b);if(!c)throw new Error("[OpenRTC] ORTCE1 v1 envelopes are not supported; replay protection is required");let d=new Uint8Array(g.byteLength+1+R+y.byteLength+l.byteLength),u=0;d.set(g,u),u+=g.byteLength,d[u]=T,u+=1;let S=p;return p+=1,new DataView(d.buffer,d.byteOffset+u,R).setBigUint64(0,BigInt(S),false),u+=R,d.set(y,u),u+=y.byteLength,d.set(l,u),d},openPayload(o,n){if(!M(n))return a?null:n;if(v(n)!==T)return null;let b=g.byteLength+1,l=Number(new DataView(n.buffer,n.byteOffset+b,R).getBigUint64(0,false));if(!Number.isFinite(l))return null;let d=b+R,u=d+A,S=n.slice(d,u),h=c?V(l,S):null;if(h&&i.has(h))return null;let O=n.slice(u),U;try{U=xchacha20poly1305(r,S).decrypt(O);}catch{return null}if(U.byteLength<1||U[0]!==o)return null;if(h)for(i.add(h),f.push(h);f.length>q;){let L=f.shift();L&&i.delete(L);}return U.slice(1)}}}function z(t){let e=new Uint8Array(4+t.byteLength);return new DataView(e.buffer,e.byteOffset,e.byteLength).setUint32(0,t.byteLength,false),e.set(t,4),e}function me(t,e={}){let r=e.typeId??C,a=e.maxFrameBytes??D;if(!Number.isInteger(r)||r<0||r>255)throw new Error("[OpenRTC] raw application crypto stream typeId must be an integer from 0 to 255");if(!Number.isInteger(a)||a<=0)throw new Error("[OpenRTC] raw application crypto maxFrameBytes must be a positive integer");let s=n=>t.protectPayload(r,n),c=n=>t.openPayload(r,n),p=()=>new TransformStream({transform(n,y){y.enqueue(z(s(new Uint8Array(n))));}}),i=()=>{let n=new Uint8Array(0);return new TransformStream({transform(y,b){for(n=B([n,new Uint8Array(y)]);n.byteLength>=4;){let l=new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,false);if(l===0||l>a)throw new Error("[OpenRTC] invalid encrypted raw stream frame length");if(n.byteLength<4+l)return;let d=n.slice(4,4+l);n=n.slice(4+l);let u=c(d);if(!u)throw new Error("[OpenRTC] encrypted raw stream frame failed authentication");b.enqueue(u);}},flush(){if(n.byteLength!==0)throw new Error("[OpenRTC] encrypted raw stream ended mid-frame")}})},f=n=>n.pipeThrough(i()),o=n=>{let y=p();return y.readable.pipeTo(n).catch(()=>{}),y.writable};return {typeId:r,protectFrame:s,openFrame:c,outboundTransform:p,inboundTransform:i,wrapReadable:f,wrapWritable:o,wrapBiStream(n){return {...n,send:o(n.send),recv:f(n.recv)}}}}export{I as a,Y as b,$ as c,G as d,H as e,K as f,B as g,Q as h,j as i,J as j,Z as k,ee as l,te as m,re as n,N as o,w as p,oe as q,ie as r,se as s,ue as t,ce as u,le as v,de as w,M as x,be as y,me as z};
|
package/dist/chunk-2SUSPEC4.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t=Object.freeze([Object.freeze({id:"iroh-lan",baseProtocol:"iroh",family:"iroh-path",implementation:"path-label",locality:"nearby",maturity:"stable",defaultRank:0,browser:false,native:true,independent:false}),Object.freeze({id:"webrtc-lan",baseProtocol:"webrtc",family:"optional-route",implementation:"path-label",locality:"nearby",maturity:"stable",defaultRank:1,browser:true,native:true,independent:false}),Object.freeze({id:"ble",baseProtocol:"iroh",family:"iroh-physical",implementation:"host-installed",locality:"nearby",maturity:"experimental",defaultRank:2,browser:false,native:true,independent:false}),Object.freeze({id:"iroh-webrtc",baseProtocol:"iroh",family:"iroh-physical",implementation:"carrier-adapter",locality:"mixed",maturity:"stable",defaultRank:3,browser:true,native:true,independent:false}),Object.freeze({id:"webrtc",baseProtocol:"webrtc",family:"optional-route",implementation:"route-adapter",locality:"mixed",maturity:"stable",defaultRank:4,browser:true,native:true,independent:true}),Object.freeze({id:"iroh-moq",baseProtocol:"iroh",family:"iroh-physical",implementation:"carrier-adapter",locality:"relay",maturity:"experimental",defaultRank:5,browser:true,native:true,independent:false}),Object.freeze({id:"moq",baseProtocol:"moq",family:"optional-route",implementation:"route-adapter",locality:"relay",maturity:"experimental",defaultRank:6,browser:true,native:true,independent:true}),Object.freeze({id:"iroh",baseProtocol:"iroh",family:"iroh-path",implementation:"core",locality:"mixed",maturity:"stable",defaultRank:7,browser:true,native:true,independent:false}),Object.freeze({id:"iroh-quic",baseProtocol:"iroh",family:"iroh-path",implementation:"path-label",locality:"direct-internet",maturity:"stable",defaultRank:8,browser:false,native:true,independent:false}),Object.freeze({id:"iroh-relay",baseProtocol:"iroh",family:"iroh-path",implementation:"path-label",locality:"relay",maturity:"stable",defaultRank:9,browser:true,native:true,independent:false}),Object.freeze({id:"webrtc-turn",baseProtocol:"webrtc",family:"optional-route",implementation:"path-label",locality:"relay",maturity:"stable",defaultRank:10,browser:true,native:true,independent:false})]),r=Object.freeze(Object.fromEntries(t.map(e=>[e.id,e]))),o=Object.freeze(["iroh-lan","webrtc-lan","ble","iroh-webrtc","webrtc","iroh-moq","moq","iroh","iroh-quic","iroh-relay","webrtc-turn"]),a=Object.freeze(["iroh-lan","iroh-quic","iroh-webrtc","iroh-moq","iroh-relay"]),i=Object.freeze({iroh:80,"iroh-quic":30,"iroh-relay":70,"iroh-lan":10,ble:25,"iroh-webrtc":27,webrtc:40,"webrtc-lan":20,"webrtc-turn":60,"iroh-moq":55,moq:50});var l=t,n=r,m=o,b=a,p=i;function s(e){return n[e]}function u(){return l}export{l as a,m as b,b as c,p as d,s as e,u as f};
|
package/dist/chunk-7BJKDBLP.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {d as d$2,c}from'./chunk-2L6ULC32.js';import {a,d as d$1}from'./chunk-2SUSPEC4.js';import {x25519}from'@noble/curves/ed25519.js';import {hkdf}from'@noble/hashes/hkdf.js';import {sha256}from'@noble/hashes/sha2.js';var v=3e4,d=class d{constructor(){this.name="webrtc";this.pc=null;this.dc=null;this.state="disconnected";this.pendingCandidates=[];this.connectTimeoutId=null;this.iceDisconnectedGraceTimer=null;this.iceRestartAttempted=false;this.localNodeId="";this.remoteNodeId="";this.candidatesGathered=0;this.sdpOfferSent=false;this.sdpAnswerReceived=false;this._terminalFailure=false;this.activeAttemptId=0;this.negotiationId=null;this.disconnectedGraceExtensions=0;this.offerInFlight=false;this.messageListeners=[];this.stateListeners=[];this.internalSignalSender=null;}get isReady(){return this.state==="connected"}isTerminalFailure(){return this._terminalFailure}getNegotiationId(){return this.negotiationId}getDataChannelReadyState(){return this.dc?.readyState??null}getNativeTransport(){return this.pc}setSignalSender(e){this.internalSignalSender=e;}async init(e,n,t){this.closePeerResources();let i=++this.activeAttemptId;this.localNodeId=e,this.remoteNodeId=n,this.candidatesGathered=0,this.sdpOfferSent=false,this.sdpAnswerReceived=false,this._terminalFailure=false,this.offerInFlight=false,this.pendingCandidates=[],this.disconnectedGraceExtensions=0,this.negotiationId=typeof t?.negotiationId=="string"&&t.negotiationId.trim().length>0?t.negotiationId.trim():this.createNegotiationId(),this.setState("connecting"),this.startConnectTimeout(i);let a=t.rtcConfig||{},s=typeof t?.forceRole=="string"&&(t.forceRole==="initiator"||t.forceRole==="responder")?t.forceRole:null,c=s?s==="initiator":e>n;d$2(`[WebRTCTransport] init \u2014 role=${c?"initiator":"responder"}`,{local:e.slice(0,12),remote:n.slice(0,12),negotiationId:this.negotiationId,forcedRole:s});try{d$2("[WebRTCTransport] Creating RTCPeerConnection",{iceServers:a.iceServers?.length??0}),this.pc=new RTCPeerConnection(a);}catch(R){console.error("[WebRTCTransport] RTCPeerConnection constructor failed",R),this.setState("failed");return}let T=this.pc.createDataChannel("pluto-dc",{negotiated:true,id:0});this.setupDataChannel(T,i),this.setupPCHandlers(c,i),c&&queueMicrotask(()=>{this.createAndSendOffer(i,"initial-initiator");});}setupDataChannel(e,n){this.dc=e,e.onopen=()=>{this.isCurrentAttempt(n,e)&&(d$2("[WebRTCTransport] DataChannel opened \u2014 upgrade complete"),this.promoteConnectedIfReady("datachannel-open"));},e.onmessage=t=>{if(!this.isCurrentAttempt(n,e))return;let i=typeof t.data=="string"?new TextEncoder().encode(t.data):new Uint8Array(t.data);this.messageListeners.forEach(a=>a(i));},e.onclose=()=>{this.isCurrentAttempt(n,e)&&(d$2("[WebRTCTransport] DataChannel closed"),(this.state==="connected"||this.state==="connecting")&&this.setState("disconnected"));},e.onerror=t=>{if(!this.isCurrentAttempt(n,e))return;console.warn("[WebRTCTransport] DataChannel error",t);let i=t?.error?.message??"";if((i.includes("User-Initiated Abort")||i.includes("Close called"))&&this.state==="connected"&&e.readyState!=="open"){console.warn("[WebRTCTransport] DataChannel aborted post-connect; forcing disconnected state",{readyState:e.readyState,connectionState:this.pc?.connectionState,iceConnectionState:this.pc?.iceConnectionState}),this.setState("disconnected");return}this.state==="connecting"&&this.setState("failed");};}setupPCHandlers(e,n){let t=this.pc;t&&(t.onicecandidate=i=>{this.isCurrentAttempt(n,void 0,t)&&(i.candidate?(this.candidatesGathered++,d$2(`[WebRTCTransport] ICE candidate #${this.candidatesGathered}: ${i.candidate.type} ${i.candidate.protocol} ${i.candidate.address??"?"}:${i.candidate.port}`),this.internalSignalSender?this.internalSignalSender({transport:"webrtc",type:"candidate",candidate:i.candidate,negotiationId:this.negotiationId??void 0}).catch(a=>{console.warn("[WebRTCTransport] Failed sending local ICE candidate signal",{error:a,gatheringState:t?.iceGatheringState,iceConnectionState:t?.iceConnectionState});}):console.warn("[WebRTCTransport] ICE candidate dropped \u2014 no signal sender!")):this.candidatesGathered===0?(console.warn("[WebRTCTransport] ICE gathering complete with 0 candidates \u2014 failing immediately.","If both peers are on the same page, WebRTC requires separate tabs or devices.",{local:this.localNodeId.slice(0,12),remote:this.remoteNodeId.slice(0,12)}),this._terminalFailure=true,this.setState("failed")):d$2(`[WebRTCTransport] ICE gathering complete \u2014 ${this.candidatesGathered} candidate(s)`));},t.onnegotiationneeded=async()=>{e&&await this.createAndSendOffer(n,"negotiationneeded");},t.onconnectionstatechange=()=>{if(!this.isCurrentAttempt(n,void 0,t))return;let i=t.connectionState;if(d$2(`[WebRTCTransport] Connection state: ${i}`),i==="connected")this.promoteConnectedIfReady("pc-connected");else if(i==="failed"){if(this.iceDisconnectedGraceTimer){console.warn("[WebRTCTransport] pc.connectionState=failed during grace window \u2014 deferring to grace timer",{iceState:t.iceConnectionState,iceRestartAttempted:this.iceRestartAttempted});return}console.error("[WebRTCTransport] Connection failed",{iceState:t.iceConnectionState,gatheringState:t.iceGatheringState,signalingState:t.signalingState,candidatesGathered:this.candidatesGathered,sdpOfferSent:this.sdpOfferSent,sdpAnswerReceived:this.sdpAnswerReceived}),this.clearIceDisconnectedGrace("pc-failed"),this.setState("failed");}else i==="closed"?(this.clearIceDisconnectedGrace("pc-closed"),this.setState("disconnected")):i==="disconnected"&&(d$2("[WebRTCTransport] pc.connectionState=disconnected, deferring to ICE grace period"),this.startIceDisconnectedGrace(n,t,e,"pc-disconnected"));},t.oniceconnectionstatechange=()=>{if(!this.isCurrentAttempt(n,void 0,t))return;let i=t.iceConnectionState;if(d$2(`[WebRTCTransport] ICE connection state: ${i}`,{gatheringState:t.iceGatheringState,signalingState:t.signalingState,candidatesGathered:this.candidatesGathered,hasSdpOffer:this.sdpOfferSent,hasSdpAnswer:this.sdpAnswerReceived,hasRemoteDescription:!!t.remoteDescription,hasLocalDescription:!!t.localDescription}),i==="failed"){if(this.iceDisconnectedGraceTimer){console.warn("[WebRTCTransport] ice failed during grace window \u2014 deferring to grace timer");return}console.error("[WebRTCTransport] ICE failed \u2014 likely NAT traversal issue or no matching candidates",{gatheringState:t.iceGatheringState,signalingState:t.signalingState,candidatesGathered:this.candidatesGathered}),this.clearIceDisconnectedGrace("ice-failed"),this.setState("failed");}else i==="disconnected"?this.startIceDisconnectedGrace(n,t,e,"ice-disconnected"):(i==="connected"||i==="completed")&&(this.iceDisconnectedGraceTimer&&d$2("[WebRTCTransport] ice-recovered \u2014 cancelling grace timer"),this.clearIceDisconnectedGrace("ice-recovered"),this.iceRestartAttempted=false,this.promoteConnectedIfReady("ice-connected"));},t.onicegatheringstatechange=()=>{this.isCurrentAttempt(n,void 0,t)&&d$2(`[WebRTCTransport] ICE gathering state: ${t.iceGatheringState}`,{iceConnectionState:t.iceConnectionState,signalingState:t.signalingState,hasLocalDesc:!!t.localDescription,hasRemoteDesc:!!t.remoteDescription});});}async createAndSendOffer(e,n){let t=this.pc;if(!(!t||!this.isCurrentAttempt(e,void 0,t))&&t.signalingState==="stable"&&!(this.sdpOfferSent&&t.localDescription?.type==="offer")&&!this.offerInFlight){d$2(`[WebRTCTransport] Creating offer (${n})`),this.offerInFlight=true;try{let i=await t.createOffer();if(await t.setLocalDescription(i),!this.isCurrentAttempt(e,void 0,t))return;if(this.sdpOfferSent=!0,this.internalSignalSender)try{await this.internalSignalSender({transport:"webrtc",type:"sdp",sdp:i,negotiationId:this.negotiationId??void 0});}catch(a){console.warn("[WebRTCTransport] Offer signaling failed (non-fatal)",{error:a,negotiationId:this.negotiationId,signalingState:t.signalingState,iceConnectionState:t.iceConnectionState});}else console.warn("[WebRTCTransport] No signal sender \u2014 offer not transmitted");}catch(i){console.error("[WebRTCTransport] Offer creation failed",i),this.closePeerResources(),this.setState("failed");}finally{this.isCurrentAttempt(e,void 0,t)&&(this.offerInFlight=false);}}}handleSignalingMessage(e){if(!this.pc||e.transport!=="webrtc")return;let n=this.normalizeNegotiationId(e?.negotiationId);if(n&&this.negotiationId&&n!==this.negotiationId){c("[WebRTCTransport] Ignoring stale signaling message for a different negotiation",{signalType:e?.type??null,signalNegotiationId:n,activeNegotiationId:this.negotiationId});return}if(e.type==="candidate"){let t=e.candidate;d$2("[WebRTCTransport] Received remote ICE candidate",{hasRemoteDesc:!!this.pc.remoteDescription,type:t?.type,protocol:t?.protocol,address:t?.address}),this.pc.remoteDescription?this.pc.addIceCandidate(t).catch(i=>{console.warn("[WebRTCTransport] addIceCandidate failed",i);}):(this.pendingCandidates.push(t),d$2(`[WebRTCTransport] Buffered remote candidate \u2014 ${this.pendingCandidates.length} pending`));}else if(e.type==="sdp"){let t=e.sdp,i=t.type==="offer",a=t.type==="answer";if(a&&this.pc.signalingState!=="have-local-offer"){c("[WebRTCTransport] Ignoring SDP answer because no local offer is pending",{signalingState:this.pc.signalingState,iceConnectionState:this.pc.iceConnectionState,signalNegotiationId:n,activeNegotiationId:this.negotiationId,hasLocalDescription:!!this.pc.localDescription,hasRemoteDescription:!!this.pc.remoteDescription});return}d$2(`[WebRTCTransport] Received SDP ${t.type} \u2014 applying remote description`),a&&(this.sdpAnswerReceived=true),this.pc.setRemoteDescription(t).then(async()=>{if(a&&(d$2("[WebRTCTransport] Remote SDP answer applied",{signalingState:this.pc?.signalingState,iceConnectionState:this.pc?.iceConnectionState,hasLocalDescription:!!this.pc?.localDescription,hasRemoteDescription:!!this.pc?.remoteDescription}),this.promoteConnectedIfReady("sdp-answer-applied")),this.pendingCandidates.length&&(d$2(`[WebRTCTransport] Flushing ${this.pendingCandidates.length} buffered candidate(s)`),this.pendingCandidates.forEach(s=>this.pc?.addIceCandidate(s)),this.pendingCandidates=[]),i){d$2("[WebRTCTransport] Creating answer (responder)");let s=await this.pc.createAnswer();if(await this.pc.setLocalDescription(s),d$2("[WebRTCTransport] Answer sent"),this.internalSignalSender)try{await this.internalSignalSender({transport:"webrtc",type:"sdp",sdp:s,negotiationId:n??this.negotiationId??void 0});}catch(c){throw console.warn("[WebRTCTransport] Failed sending SDP answer signal",{error:c,signalingState:this.pc?.signalingState,hasLocalDescription:!!this.pc?.localDescription,hasRemoteDescription:!!this.pc?.remoteDescription}),c}else console.warn("[WebRTCTransport] No signal sender \u2014 answer not transmitted");}}).catch(s=>{console.error(`[WebRTCTransport] setRemoteDescription (${t.type}) failed`,s),this.setState("failed");});}}async send(e){if(this.dc&&this.dc.readyState==="open"){let n=new Uint8Array(e);this.dc.send(n);}else throw new Error("WebRTC DataChannel not open")}getBufferedAmount(){return this.dc?.bufferedAmount??0}async waitForDrain(e){!this.dc||this.dc.bufferedAmount<=e||await new Promise(n=>{let t=this.dc;if(!t){n();return}t.bufferedAmountLowThreshold=e,t.onbufferedamountlow=()=>{t.onbufferedamountlow=null,n();};});}close(){this.closePeerResources(),this.setState("disconnected");}onMessage(e){this.messageListeners.push(e);}onStateChange(e){this.stateListeners.push(e);}setState(e){this.state!==e&&(this.state=e,(e==="connected"||e==="failed"||e==="disconnected")&&this.clearConnectTimeout(),this.stateListeners.forEach(n=>n(e)));}startConnectTimeout(e){this.clearConnectTimeout(),this.connectTimeoutId=setTimeout(()=>{this.activeAttemptId===e&&this.state==="connecting"&&(console.warn(`[WebRTCTransport] Timed out after ${d.ICE_CONNECT_TIMEOUT_MS}ms`,{iceState:this.pc?.iceConnectionState,gatheringState:this.pc?.iceGatheringState,signalingState:this.pc?.signalingState,candidatesGathered:this.candidatesGathered,sdpOfferSent:this.sdpOfferSent,sdpAnswerReceived:this.sdpAnswerReceived,hasRemoteDescription:!!this.pc?.remoteDescription,hasLocalDescription:!!this.pc?.localDescription}),this.setState("failed"));},d.ICE_CONNECT_TIMEOUT_MS);}clearConnectTimeout(){this.connectTimeoutId&&(clearTimeout(this.connectTimeoutId),this.connectTimeoutId=null);}startIceDisconnectedGrace(e,n,t,i){if(!this.iceDisconnectedGraceTimer){if(this.iceRestartAttempted)d$2("[WebRTCTransport] ice-disconnected grace (restart already attempted)",{reason:i});else if(this.iceRestartAttempted=true,t){try{d$2("[WebRTCTransport] ice-restart-attempted",{reason:i,isInitiator:t}),n.restartIce();}catch(a){console.warn("[WebRTCTransport] restartIce threw",a);}this.sendIceRestartOffer(e,n);}else d$2("[WebRTCTransport] ice-restart deferred to initiator",{reason:i});this.iceDisconnectedGraceTimer=setTimeout(()=>{if(this.iceDisconnectedGraceTimer=null,this.activeAttemptId!==e||this.pc!==n)return;let a=n.iceConnectionState,s=n.connectionState,c=this.dc?.readyState??"missing";if(a==="connected"||a==="completed"||s==="connected"||c==="open"){d$2("[WebRTCTransport] ice-grace expired \u2014 recovered",{ice:a,conn:s,dcReadyState:c});return}if(this.disconnectedGraceExtensions<1){this.disconnectedGraceExtensions+=1,console.warn("[WebRTCTransport] ice-grace expired \u2014 extending once before fail",{ice:a,conn:s,dcReadyState:c,extension:this.disconnectedGraceExtensions}),this.startIceDisconnectedGrace(e,n,t,`${i}:extended`);return}console.warn("[WebRTCTransport] ice-grace expired \u2014 marking failed",{ice:a,conn:s}),this.setState("failed");},d.ICE_DISCONNECTED_GRACE_MS);}}async sendIceRestartOffer(e,n){try{let t=await n.createOffer({iceRestart:!0});if(!this.isCurrentAttempt(e,void 0,n)||(await n.setLocalDescription(t),!this.isCurrentAttempt(e,void 0,n)))return;this.internalSignalSender?(await this.internalSignalSender({transport:"webrtc",type:"sdp",sdp:t,negotiationId:this.negotiationId??void 0}),d$2("[WebRTCTransport] ice-restart re-offer sent",{negotiationId:this.negotiationId})):console.warn("[WebRTCTransport] ice-restart re-offer dropped \u2014 no signal sender");}catch(t){console.warn("[WebRTCTransport] ice-restart re-offer failed",t);}}clearIceDisconnectedGrace(e){this.iceDisconnectedGraceTimer&&(clearTimeout(this.iceDisconnectedGraceTimer),this.iceDisconnectedGraceTimer=null);}promoteConnectedIfReady(e){let n=this.dc?.readyState??"missing";if(n!=="open"){d$2("[WebRTCTransport] Deferring connected state until DataChannel is open",{reason:e,dcReadyState:n,iceConnectionState:this.pc?.iceConnectionState,connectionState:this.pc?.connectionState});return}this.clearIceDisconnectedGrace(`connected:${e}`),this.disconnectedGraceExtensions=0,this.setState("connected");}closePeerResources(){this.activeAttemptId+=1,this.clearConnectTimeout(),this.clearIceDisconnectedGrace("close"),this.iceRestartAttempted=false,this.pendingCandidates=[],this._terminalFailure=false,this.negotiationId=null,this.disconnectedGraceExtensions=0,this.offerInFlight=false,this.dc&&(this.dc.onopen=null,this.dc.onmessage=null,this.dc.onclose=null,this.dc.onerror=null,this.dc.readyState!=="closed"&&this.dc.close(),this.dc=null),this.pc&&(this.pc.onicecandidate=null,this.pc.onnegotiationneeded=null,this.pc.onconnectionstatechange=null,this.pc.oniceconnectionstatechange=null,this.pc.connectionState!=="closed"&&this.pc.close(),this.pc=null);}isCurrentAttempt(e,n,t){return !(this.activeAttemptId!==e||n&&this.dc!==n||t&&this.pc!==t)}createNegotiationId(){return `ts-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}normalizeNegotiationId(e){if(typeof e!="string")return null;let n=e.trim();return n.length>0?n:null}};d.ICE_CONNECT_TIMEOUT_MS=v,d.ICE_DISCONNECTED_GRACE_MS=3e4;var h=d;var I={iroh:{available:false,reason:"iroh is constructed by the OpenRTC runtime, not the legacy ITransport factory."},"iroh-quic":{available:false,reason:"iroh-quic is a path label, not a standalone transport."},"iroh-relay":{available:false,reason:"iroh-relay is a path label, not a standalone transport."},"iroh-lan":{available:false,reason:"iroh-lan is a path label, not a standalone transport."},"iroh-webrtc":{available:false,reason:"iroh-webrtc is a runtime-owned carrier path, not a standalone transport."},"iroh-moq":{available:false,reason:"iroh-moq is a runtime-owned carrier path, not a standalone transport."},ble:{available:false,reason:"ble requires a separately licensed native host companion and current physical-device evidence."},webrtc:{available:true},"webrtc-lan":{available:false,reason:"webrtc-lan is a path label, not a standalone transport."},"webrtc-turn":{available:false,reason:"webrtc-turn is a path label, not a standalone transport."},moq:{available:false,reason:"MoQ is constructed by the route lifecycle, not the legacy ITransport factory."}};function w(r){return r.implementation==="route-adapter"?"plugin":r.implementation==="core"?"native":"path-label"}function A(){return Object.fromEntries(a.map(r=>[r.id,{...r,routeImplementation:r.implementation,implementation:w(r),protocol:r.id,preferredRank:d$1[r.id],...I[r.id]}]))}var f=class{static createTransport(e){if(this.assertProtocolAvailable(e),e==="webrtc")return new h;throw new Error(`[TransportFactory] '${e}' is not implemented as an ITransport plugin.`)}static getProtocolCapability(e){return {...this.capabilityMap[e]}}static getProtocolCapabilities(){return Object.fromEntries(a.map(e=>[e.id,this.getProtocolCapability(e.id)]))}static preferredProtocols(e={}){let n=e.runtime??"any",t=e.includePathLabels??true;return a.filter(i=>t||i.implementation!=="path-label").filter(i=>n==="browser"?i.browser:n==="native"?i.native:i.browser||i.native).sort((i,a)=>d$1[i.id]-d$1[a.id]).map(i=>i.id)}static assertProtocolAvailable(e){let n=this.capabilityMap[e];if(!n.available||n.maturity==="unsupported"){let t=n.reason?` ${n.reason}`:"";throw new Error(`[TransportFactory] Protocol '${e}' is unsupported.${t}`)}}};f.capabilityMap=A();function _(r){return f.preferredProtocols(r)}var g=32,S="openrtc:x25519-hkdf:v1",C=new TextEncoder().encode("openrtc:application-crypto:v1");function u(r,e){if(!(e instanceof Uint8Array)||e.byteLength!==g)throw new Error(`[OpenRTC] ${r} must be ${g} bytes`)}function E(r,e){let[n,t]=r<=e?[r,e]:[e,r],i=new TextEncoder().encode(n),a=new TextEncoder().encode(t),s=new Uint8Array(C.byteLength+1+i.byteLength+1+a.byteLength),c=0;return s.set(C,c),c+=C.byteLength,s[c]=0,c+=1,s.set(i,c),c+=i.byteLength,s[c]=0,c+=1,s.set(a,c),s}function K(r=e=>{let n=new Uint8Array(e);return globalThis.crypto.getRandomValues(n),n}){let e=r(g);return u("key agreement secret",e),{publicKey:x25519.getPublicKey(e),secretKey:e}}function M(r,e,n,t){u("key agreement local secret",r),u("key agreement remote public key",e);let i=x25519.getSharedSecret(r,e);return hkdf(sha256,i,void 0,E(n,t),32)}function $(r){return Array.from(sha256(r).slice(0,6),e=>e.toString(16).padStart(2,"0")).join("")}function F(r){u("key agreement public key",r);let e="";for(let t=0;t<r.byteLength;t+=1)e+=String.fromCharCode(r[t]);let n=btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return {algorithm:S,publicKey:n}}function k(r){if(!r||r.algorithm!==S)return null;let e=typeof r.publicKey=="string"?r.publicKey.trim():"";if(!e)return null;let n=e.replace(/-/g,"+").replace(/_/g,"/"),t=n.length%4===0?n:n+"=".repeat(4-n.length%4),i=Uint8Array.from(atob(t),a=>a.charCodeAt(0));return i.byteLength!==g?null:i}
|
|
2
|
-
export{v as a,f as b,_ as c,g as d,S as e,K as f,M as g,$ as h,F as i,k as j};
|
package/dist/chunk-DUY34MGT.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var n=class{constructor(r){this.transmit=r;this.pending=null;this.running=false;this.closedError=null;}send(r){return this.closedError?Promise.reject(this.closedError):new Promise((i,e)=>{this.pending&&this.pending.resolve(),this.pending={payload:r.slice(),resolve:i,reject:e},this.pump();})}close(r=new Error("Latest-state channel is closed.")){this.closedError=r;let i=this.pending;this.pending=null,i?.reject(r);}pump(){this.running||this.closedError||(this.running=true,(async()=>{for(;this.pending&&!this.closedError;){let r=this.pending;this.pending=null;try{await this.transmit(r.payload),r.resolve();}catch(i){r.reject(i);}}})().finally(()=>{this.running=false,this.pending&&!this.closedError&&this.pump();}));}};export{n as a};
|
package/dist/chunk-HEAJ7ZUR.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var o=["iroh-relay","iroh-moq","iroh"],l=new Set(["iroh","iroh-quic","iroh-relay","iroh-lan","iroh-webrtc","iroh-moq","ble"]);function T(r){return r?.filter(n=>l.has(n))}function u(r){return (Array.isArray(r.urls)?r.urls:[r.urls]).some(e=>typeof e=="string"&&(e.startsWith("turn:")||e.startsWith("turns:")))}function a(r){let e=(Array.isArray(r.urls)?r.urls:[r.urls]).filter(t=>typeof t=="string"&&!t.startsWith("stun:"));return e.length===0?null:{...r,urls:Array.isArray(r.urls)?e:e[0]}}function c(r){let e=(Array.isArray(r.urls)?r.urls:[r.urls]).filter(t=>{let i=typeof t=="string"?t.trim().toLowerCase():"";return !i.startsWith("turn:")&&!i.startsWith("turns:")});return e.length===0?null:{...r,urls:Array.isArray(r.urls)?e:e[0]}}function f(r){return r?.map(n=>c(n)).filter(n=>n!==null)}function d(r){if(r)return r.map(n=>a(n)).filter(n=>n!==null)}function y(r,n){let e=new Set(["iroh-relay","iroh-moq","iroh"]);n&&e.add("iroh-webrtc");let t=(r??o).filter(i=>e.has(i));return t.length>0?t:[...o]}function C(r){return false}function p(r,n){}function R(r,n){let e=r?.transports?.webrtc;if(e)return e===true?{}:s(r,n)}function s(r,n){let e=r?.transports?.webrtc||void 0;if(e)return r?.transports?.relay===false?{...e,useTurn:false,privacyMode:false,iceTransportPolicy:"all",iceServers:f(e.iceServers)}:r?.strictMode||r?.transports?.privacy==="relay-only"||e.privacyMode?{...e,iceServers:d(e.iceServers),iceTransportPolicy:"relay"}:e.iceTransportPolicy==="relay"&&!(Array.isArray(e.iceServers)&&e.iceServers.some(i=>u(i)))?(n?.("[Client] Overriding relay-only ICE policy to all because no TURN servers are configured"),{...e,iceTransportPolicy:"all"}):e}export{T as a,d as b,y as c,C as d,p as e,R as f};
|
package/dist/chunk-HUG5AX7R.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function a(n){let e=String(n?.message??n??"").toLowerCase();return e?e.includes("__tauri_internals__")||e.includes("window is not defined")||e.includes("cannot read properties of undefined")?"runtime-unavailable":e.includes("timeout after")?"timeout":e.includes("not found")||e.includes("not allowed")||e.includes("unknown command")||e.includes("plugin not found")||e.includes("plugin:openrtc-tauri-plugin")?"command-unavailable":"unknown":"unknown"}function s(n){return a(n)==="command-unavailable"}function u(n,e="native runtime"){if(!n||typeof n!="object")throw new Error(`[openrtc] ${e} requires a valid IPC bridge object.`);if(typeof n.invoke!="function")throw new Error(`[openrtc] ${e} IPC bridge is missing invoke(command, args).`);if(typeof n.listen!="function")throw new Error(`[openrtc] ${e} IPC bridge is missing listen(event, handler).`);return n}var t=null;async function l(){return t||(t=(async()=>{let n="openrtc-tauri",e="../../../tauri/src/runtime/ipc";try{return await import(n)}catch(r){try{return await import(e)}catch(i){let o=new Error("[openrtc] Native support now lives in the first-party `openrtc-tauri` package. Install `openrtc-tauri` (and `@tauri-apps/api`) or pass an explicit IPC bridge to OpenRTC.native(...).");throw o.cause={packageError:r,workspaceError:i},o}}})()),t}function c(){let n=null,e=async()=>(n||(n=l().then(r=>u(r.createBridge(),"openrtc-tauri"))),n);return {async invoke(r,i){return (await e()).invoke(r,i)},async listen(r,i){return (await e()).listen(r,i)},async isAvailable(){try{let r=await e();return typeof r.isAvailable=="function"?!!await r.isAvailable():!0}catch{return false}}}}export{a,s as b,u as c,c as d};
|
package/dist/chunk-Q6KXVTSH.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {b as b$1}from'./chunk-ZA44REGI.js';var D=1440*6e4,g=class extends Error{constructor(i,r,n){super(i);this.status=r;this.reason=n;this.name="RTCError";let e=[502,503,504].includes(r),a=n==="device-reenrollment-auth-required";this.code=a?"auth/device-reenrollment-required":e?"coordination/service-unavailable":r===429?"coordination/rate-limited":r===401?"auth/expired":r===403?"admission/denied":"internal/error",this.retryable=a||e,this.plane=a||r===401?"auth":e||r===429?"coordination":r===403?"admission":"internal";}};function C(s){return !(s instanceof g)||s.status!==403?false:s.reason==="device-certificate-stale"||s.reason==="device-certificate-revoked"?true:!s.reason&&s.message==="Device certificate is revoked or stale."}function b(s,t,i){return `openrtc:v2:device-certificate:${s}:${t}:${i}`}function k(s,t){return `openrtc:v2:device-session:${s}:${t}`}async function K(s,t,i){let r=new TextEncoder().encode(`openrtc:v2:session\0${s}\0${t}\0${i}`),n=new Uint8Array(await crypto.subtle.digest("SHA-256",r)),e="";for(let a of n)e+=String.fromCharCode(a);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function P(s){let t=s.replace(/-/g,"+").replace(/_/g,"/"),i=t.padEnd(Math.ceil(t.length/4)*4,"="),r=atob(i);return Uint8Array.from(r,n=>n.charCodeAt(0))}async function R(s,t,i,r,n){if(typeof s.token!="string"||typeof s.expiresAtMs!="number"||s.expiresAtMs<=Date.now()+D||!s.signingPublicJwk||s.signingPublicJwk.kty!=="OKP"||s.signingPublicJwk.crv!=="Ed25519"||typeof s.signingPublicJwk.x!="string")return null;let e=s.token.split(".");if(e.length!==3)return null;let a,o;try{a=JSON.parse(new TextDecoder().decode(P(e[0]))),o=b$1(s.token);}catch{return null}if(a.alg!=="EdDSA"||s.signingPublicJwk.kid&&a.kid!==s.signingPublicJwk.kid)return null;try{let l=await crypto.subtle.importKey("jwk",s.signingPublicJwk,{name:"Ed25519"},!1,["verify"]);if(!await crypto.subtle.verify({name:"Ed25519"},l,P(e[2]),new TextEncoder().encode(`${e[0]}.${e[1]}`)))return null}catch{return null}let c=typeof o.principalId=="string"?o.principalId:"",d=Number(o.iat),u=Number(o.exp);return o.iss!=="openrtc"||o.aud!=="openrtc:v2:gateway-grant"||o.typ!=="device-certificate"||o.appTag!==t||!c||n!==void 0&&c!==n||typeof o.principalKey!="string"||o.principalKey.length===0||o.deviceId!==i||o.deviceKeyThumbprint!==r||typeof o.jti!="string"||o.jti.length===0||!Number.isSafeInteger(d)||!Number.isSafeInteger(u)||d>=u||u*1e3!==s.expiresAtMs?null:{token:s.token,expiresAtMs:s.expiresAtMs,principalId:c,signingPublicJwk:s.signingPublicJwk,enrolled:false,relay:o.relay!==false}}async function x(s,t,i,r,n){try{let e=b(t,i,r),a=s.readSecureRecord?await s.readSecureRecord(t,e):globalThis.localStorage?.getItem(e);if(!a)return null;let o=JSON.parse(a),c=await R(o,t,r,n,i);return c?{token:c.token,expiresAtMs:c.expiresAtMs,principalId:i,signingPublicJwk:c.signingPublicJwk}:null}catch(e){if(s.readSecureRecord)throw e;return null}}async function T(s,t,i,r,n){try{let e=k(t,r),a=s.readSecureRecord?await s.readSecureRecord(i,e):globalThis.localStorage?.getItem(e);return a?await R(JSON.parse(a),i,r,n):null}catch(e){if(s.readSecureRecord)throw e;return null}}async function M(s,t,i,r,n){try{let e=b(t,i,r),a=JSON.stringify(n);s.writeSecureRecord?await s.writeSecureRecord(t,e,a):globalThis.localStorage?.setItem(e,a);}catch(e){if(s.writeSecureRecord)throw e}}async function G(s,t,i,r,n){try{let e=k(i,r),a=JSON.stringify({token:n.token,expiresAtMs:n.expiresAtMs,principalId:n.principalId,signingPublicJwk:n.signingPublicJwk});s.writeSecureRecord?await s.writeSecureRecord(t,e,a):globalThis.localStorage?.setItem(e,a);}catch(e){if(s.writeSecureRecord)throw e}}async function m(s,t,i,r,n){try{let e=b(t,i,r);if(s.deleteSecureRecord?await s.deleteSecureRecord(t,e):globalThis.localStorage?.removeItem(e),n){let a=k(n,r);s.deleteSecureRecord?await s.deleteSecureRecord(t,a):globalThis.localStorage?.removeItem(a);}}catch(e){if(s.deleteSecureRecord)throw e}}function S(s){return `${s}_${crypto.randomUUID()}`}async function I(s,t){let i=new TextEncoder().encode(`${s}:${t}`);return [...new Uint8Array(await crypto.subtle.digest("SHA-256",i))].map(n=>n.toString(16).padStart(2,"0")).join("")}var A=class{constructor(t,i,r,n,e={},a){this.apiKey=t;this.endpoints=i;this.keyProvider=r;this.attestation=n;this.events=e;this.botVerification=a;this.keyPromise=null;this.authEpochs=new Map;this.appTag=`app_${t.slice(-16)}`;}record(t){this.events.onLogicalOperation?.(t);}before(t){this.events.beforeLogicalOperation?.(t);}authEpoch(t){let i=this.authEpochs.get(t);if(i)return i;let r={generation:0,devices:new Map};return this.authEpochs.set(t,r),t.subscribe&&(r.unsubscribe=t.subscribe(n=>{n?.type==="principal-changed"&&(r.generation+=1,r.devices.clear(),r.sessionKeyHash=void 0,this.events.onAuthEpochChanged?.(t));})),r}dispose(){for(let t of this.authEpochs.values())t.unsubscribe?.();this.authEpochs.clear();}key(){return this.keyPromise??(this.keyPromise=this.keyProvider.getOrCreate(this.appTag))}async post(t,i){let r=S("request"),n=JSON.stringify({apiKey:this.apiKey,...i}),e=null;for(let a=0;a<2;a+=1)try{let o=await fetch(`${this.endpoints.controlPlane}${t}`,{method:"POST",headers:{"Content-Type":"application/json","X-OpenRTC-Idempotency-Key":r},body:n,signal:AbortSignal.timeout(15e3)});if(o.ok)return o.json();let c=`OpenRTC request failed (${o.status}).`,d;try{let l=await o.json();typeof l.error=="string"&&(c=l.error.slice(0,256)),typeof l.reason=="string"&&/^[a-z0-9-]{1,80}$/.test(l.reason)&&(d=l.reason);}catch{}let u=new g(c,o.status,d);if(e=u,a===0&&[502,503,504].includes(o.status))continue;throw u}catch(o){if(e=o,a===0&&o instanceof TypeError)continue;throw o}throw e instanceof Error?e:new Error("OpenRTC request failed.")}async capability(t,i,r,n=false){this.before("capability.issue");let e=t==="space"?await I(this.apiKey,i):i,o=await(await this.key()).proof((l,p)=>["openrtc:v2:capability",this.apiKey,t,e,l,p].join(":")),c=this.botVerification?await this.botVerification.getToken({action:"openrtc_capability",apiKey:this.apiKey}):void 0,d=await this.post("/v2/capabilities",{avenue:{kind:t,id:e},deviceProof:o,...r?{maxPeers:r}:{},...n?{advancedFanout:true}:{},...c?{turnstileToken:c}:{}});this.record("capability.issue");let u={type:"capability",token:d.capability,avenue:t==="ticket"?{kind:"session",id:e}:d.avenue,expiresAtMs:d.expiresAt*1e3,relay:d.relay!==false};return u.renew=()=>this.capability(t,i,r,n),u}async deviceCertificate(t,i,r,n,e){let a=this.authEpoch(t),o=a.devices.get(i)??{};if(a.devices.set(i,o),e&&o.current&&o.current.token!==e.token)return this.deviceCertificateResult(t,i,r,n,{...o.current,enrolled:false});if(!e&&o.current&&o.current.expiresAtMs>Date.now()+D)return this.deviceCertificateResult(t,i,r,n,{...o.current,enrolled:false});if(!o.inFlight){let d=a.generation;e&&(o.current=void 0,o.recoverRevokedEnrollment=true);let u=e?m(this.keyProvider,this.appTag,e.principalId,i,a.sessionKeyHash).then(()=>this.enrollAuthenticatedDevice(t,i,a.sessionKeyHash,n,true)):this.resolveAuthenticatedDevice(t,i,a,n,o.recoverRevokedEnrollment===true);o.inFlight=u.then(l=>{if(a.generation!==d)throw new Error("The OpenRTC authentication identity changed during enrollment.");return o.recoverRevokedEnrollment=false,o.current=l,l}).finally(()=>{o.inFlight=void 0;});}let c=await o.inFlight;return this.deviceCertificateResult(t,i,r,n,c)}async resolveAuthenticatedDevice(t,i,r,n,e=false){let a=await this.key();if(t.getSessionKey){let o=await t.getSessionKey();if(!o)throw new Error("The OpenRTC auth provider has no active principal.");let c=await K(this.appTag,a.thumbprint,o);r.sessionKeyHash=c;let d=await T(this.keyProvider,c,this.appTag,i,a.thumbprint);if(d)return d}return this.enrollAuthenticatedDevice(t,i,r.sessionKeyHash,n,e)}deviceCertificateResult(t,i,r,n,e){let a={type:"device-certificate",token:e.token,avenue:r??{kind:"user",id:e.principalId},expiresAtMs:e.expiresAtMs,relay:e.relay};return a.renew=async()=>(await this.deviceCertificate(t,i,r,n)).source,a.recoverRejectedCertificate=async()=>(await this.deviceCertificate(t,i,r,n,e)).source,{principalId:e.principalId,source:a,enrolled:e.enrolled}}async enrollAuthenticatedDevice(t,i,r,n,e=false){this.before("identity.assertion.exchange"),this.before("identity.monthly-active-principal");let a=async(v,y)=>{let w=await t.getAssertion({audience:"https://api.openrtc.app/v2/assertions/exchange",forceRefresh:v,deviceId:i,...{}});if(!w)throw new Error("The OpenRTC auth provider returned no assertion.");return this.post("/v2/assertions/exchange",{assertion:w,deviceId:i,...t.providerId?{providerId:t.providerId}:{}})},o;try{o=await a(!1);}catch(v){if(!(v instanceof g)||v.status!==401)throw v;o=await a(true);}this.record("identity.assertion.exchange"),this.record("identity.monthly-active-principal");let c=await this.key(),d=await x(this.keyProvider,this.appTag,o.principalId,i,c.thumbprint);if(d)return {...d,principalId:o.principalId,enrolled:false,relay:o.relay!==false};this.before("device.enroll"),this.attestation&&this.before("security.attestation.verify");let{enrollDevice:u}=await import('./deviceEnrollment-VACC64CQ.js'),l=await u({apiKey:this.apiKey,appTag:this.appTag,auth:t,attestation:this.attestation,deviceId:i,identity:o,key:c,profile:n,recoverRevokedEnrollment:e||o.deviceRecoveryAuthorized===true,post:(v,y)=>this.post(v,y),recordAssertionExchange:()=>this.record("identity.assertion.exchange")});o=l.identity;let p=l.enrollment;this.record("device.enroll"),this.attestation&&this.record("security.attestation.verify");let h={principalId:o.principalId,token:p.deviceCertificate,expiresAtMs:p.expiresAt*1e3,signingPublicJwk:p.signingPublicJwk,enrolled:true,relay:o.relay!==false};return await M(this.keyProvider,this.appTag,o.principalId,i,{token:h.token,expiresAtMs:h.expiresAtMs,signingPublicJwk:h.signingPublicJwk}),r&&await G(this.keyProvider,this.appTag,r,i,h),h}async listEnrolledDevices(t,i){let r=await this.deviceCertificate(t,i);return (await this.deviceManagement(r.source,i,"list")).devices??[]}async revokeDevice(t,i,r){let n=await this.deviceCertificate(t,i);if(await this.deviceManagement(n.source,i,"revoke",r),r===i){let e=this.authEpoch(t);await m(this.keyProvider,this.appTag,n.principalId,i,e.sessionKeyHash),e.devices.delete(i),await this.deleteDeviceKey();}}async revokeAllDevices(t,i,r){let n=await this.deviceCertificate(t,i);await this.deviceManagement(n.source,i,"revoke-all",void 0,r);let e=this.authEpoch(t);await m(this.keyProvider,this.appTag,n.principalId,i,e.sessionKeyHash),e.devices.delete(i),r?await this.deviceCertificate(t,i):(e.devices.clear(),await this.deleteDeviceKey());}async deleteDeviceKey(){this.keyPromise=null,await this.keyProvider.delete?.(this.appTag);}async deviceManagement(t,i,r,n,e=false){let a=r==="revoke"?"device.revoke":r==="revoke-all"?"identity.revoke-all":null;a&&this.before(a);let{manageDevice:o}=await import('./deviceManagement-SUMBRXXC.js'),c=await o({source:t,currentDeviceId:i,action:r,targetDeviceId:n,exceptCurrent:e,key:()=>this.key(),post:d=>this.post("/v2/devices/manage",d),isStale:C});return a&&this.record(a),c}async durableRoomMembership(t,i,r){if(t.type!=="device-certificate")throw new Error("Durable rooms require a device certificate.");this.before(r==="join"?"room.join":"room.leave");let n=b$1(t.token),e=String(n.jti??""),o=await(await this.key()).proof((c,d)=>["openrtc:v2:room-membership",e,r,i,c,d].join(":"));await this.post("/v2/rooms/memberships",{action:r,roomId:i,deviceCertificate:t.token,deviceProof:o}),this.record(r==="join"?"room.join":"room.leave");}grantProvider(t,i={}){let r=null,n=t;return async e=>{if(r)return r;let a=(async()=>{let o=false;n.expiresAtMs<=Date.now()+5*6e4&&n.renew&&(n=await n.renew(),o=true);let c=e.refreshGrant?"gateway.grant.refresh":"gateway.grant.issue";this.before(c),e.refreshGrant&&this.before("coordination.credential.refresh");let d=async l=>{let p=b$1(l.token),h=String(p.jti??""),y=await(await this.key()).proof((w,E)=>["openrtc:v2:gateway-grant",h,e.avenue.kind,e.avenue.id,e.runtimeInstanceId,w,E].join(":"));return this.post("/v2/gateway/grants",{credentialType:l.type,credential:l.token,avenue:e.avenue,runtimeInstanceId:e.runtimeInstanceId,ticketFingerprint:e.ticketFingerprint,deviceProof:y,...e.refreshGrant?{refreshGrant:e.refreshGrant}:{},...i.maxPeers?{maxPeers:i.maxPeers}:{},...i.features?{features:i.features}:{},...l.type==="device-certificate"&&i.deviceProfile?{deviceProfile:i.deviceProfile}:{}})},u;try{u=await d(n);}catch(l){if(!C(l))throw l;let p=await n.recoverRejectedCertificate?.();if(!p)throw l;n=p,o=true,u=await d(n);}return this.record(c),e.refreshGrant&&this.record("coordination.credential.refresh"),o&&await i.onSourceRenewed?.({token:n.token,expiresAtMs:n.expiresAtMs}),u})();r=a;try{return await a}finally{r===a&&(r=null);}}}turnProvider(t){let i=S("relay"),r=null,n=null;return async()=>{if(r&&r.expiresAtMs>Date.now()+5*6e4)return r;if(n)return n;let e=(async()=>{let a=t(),o=b$1(a.token),c=String(o.jti??""),u=await(await this.key()).proof((p,h)=>["openrtc:v2:relay-turn",c,i,p,h].join(":")),l=await this.post("/v2/relay/turn",{credentialType:a.type,credential:a.token,sessionId:i,deviceProof:u});return r=l,l})();n=e;try{return await e}finally{n===e&&(n=null);}}}};
|
|
2
|
-
export{A as a};
|
package/dist/chunk-R35AWMNY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {v}from'./chunk-Z2IS6NH2.js';var a=class{constructor(e){this.backend=e;}get currentUser(){return this.backend.currentUser}setAuthContext(e){return this.backend.setAuthContext?.(e)}async signInAnonymously(){return this.backend.signInAnonymously()}async signInWithPluto(){if(typeof this.backend.signInWithPluto!="function")throw new Error("Selected runtime adapter does not support Pluto SSO.");return this.backend.signInWithPluto()}async signOut(){return this.backend.signOut()}async stopAuthActivity(){typeof this.backend.stopAuthActivity=="function"&&await this.backend.stopAuthActivity();}usesCoordinationGateway(){return this.backend.usesCoordinationGateway?.()===true}async joinCoordinationRoom(e,n,t){if(!this.backend.joinCoordinationRoom)throw new Error("Selected runtime adapter does not support coordination rooms.");await this.backend.joinCoordinationRoom(e,n,t);}async leaveCoordinationRoom(e){if(!this.backend.leaveCoordinationRoom)throw new Error("Selected runtime adapter does not support coordination rooms.");await this.backend.leaveCoordinationRoom(e);}async getCoordinationRoomMembers(e){if(!this.backend.getCoordinationRoomMembers)throw new Error("Selected runtime adapter does not support coordination rooms.");return this.backend.getCoordinationRoomMembers(e)}watchCoordinationRoomMembers(e,n){if(!this.backend.watchCoordinationRoomMembers)throw new Error("Selected runtime adapter does not support coordination rooms.");return this.backend.watchCoordinationRoomMembers(e,n)}async getTurnCredentials(){return this.backend.getTurnCredentials()}async updatePresence(e,n,t,i,r){return this.backend.updatePresence(e,n,t,i,r)}async refreshLivePresence(e,n,t){if(typeof this.backend.refreshLivePresence!="function")throw new Error("Selected runtime adapter does not support refreshLivePresence().");return this.backend.refreshLivePresence(e,n,t)}async setOffline(e){return this.backend.setOffline(e)}async cleanupStaleDevices(){return this.backend.cleanupStaleDevices()}async searchDevices(e){return this.backend.searchDevices(e)}async listDeviceStatus(){if(typeof this.backend.listDeviceStatus!="function")throw new Error("Selected runtime adapter does not support listDeviceStatus().");return this.backend.listDeviceStatus()}async getPeerSession(e){return typeof this.backend.getPeerSession!="function"?null:this.backend.getPeerSession(e)}async listPeerSessions(){return typeof this.backend.listPeerSessions!="function"?[]:this.backend.listPeerSessions()}async waitForSettledPeer(e,n){return typeof this.backend.waitForSettledPeer!="function"?null:this.backend.waitForSettledPeer(e,n)}async resolvePeerIdentity(e){return typeof this.backend.resolvePeerIdentity!="function"?{peerId:null,deviceId:null,deviceIdHint:null,nodeId:null}:this.backend.resolvePeerIdentity(e)}async resolvePeerRecords(e){return typeof this.backend.resolvePeerRecords!="function"?[]:this.backend.resolvePeerRecords(e)}async updateDevice(e,n){return this.backend.updateDevice(e,n)}async deleteDevice(e){return this.backend.deleteDevice(e)}onDevicesChange(e,n){return this.backend.onDevicesChange(e,n)}onAuthChange(e){return this.backend.onAuthChange(e)}async checkForSSOToken(){return this.backend.checkForSSOToken()}async waitForAuth(){return this.backend.waitForAuth()}async sendMessage(e,n,t,i){return this.backend.sendMessage(e,n,t,i)}async pollMessages(e){return this.backend.pollMessages(e)}watchFriendDevices(e,n){let t=this.backend;return t.watchFriendDevices?t.watchFriendDevices(e,n):()=>{}}async updateFriendTicket(e){let n=this.backend;n.updateFriendTicket&&await n.updateFriendTicket(e);}async subscribeDevices(e){return this.backend.subscribeDevices(e)}startAutoConnect(e,n){this.backend.startAutoConnect(e,n);}async submitDesiredPeerProjection(e,n){if(typeof this.backend.submitDesiredPeerProjection!="function")throw new Error("Selected runtime adapter does not support desired-peer projections.");await this.backend.submitDesiredPeerProjection(e,n);}startPresenceLoop(e,n,t,i,r){this.backend.startPresenceLoop(e,n,t,i,r);}async createSession(e){return this.backend.createSession(e)}async updateSession(e,n){return this.backend.updateSession(e,n)}async subscribeSessions(e){return this.backend.subscribeSessions(e)}forceReconnect(){this.backend.forceReconnect();}async getLocalDeviceId(){return typeof this.backend.getLocalDeviceId!="function"?null:this.backend.getLocalDeviceId()}async getLocalDeviceInfo(){return typeof this.backend.getLocalDeviceInfo!="function"?null:this.backend.getLocalDeviceInfo()}async updateDeviceName(e){return typeof this.backend.updateDeviceName!="function"?null:this.backend.updateDeviceName(e)}async startNativeSession(e){let n=this.backend;if(typeof n.startNativeSession!="function")throw new Error("Selected runtime adapter does not support startNativeSession().");return n.startNativeSession(e)}async notifyNetworkChange(e){return typeof this.backend.notifyNetworkChange!="function"?null:this.backend.notifyNetworkChange(e)}async getManagedNodeId(e){if(console.info("[DelegatingRuntimeAdapter][getManagedNodeId] enter",{hasMethod:typeof this.backend.getManagedNodeId=="function",backendCtor:this.backend.constructor?.name??null}),typeof this.backend.getManagedNodeId!="function")return null;let n=await this.backend.getManagedNodeId(e);return console.info("[DelegatingRuntimeAdapter][getManagedNodeId] resolved",{result:n}),n}async startPresence(e,n,t,i,r){let o=this.backend;if(typeof o.startPresence!="function")throw new Error("Selected runtime adapter does not support startPresence().");return o.startPresence(e,n,t,i,r)}async startAutoConnectOnce(e,n){let t=this.backend;if(typeof t.startAutoConnectOnce!="function")throw new Error("Selected runtime adapter does not support startAutoConnectOnce().");return t.startAutoConnectOnce(e,n)}async getEndpointTicket(){if(typeof this.backend.getEndpointTicket!="function")throw new Error("Selected runtime adapter does not support getEndpointTicket().");return this.backend.getEndpointTicket()}async getTicketWithToken(e,n){let t=this.backend;return typeof t.getTicketWithToken!="function"?null:t.getTicketWithToken(e,n)}async registerSessionToken(e,n,t,i){let r=this.backend;typeof r.registerSessionToken=="function"&&await r.registerSessionToken(e,n,t,i);}async revokeTokens(e){let n=this.backend;return typeof n.revokeTokens!="function"?[]:n.revokeTokens(e)}async openPeerBi(e,n){if(typeof this.backend.openPeerBi!="function")throw new Error("Selected runtime adapter does not support openPeerBi().");return this.backend.openPeerBi(e,n)}async incoming_streams(){let e=this.backend;if(typeof e.incoming_streams!="function")throw new Error("Selected runtime adapter does not support incoming_streams().");return e.incoming_streams()}async isCurrentTransport(e,n){let t=this.backend;return typeof t.is_current_transport_stable_id!="function"?false:t.is_current_transport_stable_id(e,n)}async openPeerNativeBi(e,n,t){let i=this.backend;if(typeof i.openPeerNativeBi!="function")throw new Error("Selected runtime adapter does not support openPeerNativeBi().");return i.openPeerNativeBi(e,n,t)}async openPeerBiRaw(e,n){let t=this.backend;return typeof t.openPeerBiRaw=="function"?t.openPeerBiRaw(e,n):this.openPeerBi(e,n)}async openPeerUni(e,n){if(typeof this.backend.openPeerUni!="function")throw new Error("Selected runtime adapter does not support openPeerUni().");return this.backend.openPeerUni(e,n)}async connectToDevice(e){if(typeof this.backend.connectToDevice!="function")throw new Error("Selected runtime adapter does not support connectToDevice().");return this.backend.connectToDevice(e)}async disconnectDevice(e){if(typeof this.backend.disconnectDevice!="function")throw new Error("Selected runtime adapter does not support disconnectDevice().");return this.backend.disconnectDevice(e)}async excludeAutoConnect(e,n){if(typeof this.backend.excludeAutoConnect!="function")throw new Error("Selected runtime adapter does not support excludeAutoConnect().");return this.backend.excludeAutoConnect(e,n)}async isConnected(e){return this.backend.isConnected(e)}async getConnectionStates(){return typeof this.backend.getConnectionStates!="function"?[]:this.backend.getConnectionStates()}onStateChange(e){return typeof this.backend.onStateChange!="function"?()=>{}:this.backend.onStateChange(e)}async sendExplicitFilePath(e,n,t){if(typeof this.backend.sendExplicitFilePath!="function")throw new Error("Selected runtime adapter does not support sendExplicitFilePath().");return this.backend.sendExplicitFilePath(e,n,t)}async sendExplicitFileData(e){if(typeof this.backend.sendExplicitFileData!="function")throw new Error("Selected runtime adapter does not support sendExplicitFileData().");return this.backend.sendExplicitFileData(e)}async getTransferHistory(e){return typeof this.backend.getTransferHistory!="function"?[]:this.backend.getTransferHistory(e)}async deleteTransferJob(e){if(typeof this.backend.deleteTransferJob=="function")return this.backend.deleteTransferJob(e)}capabilities(){let e=this.backend;return typeof e.capabilities=="function"?e.capabilities():v()}async onIncomingNativeMessage(e){let n=this.backend;return typeof n.onIncomingNativeMessage!="function"?()=>{}:n.onIncomingNativeMessage(e)}unwrap(){return this.backend}setCoreClient(e){let n=this.backend;typeof n.setCoreClient=="function"&&n.setCoreClient(e);}};export{a};
|