openrtc 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -0
- package/dist/OpenRTC.d.ts +71 -0
- package/dist/OpenRTC.js +130 -0
- package/dist/api/MediaTransport.d.ts +7 -0
- package/dist/api/MediaTransport.js +262 -0
- package/dist/api/PlutoPeerConnection.d.ts +50 -0
- package/dist/api/PlutoPeerConnection.js +434 -0
- package/dist/api/PlutoWebSocket.d.ts +24 -0
- package/dist/api/PlutoWebSocket.js +113 -0
- package/dist/api/PlutoWebTransport.d.ts +29 -0
- package/dist/api/PlutoWebTransport.js +105 -0
- package/dist/auth/host.d.ts +73 -0
- package/dist/auth/host.js +513 -0
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.js +1 -0
- package/dist/auth/internal.d.ts +1 -0
- package/dist/auth/internal.js +1 -0
- package/dist/compat/index.d.ts +20 -0
- package/dist/compat/index.js +20 -0
- package/dist/core/Client.d.ts +352 -0
- package/dist/core/Client.js +3689 -0
- package/dist/core/Connection.d.ts +67 -0
- package/dist/core/Connection.js +404 -0
- package/dist/core/IEngineBridge.d.ts +18 -0
- package/dist/core/IEngineBridge.js +1 -0
- package/dist/core/ISignalingTransport.d.ts +13 -0
- package/dist/core/ISignalingTransport.js +1 -0
- package/dist/core/PeerLifecycleManager.d.ts +43 -0
- package/dist/core/PeerLifecycleManager.js +330 -0
- package/dist/core/PeerProjectionStore.d.ts +43 -0
- package/dist/core/PeerProjectionStore.js +327 -0
- package/dist/core/PlutoRTC.d.ts +13 -0
- package/dist/core/PlutoRTC.js +26 -0
- package/dist/core/Room.d.ts +47 -0
- package/dist/core/Room.js +376 -0
- package/dist/core/Signaling.d.ts +39 -0
- package/dist/core/Signaling.js +147 -0
- package/dist/core/bridges/BridgeCodecs.d.ts +19 -0
- package/dist/core/bridges/BridgeCodecs.js +317 -0
- package/dist/core/bridges/BrowserFirestoreRooms.d.ts +36 -0
- package/dist/core/bridges/BrowserFirestoreRooms.js +169 -0
- package/dist/core/bridges/BrowserFirestoreSignaling.d.ts +111 -0
- package/dist/core/bridges/BrowserFirestoreSignaling.js +1010 -0
- package/dist/core/bridges/NativeIpcBridge.d.ts +156 -0
- package/dist/core/bridges/NativeIpcBridge.js +1472 -0
- package/dist/core/bridges/RtdbPresence.d.ts +122 -0
- package/dist/core/bridges/RtdbPresence.js +201 -0
- package/dist/core/bridges/TauriBridge.d.ts +8 -0
- package/dist/core/bridges/TauriBridge.js +7 -0
- package/dist/core/bridges/WasmBridge.d.ts +233 -0
- package/dist/core/bridges/WasmBridge.js +1811 -0
- package/dist/core/config.d.ts +31 -0
- package/dist/core/config.js +138 -0
- package/dist/core/transports/ITransport.d.ts +12 -0
- package/dist/core/transports/ITransport.js +1 -0
- package/dist/core/transports/LocalDaemonBridge.d.ts +41 -0
- package/dist/core/transports/LocalDaemonBridge.js +227 -0
- package/dist/core/transports/TauriSignaling.d.ts +28 -0
- package/dist/core/transports/TauriSignaling.js +373 -0
- package/dist/core/transports/TransportFactory.d.ts +9 -0
- package/dist/core/transports/TransportFactory.js +59 -0
- package/dist/core/transports/WasmSignaling.d.ts +78 -0
- package/dist/core/transports/WasmSignaling.js +522 -0
- package/dist/core/transports/WebRTCTransport.d.ts +23 -0
- package/dist/core/transports/WebRTCTransport.js +132 -0
- package/dist/core/trust.d.ts +23 -0
- package/dist/core/trust.js +99 -0
- package/dist/core/types.d.ts +559 -0
- package/dist/core/types.js +19 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/moq/MoQMediaTransport.d.ts +6 -0
- package/dist/moq/MoQMediaTransport.js +106 -0
- package/dist/moq/MoQPublisher.d.ts +22 -0
- package/dist/moq/MoQPublisher.js +179 -0
- package/dist/moq/MoQSession.d.ts +35 -0
- package/dist/moq/MoQSession.js +166 -0
- package/dist/moq/MoQSubscriber.d.ts +19 -0
- package/dist/moq/MoQSubscriber.js +235 -0
- package/dist/moq/common.d.ts +47 -0
- package/dist/moq/common.js +304 -0
- package/dist/moq/messages.d.ts +105 -0
- package/dist/moq/messages.js +367 -0
- package/dist/presets/plutoHosted.d.ts +13 -0
- package/dist/presets/plutoHosted.js +18 -0
- package/dist/runtime/DelegatingRuntimeAdapter.d.ts +68 -0
- package/dist/runtime/DelegatingRuntimeAdapter.js +250 -0
- package/dist/runtime/IpcRuntimeAdapter.d.ts +9 -0
- package/dist/runtime/IpcRuntimeAdapter.js +13 -0
- package/dist/runtime/RuntimeClient.d.ts +257 -0
- package/dist/runtime/RuntimeClient.js +1484 -0
- package/dist/runtime/TauriRuntimeAdapter.d.ts +1 -0
- package/dist/runtime/TauriRuntimeAdapter.js +1 -0
- package/dist/runtime/WasmRuntimeAdapter.d.ts +6 -0
- package/dist/runtime/WasmRuntimeAdapter.js +11 -0
- package/dist/runtime/factories.d.ts +24 -0
- package/dist/runtime/factories.js +66 -0
- package/dist/runtime/index.d.ts +6 -0
- package/dist/runtime/index.js +5 -0
- package/dist/runtime/ipc.d.ts +8 -0
- package/dist/runtime/ipc.js +65 -0
- package/dist/runtime/ipcContract.d.ts +46 -0
- package/dist/runtime/ipcContract.js +1 -0
- package/dist/runtime/tauri.d.ts +16 -0
- package/dist/runtime/tauri.js +22 -0
- package/dist/runtime/types.d.ts +110 -0
- package/dist/runtime/types.js +1 -0
- package/dist/transports/TauriTransport.d.ts +17 -0
- package/dist/transports/TauriTransport.js +49 -0
- package/dist/transports/WebTransport.d.ts +23 -0
- package/dist/transports/WebTransport.js +71 -0
- package/dist/utils/debug.d.ts +4 -0
- package/dist/utils/debug.js +33 -0
- package/dist/utils/runtime.d.ts +1 -0
- package/dist/utils/runtime.js +10 -0
- package/package.json +97 -0
- package/wasm/README.md +64 -0
- package/wasm/openrtc.d.ts +284 -0
- package/wasm/openrtc.js +2132 -0
- package/wasm/openrtc_bg.wasm +0 -0
- package/wasm/openrtc_bg.wasm.d.ts +110 -0
- package/wasm/package.json +16 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { registerDesktopAuthRelay } from './host';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { registerDesktopAuthRelay } from './host';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from '../core/Client';
|
|
2
|
+
export * from '../core/PlutoRTC';
|
|
3
|
+
export * from '../core/IEngineBridge';
|
|
4
|
+
export * from '../core/Connection';
|
|
5
|
+
export * from '../core/Signaling';
|
|
6
|
+
export * from '../core/Room';
|
|
7
|
+
export * from '../core/types';
|
|
8
|
+
export * from '../core/transports/TransportFactory';
|
|
9
|
+
export * from '../transports/WebTransport';
|
|
10
|
+
export * from '../transports/TauriTransport';
|
|
11
|
+
export * from '../core/bridges/TauriBridge';
|
|
12
|
+
export * from '../core/bridges/WasmBridge';
|
|
13
|
+
export * from '../api/PlutoWebSocket';
|
|
14
|
+
export * from '../api/PlutoWebTransport';
|
|
15
|
+
export * from '../api/PlutoPeerConnection';
|
|
16
|
+
export * from '../moq/MoQSession';
|
|
17
|
+
export * from '../moq/MoQPublisher';
|
|
18
|
+
export * from '../moq/MoQSubscriber';
|
|
19
|
+
export * from '../moq/MoQMediaTransport';
|
|
20
|
+
export { BufferReader, StreamBuffer, BufferWriter, Mutex } from '../moq/common';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from '../core/Client';
|
|
2
|
+
export * from '../core/PlutoRTC';
|
|
3
|
+
export * from '../core/IEngineBridge';
|
|
4
|
+
export * from '../core/Connection';
|
|
5
|
+
export * from '../core/Signaling';
|
|
6
|
+
export * from '../core/Room';
|
|
7
|
+
export * from '../core/types';
|
|
8
|
+
export * from '../core/transports/TransportFactory';
|
|
9
|
+
export * from '../transports/WebTransport';
|
|
10
|
+
export * from '../transports/TauriTransport';
|
|
11
|
+
export * from '../core/bridges/TauriBridge';
|
|
12
|
+
export * from '../core/bridges/WasmBridge';
|
|
13
|
+
export * from '../api/PlutoWebSocket';
|
|
14
|
+
export * from '../api/PlutoWebTransport';
|
|
15
|
+
export * from '../api/PlutoPeerConnection';
|
|
16
|
+
export * from '../moq/MoQSession';
|
|
17
|
+
export * from '../moq/MoQPublisher';
|
|
18
|
+
export * from '../moq/MoQSubscriber';
|
|
19
|
+
export * from '../moq/MoQMediaTransport';
|
|
20
|
+
export { BufferReader, StreamBuffer, BufferWriter, Mutex } from '../moq/common';
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { Connection } from './Connection';
|
|
2
|
+
import { Signaling } from './Signaling';
|
|
3
|
+
import { RoomManager } from './Room';
|
|
4
|
+
import { MoQSession } from '../moq/MoQSession';
|
|
5
|
+
import { MoQPublisher } from '../moq/MoQPublisher';
|
|
6
|
+
import { MoQSubscriber } from '../moq/MoQSubscriber';
|
|
7
|
+
export interface BiStream {
|
|
8
|
+
send: WritableStream<Uint8Array>;
|
|
9
|
+
recv: ReadableStream<Uint8Array>;
|
|
10
|
+
endpoint_id: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IncomingStream {
|
|
13
|
+
type: 'bi' | 'uni';
|
|
14
|
+
stream: BiStream | ReadableStream<Uint8Array>;
|
|
15
|
+
endpointId: string;
|
|
16
|
+
}
|
|
17
|
+
type IncomingProtocolHint = 'control' | 'explicit' | 'native-main' | 'unknown';
|
|
18
|
+
type IncomingStreamListenerEvent = {
|
|
19
|
+
type: 'bi' | 'uni';
|
|
20
|
+
stream: any;
|
|
21
|
+
remoteNodeId: string;
|
|
22
|
+
protocolHint?: IncomingProtocolHint;
|
|
23
|
+
channel?: import('./types').IncomingStreamChannelMetadata | null;
|
|
24
|
+
invalid?: boolean;
|
|
25
|
+
};
|
|
26
|
+
import { type AppLimits, ClientOptions, JoinRequest, ScanningLoopOptions, ScanningLoopHandle, Device, ConnectDeviceHooks, ConnectDeviceOptions, ConnectDeviceResult, ChannelDescriptor, RuntimeBootstrapOptions, RuntimeBootstrapResult, DiscoveryMode, PeerHealth, PeerScope, PeerState, RoomCreationMode } from './types';
|
|
27
|
+
export declare class Client {
|
|
28
|
+
private static readonly CHANNEL_ENVELOPE_MAGIC;
|
|
29
|
+
private static readonly CHANNEL_ENVELOPE_VERSION;
|
|
30
|
+
private static readonly CHANNEL_ENVELOPE_HEADER_BYTES;
|
|
31
|
+
private static readonly EXPLICIT_PROTOCOL_BYTE;
|
|
32
|
+
private static readonly NATIVE_MAIN_PROTOCOL_BYTE;
|
|
33
|
+
private static readonly NATIVE_MAIN_LABEL;
|
|
34
|
+
private static readonly NATIVE_MAIN_MAX_LABEL_BYTES;
|
|
35
|
+
private static readonly NATIVE_MAIN_PROTOCOL_VERSION;
|
|
36
|
+
private static readonly CONNECTION_STATE_CHANGED_EVENT;
|
|
37
|
+
private static readonly INCOMING_STREAM_RETRY_MIN_DELAY_MS;
|
|
38
|
+
private static readonly INCOMING_STREAM_RETRY_MAX_DELAY_MS;
|
|
39
|
+
private static readonly DEFAULT_PEER_CHANNEL_ID;
|
|
40
|
+
private static readonly SHARE_FILE_CHANNEL_ID;
|
|
41
|
+
private static readonly SHARE_CONTROL_CHANNEL_ID;
|
|
42
|
+
private static readonly incomingStreamHubs;
|
|
43
|
+
signaling: Signaling;
|
|
44
|
+
rooms: RoomManager;
|
|
45
|
+
private wasmLoaded;
|
|
46
|
+
wasmClient: any;
|
|
47
|
+
private initPromise;
|
|
48
|
+
node: any;
|
|
49
|
+
private connections;
|
|
50
|
+
private connectionListeners;
|
|
51
|
+
private disconnectionListeners;
|
|
52
|
+
private messageListeners;
|
|
53
|
+
private roomRequestListeners;
|
|
54
|
+
private streamListeners;
|
|
55
|
+
private readonly channelStreamListeners;
|
|
56
|
+
private readonly registeredChannels;
|
|
57
|
+
private announcedConnections;
|
|
58
|
+
private readonly peerLifecycle;
|
|
59
|
+
private readonly knownDevicesById;
|
|
60
|
+
private readonly knownDeviceIdsByNodeId;
|
|
61
|
+
private readonly connectionTrustStates;
|
|
62
|
+
private readonly connectionChannelIds;
|
|
63
|
+
private managedPresenceGrant;
|
|
64
|
+
/** Token extracted from a compound ticket during connect(), keyed by remote node ID. */
|
|
65
|
+
private readonly pendingTokenByNodeId;
|
|
66
|
+
private localNodeId;
|
|
67
|
+
private listening;
|
|
68
|
+
private listenLoopTask;
|
|
69
|
+
private options;
|
|
70
|
+
appLimits: AppLimits;
|
|
71
|
+
private pendingConnection;
|
|
72
|
+
private authSyncUnsubscribe;
|
|
73
|
+
private backendConnectionStateUnsubscribe;
|
|
74
|
+
private authRefreshInterval;
|
|
75
|
+
private deviceId;
|
|
76
|
+
private lastWasmAuthSyncUserId;
|
|
77
|
+
private lastWasmAuthSyncToken;
|
|
78
|
+
private static readonly CONNECTION_STABLE_WINDOW_MS;
|
|
79
|
+
private static readonly CONNECTION_STABLE_TIMEOUT_MS;
|
|
80
|
+
private static readonly CONNECTION_STABLE_POLL_MS;
|
|
81
|
+
private presenceInterval;
|
|
82
|
+
private hostedAppSettingsLoaded;
|
|
83
|
+
private effectiveRoomBackendTag;
|
|
84
|
+
private _moqSession;
|
|
85
|
+
private _moqState;
|
|
86
|
+
private moqReadyListeners;
|
|
87
|
+
private moqFailedListeners;
|
|
88
|
+
private moqObjectListeners;
|
|
89
|
+
roomCreationMode: RoomCreationMode;
|
|
90
|
+
constructor(options: ClientOptions);
|
|
91
|
+
private sleep;
|
|
92
|
+
get apiKey(): string | undefined;
|
|
93
|
+
get discoveryMode(): DiscoveryMode;
|
|
94
|
+
private usesTicketOnlySignalingMode;
|
|
95
|
+
usesDirectRoomBackend(): boolean;
|
|
96
|
+
getRoomBackendTag(): string;
|
|
97
|
+
refreshHostedAppSettings(force?: boolean): Promise<void>;
|
|
98
|
+
setSignalingBackend(backend: import('./types').ISignalingBackend): void;
|
|
99
|
+
get currentUser(): import("./types").RuntimeIdentity | null;
|
|
100
|
+
onAuthChange(callback: (user: any) => void): () => void;
|
|
101
|
+
signInAnonymously(): Promise<void>;
|
|
102
|
+
signInWithPluto(): Promise<void>;
|
|
103
|
+
signOut(): Promise<void>;
|
|
104
|
+
getSignalingTelemetry(): {
|
|
105
|
+
transport: string;
|
|
106
|
+
wasmLoaded: boolean;
|
|
107
|
+
};
|
|
108
|
+
getProtocolCapabilities(): import("./types").ProtocolCapabilityMap;
|
|
109
|
+
getRuntimeStatus(): Promise<{
|
|
110
|
+
runtime: 'tauri' | 'browser' | 'unknown';
|
|
111
|
+
wasmLoaded: boolean;
|
|
112
|
+
localNodeId?: string;
|
|
113
|
+
userId?: string;
|
|
114
|
+
}>;
|
|
115
|
+
private ensureWasmRuntimeForP2P;
|
|
116
|
+
private ensureSignalingReadyForDiscovery;
|
|
117
|
+
private requiresManagedTransportTrust;
|
|
118
|
+
private getRegisteredChannel;
|
|
119
|
+
private isChannelPromotionEligible;
|
|
120
|
+
private getConnectionChannelId;
|
|
121
|
+
private resolvePromotionEligibility;
|
|
122
|
+
private assignConnectionChannel;
|
|
123
|
+
private rememberKnownDevice;
|
|
124
|
+
private getKnownDevice;
|
|
125
|
+
private refreshKnownDeviceCache;
|
|
126
|
+
private initializeConnectionTrust;
|
|
127
|
+
private getConnectionTrustState;
|
|
128
|
+
private getConnectionTrustProjection;
|
|
129
|
+
private applyConnectionTrustProjection;
|
|
130
|
+
private buildLocalTransportTrustPayload;
|
|
131
|
+
private sendTransportHandshake;
|
|
132
|
+
private verifyRemoteTransportTrust;
|
|
133
|
+
private enforceConnectionTrustFailure;
|
|
134
|
+
private markConnectionTrustVerified;
|
|
135
|
+
searchDevices(): Promise<Device[]>;
|
|
136
|
+
updateDevice(deviceId: string, updates: {
|
|
137
|
+
deviceName?: string;
|
|
138
|
+
capabilities?: Device['capabilities'];
|
|
139
|
+
metadata?: string;
|
|
140
|
+
}): Promise<void>;
|
|
141
|
+
deleteDevice(deviceId: string): Promise<void>;
|
|
142
|
+
onDevicesChange(callback: any): () => void;
|
|
143
|
+
subscribeSessions(localDeviceId: string, callback: (session: import('./types').SignalingSession) => void): Promise<() => void>;
|
|
144
|
+
startScanningLoop(options: ScanningLoopOptions): Promise<ScanningLoopHandle>;
|
|
145
|
+
connectDeviceWithRetry(device: Device, hooks: ConnectDeviceHooks, options: ConnectDeviceOptions): Promise<ConnectDeviceResult>;
|
|
146
|
+
bootstrapRuntime(options: RuntimeBootstrapOptions): Promise<RuntimeBootstrapResult>;
|
|
147
|
+
updateTransportConfig(transports: ClientOptions['transports']): void;
|
|
148
|
+
/**
|
|
149
|
+
* Bootstraps the WASM module and Rust signaling.
|
|
150
|
+
* Must be called before connect or createRoom.
|
|
151
|
+
*/
|
|
152
|
+
init(): Promise<void>;
|
|
153
|
+
ensureAuthenticated(reason: 'init' | 'room-op' | 'discovery'): Promise<void>;
|
|
154
|
+
private installAuthTokenSync;
|
|
155
|
+
private syncAuthTokenToWasm;
|
|
156
|
+
get moqState(): "connecting" | "failed" | "none" | "ready";
|
|
157
|
+
get moq(): {
|
|
158
|
+
session: MoQSession;
|
|
159
|
+
publisher: MoQPublisher;
|
|
160
|
+
subscriber: MoQSubscriber;
|
|
161
|
+
} | null;
|
|
162
|
+
onMoQReady(cb: () => void): void;
|
|
163
|
+
onMoQFailed(cb: () => void): void;
|
|
164
|
+
onMoQObject(callback: (ns: string, name: string, obj: Uint8Array, meta: any) => void): void;
|
|
165
|
+
private initMoQ;
|
|
166
|
+
connect(ticket: string, timeoutMs?: number, expectedDeviceId?: string | null, channelId?: string): Promise<Connection>;
|
|
167
|
+
/**
|
|
168
|
+
* Low-level dial helper.
|
|
169
|
+
* Ensures the ticket is connected and returns only connection identity metadata.
|
|
170
|
+
*/
|
|
171
|
+
connectRaw(ticket: string, timeoutMs?: number): Promise<{
|
|
172
|
+
connectionId: string;
|
|
173
|
+
localNodeId: string;
|
|
174
|
+
remoteNodeId: string;
|
|
175
|
+
}>;
|
|
176
|
+
/**
|
|
177
|
+
* Start core-managed auto-connect for the authenticated user.
|
|
178
|
+
* This is intentionally low-level: callers decide when to start/stop and
|
|
179
|
+
* what higher-level protocol to run on top of the resulting connection.
|
|
180
|
+
*/
|
|
181
|
+
startAutoConnect(localDeviceId?: string): Promise<void>;
|
|
182
|
+
openBi(peerId: string): Promise<{
|
|
183
|
+
readable: ReadableStream<Uint8Array>;
|
|
184
|
+
writable: WritableStream<Uint8Array>;
|
|
185
|
+
}>;
|
|
186
|
+
openUni(peerId: string): Promise<WritableStream<Uint8Array>>;
|
|
187
|
+
getConnections(): Connection[];
|
|
188
|
+
watchPeerStates(callback: (peers: PeerState[]) => void): () => void;
|
|
189
|
+
getPeerState(id: string): PeerState | undefined;
|
|
190
|
+
listConnectedPeers(): PeerState[];
|
|
191
|
+
isPeerPromotionEligible(identifiers: {
|
|
192
|
+
connectionId?: string | null;
|
|
193
|
+
deviceId?: string | null;
|
|
194
|
+
deviceIdHint?: string | null;
|
|
195
|
+
nodeId?: string | null;
|
|
196
|
+
}): boolean;
|
|
197
|
+
addPeerScope(id: string, scope?: PeerScope): PeerState | undefined;
|
|
198
|
+
releasePeerScope(id: string, scope?: PeerScope): PeerState | undefined;
|
|
199
|
+
getPeerScopes(id: string): PeerScope[];
|
|
200
|
+
isSamePeer(a: string, b: string): boolean;
|
|
201
|
+
refreshPeerSnapshot(): Promise<PeerState[]>;
|
|
202
|
+
connectPeer(options: {
|
|
203
|
+
deviceId?: string;
|
|
204
|
+
ticket?: string;
|
|
205
|
+
scope?: PeerScope;
|
|
206
|
+
channelId?: string;
|
|
207
|
+
}): Promise<Connection>;
|
|
208
|
+
disconnectPeer(id: string, scope?: PeerScope): Promise<void>;
|
|
209
|
+
forceDisconnectPeer(id: string): Promise<void>;
|
|
210
|
+
getPeerHealth(id: string): Promise<PeerHealth>;
|
|
211
|
+
private mapRustPeerStatus;
|
|
212
|
+
private mapRustPeerHealth;
|
|
213
|
+
getTicket(): Promise<string>;
|
|
214
|
+
getNodeId(): Promise<string>;
|
|
215
|
+
getNodeIdFromTicket(ticket: string): Promise<string | null>;
|
|
216
|
+
/**
|
|
217
|
+
* Generate a random session token, register it, and return a compound
|
|
218
|
+
* ticket string with the token suffix appended.
|
|
219
|
+
*
|
|
220
|
+
* @param scope Logical label (e.g. "share"). Used for bulk-revoke.
|
|
221
|
+
* @param maxConnections 0 = unlimited.
|
|
222
|
+
*/
|
|
223
|
+
getEndpointTicketWithToken(grantScope: string, maxConnections?: number): Promise<string>;
|
|
224
|
+
/**
|
|
225
|
+
* Build a compound ticket from an externally-provided iroh ticket string.
|
|
226
|
+
* Generates a session token, registers it with the Rust wasm client when available,
|
|
227
|
+
* and appends the token
|
|
228
|
+
* payload as a base64url suffix separated by `.`.
|
|
229
|
+
*
|
|
230
|
+
* Used by RuntimeClient.getTicketWithToken() on native desktop where the
|
|
231
|
+
* iroh ticket comes from the Rust backend (via Tauri IPC) rather than the
|
|
232
|
+
* WASM node running in the webview.
|
|
233
|
+
*/
|
|
234
|
+
buildCompoundTicketWithToken(irohTicket: string, grantScope: string, maxConnections?: number): string;
|
|
235
|
+
setManagedPresenceTicket(ticket: string | null): void;
|
|
236
|
+
clearManagedPresenceTicket(): void;
|
|
237
|
+
/** Register an externally-generated session token with the Rust wasm client. */
|
|
238
|
+
registerSessionToken(token: string, grantScope: string, maxConnections: number): void;
|
|
239
|
+
/** Revoke a specific session token. */
|
|
240
|
+
revokeSessionToken(token: string): void;
|
|
241
|
+
/** Revoke all tokens that match the given scope. */
|
|
242
|
+
revokeTokensByScope(grantScope: string): Promise<string[]>;
|
|
243
|
+
private static generateSessionToken;
|
|
244
|
+
private static encodeSessionTokenPayload;
|
|
245
|
+
private static buildCompoundTicketWithPayload;
|
|
246
|
+
clearSessionTokens(): Promise<void>;
|
|
247
|
+
private resolvePresenceTicket;
|
|
248
|
+
private refreshManagedPresenceTicketIfNeeded;
|
|
249
|
+
private validateIncomingSessionToken;
|
|
250
|
+
/**
|
|
251
|
+
* Start the signaling-backed presence loop owned by the Rust core.
|
|
252
|
+
* A ticket can be provided explicitly, otherwise the current endpoint ticket is used.
|
|
253
|
+
*/
|
|
254
|
+
startPresenceLoop(options?: {
|
|
255
|
+
deviceName?: string;
|
|
256
|
+
ticket?: string;
|
|
257
|
+
metadata?: string;
|
|
258
|
+
}): Promise<void>;
|
|
259
|
+
/**
|
|
260
|
+
* Mark local presence offline in the signaling backend.
|
|
261
|
+
*/
|
|
262
|
+
setOffline(): Promise<void>;
|
|
263
|
+
/**
|
|
264
|
+
* Check raw connectivity against a remote node id.
|
|
265
|
+
*/
|
|
266
|
+
isConnected(nodeId: string): Promise<boolean>;
|
|
267
|
+
/**
|
|
268
|
+
* Disconnect a remote node from the local connection manager.
|
|
269
|
+
*/
|
|
270
|
+
disconnectNode(nodeId: string): Promise<void>;
|
|
271
|
+
getLocalDeviceId(): Promise<string | null>;
|
|
272
|
+
/**
|
|
273
|
+
* Route a raw message received on a native iroh connection through token
|
|
274
|
+
* validation. Called by RuntimeClient when NativeIpcBridge fires an
|
|
275
|
+
* `iroh://message` event for an incoming native connection.
|
|
276
|
+
*
|
|
277
|
+
* If we have a TS Connection object for this peer (e.g. the client also
|
|
278
|
+
* called connect()), route through handleMessage. Otherwise, for connections
|
|
279
|
+
* that were accepted purely by the Rust protocol handler, perform token
|
|
280
|
+
* validation directly.
|
|
281
|
+
*
|
|
282
|
+
* @returns true if the connection should be rejected (caller should disconnect)
|
|
283
|
+
*/
|
|
284
|
+
acceptNativeMessage(connectionId: string | null, remoteNodeId: string | null, msg: any): Promise<boolean>;
|
|
285
|
+
startListening(): Promise<void>;
|
|
286
|
+
stopListening(): void;
|
|
287
|
+
private getSharedIncomingStreamHub;
|
|
288
|
+
private nextIncomingStreamRetryDelayMs;
|
|
289
|
+
/**
|
|
290
|
+
* Force an immediate presence update and reconnect snapshot.
|
|
291
|
+
*/
|
|
292
|
+
forceReconnectSnapshot(): void;
|
|
293
|
+
private updatePresenceInternal;
|
|
294
|
+
private listenLoop;
|
|
295
|
+
private prependChunkToReadable;
|
|
296
|
+
private cancelUnhandledIncomingUniStream;
|
|
297
|
+
private prependBytesToReader;
|
|
298
|
+
private concatBytes;
|
|
299
|
+
private encodeChannelEnvelope;
|
|
300
|
+
wrapChannelWritable(writable: WritableStream<Uint8Array>, channelId: string, metadata?: Record<string, unknown> | null): WritableStream<Uint8Array>;
|
|
301
|
+
private extractIncomingChannelEnvelope;
|
|
302
|
+
private isBiStreamLike;
|
|
303
|
+
private materializeIncomingBiStream;
|
|
304
|
+
private rebuildBiIncomingStream;
|
|
305
|
+
private classifyBiIncomingStream;
|
|
306
|
+
private detectNativeMainStream;
|
|
307
|
+
private resolveLocalHandshakePayload;
|
|
308
|
+
private getDeterministicConnectionId;
|
|
309
|
+
private getNativeMainConnectionId;
|
|
310
|
+
private hasRustPeerLifecycleProjection;
|
|
311
|
+
private shouldProjectNativeMainLifecycle;
|
|
312
|
+
private emitNativeMainConnectionState;
|
|
313
|
+
private applyBackendConnectionState;
|
|
314
|
+
private encodeNativeMainFrame;
|
|
315
|
+
private writeNativeMainMessage;
|
|
316
|
+
private handleNativeHandshakeRequest;
|
|
317
|
+
private handleNativeSessionTokenRequest;
|
|
318
|
+
private handleNativeMainStream;
|
|
319
|
+
private isCoreConnectionHealthy;
|
|
320
|
+
private waitForStableConnection;
|
|
321
|
+
private announceConnectionWhenStable;
|
|
322
|
+
private normalizeIncomingStreamEvent;
|
|
323
|
+
private hasIncomingChannelListener;
|
|
324
|
+
private hasAnyIncomingChannelListeners;
|
|
325
|
+
private dispatchIncomingChannelListeners;
|
|
326
|
+
private dispatchIncomingGenericListeners;
|
|
327
|
+
private handleUnhandledIncomingStreamEvent;
|
|
328
|
+
private handleIncomingStream;
|
|
329
|
+
private registerConnection;
|
|
330
|
+
private syncConnectionPeerLifecycle;
|
|
331
|
+
private getPeerCandidates;
|
|
332
|
+
updatePresence(isOnline?: boolean, ttlMs?: number, metadata?: string, ticketOverride?: string): Promise<void>;
|
|
333
|
+
onConnection(callback: (conn: Connection) => void): () => void;
|
|
334
|
+
onDisconnection(callback: (conn: Connection) => void): () => void;
|
|
335
|
+
onMessage(callback: (conn: Connection, msg: any) => void): () => void;
|
|
336
|
+
onIncomingStream(callback: (stream: IncomingStreamListenerEvent) => boolean | void): () => void;
|
|
337
|
+
registerChannel(descriptor: ChannelDescriptor): void;
|
|
338
|
+
unregisterChannel(channelId: string): void;
|
|
339
|
+
listChannels(): ChannelDescriptor[];
|
|
340
|
+
onIncomingChannelStream(channelId: string, callback: (stream: IncomingStreamListenerEvent) => boolean | void): () => void;
|
|
341
|
+
onRoomJoinRequest(callback: (request: JoinRequest) => void): () => void;
|
|
342
|
+
private createMoQDataTracks;
|
|
343
|
+
/**
|
|
344
|
+
* Send data via MoQ.
|
|
345
|
+
* @param peerId Target Node ID (for 1:1) or null (for Broadcast)
|
|
346
|
+
* @param data Payload
|
|
347
|
+
*/
|
|
348
|
+
sendMoQData(peerId: string | null, data: Uint8Array): Promise<void>;
|
|
349
|
+
private handleMessage;
|
|
350
|
+
private getRTCConfig;
|
|
351
|
+
}
|
|
352
|
+
export {};
|