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,156 @@
|
|
|
1
|
+
import { BackendConnectionState, Device, DeviceStatusSnapshot, ExplicitFileDataSendParams, ISignalingBackend, LocalDeviceInfo, NativeConnectResult, SignalingSession, SessionEvent } from '../types';
|
|
2
|
+
import type { AuthContext } from '../IEngineBridge';
|
|
3
|
+
import { WasmBridgeOptions } from './WasmBridge';
|
|
4
|
+
import { type PlutoIpcBridge } from '../../runtime/ipc';
|
|
5
|
+
export interface NativeIpcBridgeOptions extends WasmBridgeOptions {
|
|
6
|
+
allowWasmFallback?: boolean;
|
|
7
|
+
ipcBridge?: PlutoIpcBridge;
|
|
8
|
+
}
|
|
9
|
+
export declare class NativeIpcBridge implements ISignalingBackend {
|
|
10
|
+
/**
|
|
11
|
+
* NativeIpcBridge is a host adapter for native IPC.
|
|
12
|
+
*
|
|
13
|
+
* Allowed:
|
|
14
|
+
* - lightweight IPC readiness checks
|
|
15
|
+
* - native auth relay
|
|
16
|
+
* - typed command/event forwarding
|
|
17
|
+
*
|
|
18
|
+
* Not allowed:
|
|
19
|
+
* - becoming a second lifecycle engine
|
|
20
|
+
* - owning peer identity policy
|
|
21
|
+
* - teaching product code to depend on native-specific fallbacks
|
|
22
|
+
*
|
|
23
|
+
* Source of truth:
|
|
24
|
+
* - Rust core owns connection lifecycle and device identity
|
|
25
|
+
* - RuntimeClient owns host-facing orchestration
|
|
26
|
+
*/
|
|
27
|
+
private subscriptionNonce;
|
|
28
|
+
private lastSyncedAuthToken;
|
|
29
|
+
private cachedLocalDeviceId;
|
|
30
|
+
private cachedLocalDeviceName;
|
|
31
|
+
private tauriCoreAvailability;
|
|
32
|
+
private tauriCoreAvailabilityValue;
|
|
33
|
+
private tauriCoreAvailabilityCheckedAtMs;
|
|
34
|
+
private authSyncInFlight;
|
|
35
|
+
private lastNativeAuthSyncAtMs;
|
|
36
|
+
private hasLoggedMissingAuthForDevices;
|
|
37
|
+
private static readonly AUTH_REQUIRED_WAIT_MS;
|
|
38
|
+
private static readonly CONNECTION_EVENT_SUBSCRIBE_WINDOW_MS;
|
|
39
|
+
private static readonly CONNECTION_EVENT_RETRY_MIN_DELAY_MS;
|
|
40
|
+
private static readonly CONNECTION_EVENT_RETRY_MAX_DELAY_MS;
|
|
41
|
+
private static readonly TAURI_IPC_NEGATIVE_CACHE_MS;
|
|
42
|
+
readonly app: import("firebase/app").FirebaseApp | null;
|
|
43
|
+
readonly auth: import("firebase/auth").Auth | null;
|
|
44
|
+
readonly appTag: string;
|
|
45
|
+
private readonly fallback;
|
|
46
|
+
private readonly options;
|
|
47
|
+
private readonly allowWasmFallback;
|
|
48
|
+
private readonly ipcBridge;
|
|
49
|
+
private nativeRtdbPresenceScope;
|
|
50
|
+
private nativeRtdbTicketVersion;
|
|
51
|
+
private lastNativePresenceTicket;
|
|
52
|
+
constructor(options: NativeIpcBridgeOptions);
|
|
53
|
+
get currentUser(): import("../types").RuntimeIdentity | null;
|
|
54
|
+
get tag(): string;
|
|
55
|
+
setWasmClient(client: any): void;
|
|
56
|
+
onAuthChange(callback: (user: import('../types').RuntimeIdentity | null) => void): () => void;
|
|
57
|
+
checkForSSOToken(): Promise<void>;
|
|
58
|
+
waitForAuth(): Promise<void>;
|
|
59
|
+
signInAnonymously(): Promise<void>;
|
|
60
|
+
getTurnCredentials(): Promise<any>;
|
|
61
|
+
cleanupStaleDevices(): Promise<void>;
|
|
62
|
+
sendMessage(targetId: string, payload: string, state?: string, replyPayload?: string): Promise<string>;
|
|
63
|
+
pollMessages(targetId: string): Promise<import("../types").SignalingEnvelope[]>;
|
|
64
|
+
createSession(session: SignalingSession): Promise<void>;
|
|
65
|
+
updateSession(sessionId: string, updateData: any): Promise<void>;
|
|
66
|
+
openPeerBi(id: string, timeoutMs?: number): Promise<import("../types").BackendPeerBiStream>;
|
|
67
|
+
openPeerUni(id: string, timeoutMs?: number): Promise<import("../types").BackendPeerUniStream>;
|
|
68
|
+
isConnected(nodeId: string): Promise<boolean>;
|
|
69
|
+
private getAuthContext;
|
|
70
|
+
private getCurrentUserId;
|
|
71
|
+
private resolveWebLogicalDeviceId;
|
|
72
|
+
private normalizeDevice;
|
|
73
|
+
private matchesTag;
|
|
74
|
+
private buildNativeRtdbScope;
|
|
75
|
+
private syncNativeRtdbPresenceTicket;
|
|
76
|
+
private markNativeRtdbOffline;
|
|
77
|
+
isTauriEnv(): boolean;
|
|
78
|
+
private sleep;
|
|
79
|
+
private nextConnectionEventRetryDelayMs;
|
|
80
|
+
private clearNativeAuthRelay;
|
|
81
|
+
private canUseTauriIpc;
|
|
82
|
+
private invokeIpc;
|
|
83
|
+
private listenIpc;
|
|
84
|
+
private shouldUseTauriSignaling;
|
|
85
|
+
signInWithPluto(): Promise<void>;
|
|
86
|
+
setAuthContext(context: AuthContext | null): Promise<void>;
|
|
87
|
+
signOut(): Promise<void>;
|
|
88
|
+
stopAuthScopedActivity(options?: {
|
|
89
|
+
userId?: string | null;
|
|
90
|
+
}): Promise<void>;
|
|
91
|
+
private ensureNativeAuthOnce;
|
|
92
|
+
private ensureNativeAuth;
|
|
93
|
+
private resolveLocalDeviceId;
|
|
94
|
+
private resolveLocalDeviceName;
|
|
95
|
+
private normalizeNativeDeviceName;
|
|
96
|
+
private defaultDeviceNameFallback;
|
|
97
|
+
private withPresenceMetadata;
|
|
98
|
+
searchDevices(excludeNodeId?: string): Promise<Device[]>;
|
|
99
|
+
listDevicesWithStatus(): Promise<DeviceStatusSnapshot[]>;
|
|
100
|
+
getPeerSession(id: string): Promise<import('../types').PeerSessionSnapshot | null>;
|
|
101
|
+
listPeerSessions(): Promise<import('../types').PeerSessionSnapshot[]>;
|
|
102
|
+
waitForSettledPeer(id: string, timeoutMs?: number): Promise<import('../types').PeerSessionSnapshot | null>;
|
|
103
|
+
resolvePeerConnectionRecords(id: string): Promise<import('../types').ManagedConnectionRecord[]>;
|
|
104
|
+
resolvePeerIdentity(id: string): Promise<import('../types').ResolvedPeerIdentity>;
|
|
105
|
+
setOffline(localNodeId: string): Promise<void>;
|
|
106
|
+
updateDevice(deviceId: string, updates: {
|
|
107
|
+
deviceName?: string;
|
|
108
|
+
capabilities?: Device['capabilities'];
|
|
109
|
+
metadata?: string;
|
|
110
|
+
}): Promise<void>;
|
|
111
|
+
deleteDevice(deviceId: string): Promise<void>;
|
|
112
|
+
getLocalDeviceInfo(): Promise<LocalDeviceInfo | null>;
|
|
113
|
+
updateLocalDeviceName(deviceName: string): Promise<LocalDeviceInfo | null>;
|
|
114
|
+
getManagedNodeId(options?: {
|
|
115
|
+
initializeIfMissing?: boolean;
|
|
116
|
+
}): Promise<string | null>;
|
|
117
|
+
getEndpointTicket(): Promise<string>;
|
|
118
|
+
connectToDevice(params: {
|
|
119
|
+
deviceId?: string | null;
|
|
120
|
+
endpointTicket: string;
|
|
121
|
+
}): Promise<NativeConnectResult>;
|
|
122
|
+
registerSessionToken(token: string, grantScope: string, maxConnections: number): Promise<void>;
|
|
123
|
+
getEndpointTicketWithToken(grantScope: string, maxConnections: number): Promise<string | null>;
|
|
124
|
+
validateSessionToken(token: string, connectionId?: string): Promise<string | null>;
|
|
125
|
+
revokeSessionTokensByScope(grantScope: string): Promise<string[]>;
|
|
126
|
+
disconnectDevice(deviceId: string): Promise<void>;
|
|
127
|
+
setAutoConnectExcluded(deviceId: string, excluded: boolean): Promise<void>;
|
|
128
|
+
onDevicesChange(callback: (devices: Device[]) => void, excludeNodeId?: string): () => void;
|
|
129
|
+
subscribeDevices(userId: string): Promise<ReadableStream<import('../types').DeviceEvent[]>>;
|
|
130
|
+
subscribeSessions(localDeviceId: string): Promise<ReadableStream<SessionEvent[]>>;
|
|
131
|
+
getLocalDeviceId(): Promise<string | null>;
|
|
132
|
+
updatePresence(localNodeId: string, ticketStr: string, isOnline?: boolean, ttlMs?: number, metadata?: string): Promise<void>;
|
|
133
|
+
startAutoConnect(userId: string, localDeviceId: string): void;
|
|
134
|
+
forceReconnectSnapshot(): void;
|
|
135
|
+
startPresenceLoop(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): void;
|
|
136
|
+
startAutoConnectOnce(userId: string, localDeviceId: string): Promise<void>;
|
|
137
|
+
startPresenceLoopOnce(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): Promise<void>;
|
|
138
|
+
private shouldUseResolvedDeviceName;
|
|
139
|
+
sendExplicitFilePath(connectionId: string, filePath: string, transferId?: string): Promise<string>;
|
|
140
|
+
sendExplicitFileData(params: ExplicitFileDataSendParams): Promise<void>;
|
|
141
|
+
getConnectionStates(): Promise<BackendConnectionState[]>;
|
|
142
|
+
onConnectionStateChange(callback: (state: BackendConnectionState) => void): Promise<() => void>;
|
|
143
|
+
/**
|
|
144
|
+
* Subscribe to raw messages forwarded from native iroh connections.
|
|
145
|
+
* The Rust backend emits `iroh://message` Tauri events for messages that
|
|
146
|
+
* arrive on the main stream of an incoming connection. This lets the TS
|
|
147
|
+
* Client.handleMessage() run token validation on native-side connections.
|
|
148
|
+
*
|
|
149
|
+
* Payload: { connectionId: string, streamId: string, data: number[] }
|
|
150
|
+
* The `data` array is the raw frame bytes; for TS-originated messages it is
|
|
151
|
+
* [4-byte-len BE][1-byte-type][JSON payload].
|
|
152
|
+
*/
|
|
153
|
+
onIncomingNativeMessage(callback: (connectionId: string, remoteNodeId: string | null, message: any) => void): Promise<() => void>;
|
|
154
|
+
getTransferHistory(limit?: number): Promise<Array<[string, unknown]>>;
|
|
155
|
+
deleteTransferJob(jobId: string): Promise<void>;
|
|
156
|
+
}
|