openrtc 0.2.1 → 1.0.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 +49 -0
- package/dist/{DelegatingRuntimeAdapter-BxOcVIx_.d.ts → DelegatingRuntimeAdapter-By7pziBs.d.ts} +15 -15
- package/dist/IEngineBridge-C7OT2CRv.d.ts +10 -0
- package/dist/{IpcRuntimeAdapter-U5AEH0jn.d.ts → IpcRuntimeAdapter-DymXAsNU.d.ts} +2 -2
- package/dist/auth/index.js +1 -1
- package/dist/auth/internal.js +1 -1
- package/dist/chunk-3KDNLXT6.js +3 -0
- package/dist/chunk-5RXNKNPH.js +2 -0
- package/dist/chunk-6TIOSMVJ.js +1 -0
- package/dist/chunk-CK6WQV7J.js +1 -0
- package/dist/{chunk-7DN33VUQ.js → chunk-KH227SE4.js} +1 -1
- package/dist/chunk-KYDLXXNM.js +1 -0
- package/dist/chunk-W5JHUOK5.js +2 -0
- package/dist/device-status-nkXepu97.d.ts +560 -0
- package/dist/{framing-lxzHEuSr.d.ts → framing-BUtu0oZK.d.ts} +19 -559
- package/dist/index.d.ts +11 -7
- package/dist/index.js +2 -2
- package/dist/openrtc_bg.wasm +0 -0
- package/dist/runtime/WasmRuntimeAdapter.d.ts +3 -2
- package/dist/runtime/WasmRuntimeAdapter.js +1 -1
- package/dist/runtime/device-status.d.ts +3 -0
- package/dist/runtime/device-status.js +1 -0
- package/dist/runtime/index.d.ts +86 -83
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/tauri.d.ts +4 -3
- package/dist/runtime/tauri.js +1 -1
- package/dist/transport/index.d.ts +1 -1
- package/dist/{types-D0fRvUbN.d.ts → types-CzIpGV9x.d.ts} +87 -5
- package/package.json +11 -8
- package/dist/chunk-FQETZQPW.js +0 -2
- package/dist/chunk-IUHUYHNZ.js +0 -1
- package/dist/chunk-UBEE42VU.js +0 -2
- package/dist/chunk-UPO23UMZ.js +0 -3
- package/dist/chunk-WNJE3MJF.js +0 -1
- package/env/index.d.ts +0 -64
- package/env/index.mjs +0 -230
package/README.md
CHANGED
|
@@ -115,10 +115,30 @@ The recommended TypeScript extension path is:
|
|
|
115
115
|
This keeps the runtime responsible for peer/session establishment while leaving
|
|
116
116
|
full control of channel/message specifics to the developer.
|
|
117
117
|
|
|
118
|
+
Register a `RuntimeChannelDescriptor` with `client.channels.register(...)` and
|
|
119
|
+
install one process-level `client.channels.onIncomingChannel(...)` handler when
|
|
120
|
+
the protocol needs explicit readiness, routing, or framing metadata. This is an
|
|
121
|
+
application protocol extension. It does not replace the incoming router or
|
|
122
|
+
grant authority over admission, peer scopes, dialing, retry, transport
|
|
123
|
+
promotion, recovery, or settlement.
|
|
124
|
+
|
|
125
|
+
`OpenRTCClient` still inherits `RuntimeClient` compatibility methods, and
|
|
126
|
+
`openrtc/runtime`, `client.peers.addScope()` / `releaseScope()`, and
|
|
127
|
+
`client.advanced` expose authority-capable manual surfaces. They are not the
|
|
128
|
+
recommended extension model and must not be used to build a parallel lifecycle.
|
|
129
|
+
Their narrowing is future-version work.
|
|
130
|
+
|
|
118
131
|
Advanced custom ALPN protocol plugins are a Rust-first/native-first feature.
|
|
119
132
|
Browser parity is guaranteed at the connected-peer stream layer, not at the
|
|
120
133
|
full ALPN plugin layer.
|
|
121
134
|
|
|
135
|
+
For applications that want a reusable file protocol without making it part of
|
|
136
|
+
the core runtime, install `openrtc-file-transfer`. It implements versioned,
|
|
137
|
+
bounded file framing, acknowledgement, progress, cancellation, optional
|
|
138
|
+
integrity verification, and streaming receive sinks over `client.channels`.
|
|
139
|
+
Filesystem destinations, persistent queues, history, acceptance prompts, and
|
|
140
|
+
product policy remain consumer-owned.
|
|
141
|
+
|
|
122
142
|
## Main Surfaces
|
|
123
143
|
|
|
124
144
|
### Root Package
|
|
@@ -149,11 +169,40 @@ auto-connect, and connection state to one `openrtc::client::Client`. Do not use
|
|
|
149
169
|
browser/WASM runtime for a prototype; that path bypasses the native Rust runtime
|
|
150
170
|
and can hide native lifecycle/presence issues from tests.
|
|
151
171
|
|
|
172
|
+
Mobile hosts should forward connectivity-restored callbacks through
|
|
173
|
+
`client.advanced.notifyNetworkChange(reason)`. The Tauri plugin passes this hint
|
|
174
|
+
to the existing Iroh endpoint so it can reconsider relay and direct paths; it
|
|
175
|
+
does not create a second OpenRTC dial or retry loop.
|
|
176
|
+
|
|
152
177
|
## Auth Model
|
|
153
178
|
- `anonymous`: no Pluto auth required
|
|
154
179
|
- `required`: Pluto auth required; the SDK may initiate Pluto SSO
|
|
155
180
|
- `external`: Pluto auth still required, but the host app acquires it and injects it into the runtime
|
|
156
181
|
|
|
182
|
+
## Security Boundary
|
|
183
|
+
|
|
184
|
+
Iroh authenticates endpoint keys and encrypts transport traffic. OpenRTC's
|
|
185
|
+
managed avenues add scoped session-token admission and application payload
|
|
186
|
+
encryption. These protections are cumulative: transport connectivity alone is
|
|
187
|
+
not permission to invoke a product action.
|
|
188
|
+
|
|
189
|
+
- Prefer `client.devices`, `client.rooms`, `client.tickets`, and
|
|
190
|
+
`client.channels` managed flows; they retain admission and protected-route
|
|
191
|
+
checks across transport replacement.
|
|
192
|
+
- Treat raw endpoint tickets and low-level manual peer APIs as transport
|
|
193
|
+
primitives. A consumer using them must define its own authorization boundary.
|
|
194
|
+
- Authorize every privileged message against the accepted OpenRTC scope and the
|
|
195
|
+
consumer application's current ACL. Never trust a payload's self-declared
|
|
196
|
+
sender, role, or scope.
|
|
197
|
+
- Keep compound tickets and session tokens out of logs, telemetry, query
|
|
198
|
+
strings, crash reports, and UI diagnostics. Use URL fragments for intentional
|
|
199
|
+
browser handoff and scrub them immediately after capture.
|
|
200
|
+
- Revocation must invalidate the matching scope and product ACL; reconnecting a
|
|
201
|
+
transport must not restore revoked access.
|
|
202
|
+
|
|
203
|
+
The full owner and release contract is in
|
|
204
|
+
[`docs/architecture/application-security-and-delivery-contract.md`](../../docs/architecture/application-security-and-delivery-contract.md).
|
|
205
|
+
|
|
157
206
|
## Design Rule
|
|
158
207
|
If a feature requires discovery, signaling, presence, or lifecycle state, the TypeScript package should delegate to Rust rather than reimplement it locally, except for the scoped browser Firebase host layer where the official browser SDK is the source of truth. In both cases, keep the avenue semantics intact: persistent user-device rosters are not space/room live rosters.
|
|
159
208
|
|
package/dist/{DelegatingRuntimeAdapter-BxOcVIx_.d.ts → DelegatingRuntimeAdapter-By7pziBs.d.ts}
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { D as DiscoveryMode, A as AuthMode, S as SignalingMode, E as ExplicitFileDataSendParams, I as ISignalingBackend, R as RuntimeIdentity, a as Device, b as DeviceStatusSnapshot, P as PeerSessionSnapshot, c as ResolvedPeerIdentity, M as ManagedConnectionRecord, d as SignalingEnvelope, e as DeviceEvent, f as SignalingSession, g as SessionEvent, L as LocalDeviceInfo, N as NativeManagedSessionStartResult, G as GrantScope, B as BackendPeerBiStream, h as BackendPeerUniStream, i as
|
|
1
|
+
import { D as DiscoveryMode, A as AuthMode, S as SignalingMode, E as ExplicitFileDataSendParams, I as ISignalingBackend, R as RuntimeIdentity, a as Device, b as DeviceStatusSnapshot, P as PeerSessionSnapshot, c as ResolvedPeerIdentity, M as ManagedConnectionRecord, d as SignalingEnvelope, e as DeviceEvent, f as SignalingSession, g as SessionEvent, L as LocalDeviceInfo, N as NativeManagedSessionStartResult, G as GrantScope, B as BackendPeerBiStream, h as BackendPeerUniStream, i as NativeConnectParams, j as NativeConnectResult, k as BackendConnectionState } from './types-CzIpGV9x.js';
|
|
2
|
+
import { A as AuthContext } from './IEngineBridge-C7OT2CRv.js';
|
|
2
3
|
|
|
3
4
|
type RuntimeAdapterKind = 'browser-wasm' | 'native-ipc' | 'tauri-ipc' | 'unknown';
|
|
4
5
|
interface RuntimeCapabilities {
|
|
@@ -83,23 +84,17 @@ declare function cloneRuntimeCapabilities(capabilities: RuntimeCapabilities): Ru
|
|
|
83
84
|
declare function runtimeCapabilitiesFromNativeStatus(status: NativeRuntimeStatusSnapshot | null | undefined, allowWasmFallback?: boolean): RuntimeCapabilities;
|
|
84
85
|
declare function runtimeCapabilityProfile(capabilities: RuntimeCapabilities): RuntimeCapabilityProfile;
|
|
85
86
|
|
|
86
|
-
type AuthContext = {
|
|
87
|
-
userId: string;
|
|
88
|
-
token?: string | null;
|
|
89
|
-
refreshToken?: string | null;
|
|
90
|
-
customToken?: string | null;
|
|
91
|
-
tokenProvider?: (forceRefresh?: boolean) => Promise<string | null>;
|
|
92
|
-
expiresAtMs?: number | null;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
87
|
interface WasmBridgeOptions {
|
|
96
88
|
apiKey?: string;
|
|
97
89
|
discoveryMode?: DiscoveryMode;
|
|
90
|
+
space?: string;
|
|
98
91
|
spaceKey?: string;
|
|
99
92
|
authMode?: AuthMode;
|
|
100
93
|
signalingMode?: SignalingMode;
|
|
101
94
|
projectId?: string;
|
|
102
95
|
storagePrefix?: string;
|
|
96
|
+
deviceIdPersistence?: 'persistent' | 'ephemeral';
|
|
97
|
+
endpointIdPersistence?: 'persistent' | 'ephemeral';
|
|
103
98
|
nodeIdPersistence?: 'persistent' | 'ephemeral';
|
|
104
99
|
localDeviceId?: string;
|
|
105
100
|
deviceName?: string;
|
|
@@ -121,6 +116,7 @@ declare abstract class DelegatingRuntimeAdapter implements ISignalingBackend {
|
|
|
121
116
|
stopAuthScopedActivity(): Promise<void>;
|
|
122
117
|
getTurnCredentials(): Promise<any>;
|
|
123
118
|
updatePresence(localNodeId: string, ticketStr: string, isOnline: boolean, ttlMs: number, metadata?: string): Promise<void>;
|
|
119
|
+
refreshLivePresence(localNodeId: string, ticketStr: string, metadata?: string): Promise<void>;
|
|
124
120
|
setOffline(localNodeId: string): Promise<void>;
|
|
125
121
|
cleanupStaleDevices(): Promise<void>;
|
|
126
122
|
searchDevices(excludeNodeId?: string): Promise<Device[]>;
|
|
@@ -160,6 +156,9 @@ declare abstract class DelegatingRuntimeAdapter implements ISignalingBackend {
|
|
|
160
156
|
autoConnect?: boolean;
|
|
161
157
|
presence?: boolean;
|
|
162
158
|
}): Promise<NativeManagedSessionStartResult>;
|
|
159
|
+
notifyNetworkChange(options?: {
|
|
160
|
+
reason?: string;
|
|
161
|
+
}): Promise<unknown>;
|
|
163
162
|
getManagedNodeId(options?: {
|
|
164
163
|
initializeIfMissing?: boolean;
|
|
165
164
|
}): Promise<string | null>;
|
|
@@ -174,17 +173,18 @@ declare abstract class DelegatingRuntimeAdapter implements ISignalingBackend {
|
|
|
174
173
|
openPeerNativeBi(id: string, label: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
|
|
175
174
|
openPeerBiTransportOnly(id: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
|
|
176
175
|
openPeerUni(id: string, timeoutMs?: number): Promise<BackendPeerUniStream>;
|
|
177
|
-
connectToDevice(params:
|
|
178
|
-
deviceId?: string | null;
|
|
179
|
-
endpointTicket: string;
|
|
180
|
-
}): Promise<NativeConnectResult>;
|
|
176
|
+
connectToDevice(params: NativeConnectParams): Promise<NativeConnectResult>;
|
|
181
177
|
disconnectDevice(deviceId: string): Promise<void>;
|
|
182
178
|
isConnected(nodeId: string): Promise<boolean>;
|
|
183
179
|
getConnectionStates(): Promise<BackendConnectionState[]>;
|
|
184
180
|
onConnectionStateChange(callback: (state: BackendConnectionState) => void): Promise<() => void> | (() => void);
|
|
181
|
+
/** @deprecated Use named channels or `openrtc-file-transfer`. */
|
|
185
182
|
sendExplicitFilePath(connectionId: string, filePath: string, transferId?: string): Promise<string>;
|
|
183
|
+
/** @deprecated Use named channels or `openrtc-file-transfer`. */
|
|
186
184
|
sendExplicitFileData(params: ExplicitFileDataSendParams): Promise<void>;
|
|
185
|
+
/** @deprecated Transfer history belongs to the consumer application. */
|
|
187
186
|
getTransferHistory(limit?: number): Promise<Array<[string, unknown]>>;
|
|
187
|
+
/** @deprecated Transfer history belongs to the consumer application. */
|
|
188
188
|
deleteTransferJob(jobId: string): Promise<void>;
|
|
189
189
|
getRuntimeCapabilities(): RuntimeCapabilities;
|
|
190
190
|
onIncomingNativeMessage(callback: (connectionId: string, remoteNodeId: string | null, message: any) => void): Promise<() => void>;
|
|
@@ -198,4 +198,4 @@ declare abstract class DelegatingRuntimeAdapter implements ISignalingBackend {
|
|
|
198
198
|
setCoreClient(client: unknown): void;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
export {
|
|
201
|
+
export { BROWSER_WASM_RUNTIME_CAPABILITIES as B, DelegatingRuntimeAdapter as D, NATIVE_IPC_RUNTIME_CAPABILITIES as N, type RuntimeCapabilities as R, type WasmBridgeOptions as W, type RuntimeCapabilityProfile as a, type RuntimeAdapterKind as b, type NativeRuntimeStatusSnapshot as c, type NativeRuntimeTransportFeatureStatus as d, cloneRuntimeCapabilities as e, runtimeCapabilityProfile as f, runtimeCapabilitiesFromNativeStatus as r };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type AuthContext = {
|
|
2
|
+
userId: string;
|
|
3
|
+
token?: string | null;
|
|
4
|
+
refreshToken?: string | null;
|
|
5
|
+
customToken?: string | null;
|
|
6
|
+
tokenProvider?: (forceRefresh?: boolean) => Promise<string | null>;
|
|
7
|
+
expiresAtMs?: number | null;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type { AuthContext as A };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ClientOptions } from './types-
|
|
2
|
-
import { W as WasmBridgeOptions, D as DelegatingRuntimeAdapter } from './DelegatingRuntimeAdapter-
|
|
1
|
+
import { C as ClientOptions } from './types-CzIpGV9x.js';
|
|
2
|
+
import { W as WasmBridgeOptions, D as DelegatingRuntimeAdapter } from './DelegatingRuntimeAdapter-By7pziBs.js';
|
|
3
3
|
|
|
4
4
|
type PlutoIpcUnlisten = () => void | Promise<void>;
|
|
5
5
|
interface PlutoIpcBridge {
|
package/dist/auth/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{H as authHost,G as getAuthHost,F as registerDesktopAuthRelay}from'../chunk-W5JHUOK5.js';
|
package/dist/auth/internal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{F as registerDesktopAuthRelay}from'../chunk-W5JHUOK5.js';
|