openrtc 2.0.0-rc.3 → 2.0.0-rc.30

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.
Files changed (89) hide show
  1. package/README.md +12 -8
  2. package/dist/{DelegatingRuntimeAdapter-DqfHkjLy.d.ts → DelegatingRuntimeAdapter-BFZDC604.d.ts} +32 -8
  3. package/dist/{types-BVJr065k.d.ts → ITransport-WV6gGMnX.d.ts} +42 -3
  4. package/dist/IpcRuntimeAdapter-CJq3dRBF.d.ts +19 -0
  5. package/dist/OpenRTCShared.d.ts +250 -0
  6. package/dist/OpenRTCShared.js +1 -0
  7. package/dist/WasmBridge-5GYKXPXK.js +1 -0
  8. package/dist/{OpenRTCShared-ZQPu5LqL.d.ts → assembly-q0jRRpsc.d.ts} +50 -250
  9. package/dist/{capabilities-YSskrE8H.d.ts → capabilities-BfZi4Cd7.d.ts} +4 -0
  10. package/dist/chunk-45WBH7E3.js +1 -0
  11. package/dist/chunk-7FPG3MFF.js +2 -0
  12. package/dist/chunk-AG2F6MOB.js +1 -0
  13. package/dist/chunk-CWGKLGJZ.js +1 -0
  14. package/dist/{chunk-A3IAG6EL.js → chunk-D2OJN5S5.js} +1 -1
  15. package/dist/chunk-DUY34MGT.js +1 -0
  16. package/dist/chunk-H5R5ZXXN.js +3 -0
  17. package/dist/chunk-KJTJLLJE.js +2 -0
  18. package/dist/{chunk-7Z6N46RB.js → chunk-LRT5GEGH.js} +2 -2
  19. package/dist/chunk-NRXEG5GQ.js +1 -0
  20. package/dist/chunk-OEVPKC3W.js +1 -0
  21. package/dist/chunk-VBUDERMM.js +2 -0
  22. package/dist/chunk-VOCOZ57Q.js +2 -0
  23. package/dist/chunk-XPL7PUBW.js +2 -0
  24. package/dist/chunk-Z2WVSXPW.js +1 -0
  25. package/dist/chunk-Z6TZLF4B.js +1 -0
  26. package/dist/controlPlane-P66ZTVNW.js +2 -0
  27. package/dist/deviceEnrollment-GL4JPVGG.js +2 -0
  28. package/dist/deviceKey-SBNKLVYF.js +1 -0
  29. package/dist/deviceManagement-PHY5TIOS.js +1 -0
  30. package/dist/deviceProfile-3BEQZLJF.js +2 -0
  31. package/dist/deviceRoster-VZA3TQOR.js +1 -0
  32. package/dist/dist-FIVA6EPA.js +277 -0
  33. package/dist/index.d.ts +10 -8
  34. package/dist/index.js +1 -1
  35. package/dist/ipcFactory-B6HBECSU.js +1 -0
  36. package/dist/native.d.ts +7 -8
  37. package/dist/native.js +1 -1
  38. package/dist/openrtc-WUVUMBQY.js +2 -0
  39. package/dist/openrtc_bg.wasm +0 -0
  40. package/dist/runtime/WasmRuntimeAdapter.d.ts +4 -4
  41. package/dist/runtime/WasmRuntimeAdapter.js +1 -1
  42. package/dist/runtime/device-status.d.ts +2 -4
  43. package/dist/runtime/factories.d.ts +21 -0
  44. package/dist/runtime/factories.js +1 -0
  45. package/dist/runtime/index.d.ts +30 -78
  46. package/dist/runtime/index.js +1 -2
  47. package/dist/testing.d.ts +9 -18
  48. package/dist/testing.js +1 -1
  49. package/dist/transport/index.d.ts +2 -3
  50. package/dist/transport/index.js +1 -1
  51. package/dist/{types-DkgaCyqS.d.ts → types-DVNSd5B9.d.ts} +71 -4
  52. package/dist/{types-DNl4KHHY.d.ts → types-Di034GVQ.d.ts} +112 -16
  53. package/package.json +3 -27
  54. package/dist/IEngineBridge-BbsT8hof.d.ts +0 -17
  55. package/dist/ITransport-BsPcaov7.d.ts +0 -16
  56. package/dist/OpenRTCShared-TKAQLONA.js +0 -1
  57. package/dist/WasmBridge-2A22U7RU.js +0 -1
  58. package/dist/auth/index.d.ts +0 -78
  59. package/dist/auth/index.js +0 -1
  60. package/dist/auth/internal.d.ts +0 -4
  61. package/dist/auth/internal.js +0 -1
  62. package/dist/chunk-2QHDEGVX.js +0 -1
  63. package/dist/chunk-3USHQ7QW.js +0 -3
  64. package/dist/chunk-5LRLWIT5.js +0 -1
  65. package/dist/chunk-6TAVJ46R.js +0 -1
  66. package/dist/chunk-7H2JPCBN.js +0 -1
  67. package/dist/chunk-BXFXPIXO.js +0 -1
  68. package/dist/chunk-C7YN5MSV.js +0 -1
  69. package/dist/chunk-F2XGNLXL.js +0 -2
  70. package/dist/chunk-GW7P3D54.js +0 -1
  71. package/dist/chunk-K37WVIZL.js +0 -1
  72. package/dist/chunk-N26S7V4N.js +0 -1
  73. package/dist/chunk-N4SX7C3W.js +0 -2
  74. package/dist/chunk-NB4H5TP3.js +0 -1
  75. package/dist/chunk-NT5YHZQH.js +0 -1
  76. package/dist/chunk-PODAMIL6.js +0 -2
  77. package/dist/chunk-PRVFZI2T.js +0 -1
  78. package/dist/chunk-RD3JEGGF.js +0 -2
  79. package/dist/chunk-UEYM6WTT.js +0 -2
  80. package/dist/chunk-VK6KX433.js +0 -1
  81. package/dist/chunk-YBXGNKM7.js +0 -2
  82. package/dist/factories-LI53SFLH.js +0 -1
  83. package/dist/ipcFactory-QY44OIKA.js +0 -1
  84. package/dist/openrtc-UU4BBJLG.js +0 -2
  85. package/dist/runtime/legacy.d.ts +0 -18
  86. package/dist/runtime/legacy.js +0 -1
  87. package/dist/runtime/tauri.d.ts +0 -6
  88. package/dist/runtime/tauri.js +0 -1
  89. package/dist/tauri-Cz9n17g8.d.ts +0 -33
@@ -1,21 +1,17 @@
1
- import { R as RuntimeFactoryOptions, P as PlutoRuntimeAssembly, d as OpenRTCClient, e as PeerReconciliationStats } from '../OpenRTCShared-ZQPu5LqL.js';
2
- export { f as OPENRTC_RUNTIME_POLICY, g as RuntimeClient, h as RuntimePolicySnapshot, D as ScopedConnectionActorError, i as ScopedConnectionActorErrorKind, j as ScopedConnectionActorHandle, k as ScopedConnectionActorHandleOptions, l as ScopedConnectionActorRegistry, m as ScopedConnectionActorState, n as ScopedConnectionClose, o as ScopedConnectionDial, p as ScopedConnectionKey, q as ScopedLogicalChannelHandle, r as ScopedPreferredTransport, s as getRuntimePolicy, t as scopedConnectionKey, u as scopedConnectionKeyToString } from '../OpenRTCShared-ZQPu5LqL.js';
3
- import { f as OpenRTCCapabilityHandle } from '../types-DNl4KHHY.js';
4
- import { C as Connection, r as RuntimeConnectionTarget, v as RuntimeRawConnection } from '../types-DkgaCyqS.js';
5
- export { A as ChannelDescriptor, B as ConnectionEvent, D as ConnectionTarget, E as DeviceProfile, I as IncomingStream, P as PeerConnectOptions, F as PeerReadiness, G as PeerStreamOptions, H as PresenceLoopOptions, J as RawConnection, y as RuntimeApplicationPayloadReadinessOptions, K as RuntimeApplicationPayloadRouteOptions, L as RuntimeAuthContext, g as RuntimeAuthIdentity, M as RuntimeAutoConnectPolicy, R as RuntimeChannelDescriptor, a as RuntimeClientOptions, z as RuntimeConnectionEvent, c as RuntimeConnectionStateSnapshot, j as RuntimeDevice, n as RuntimeDeviceConnectOptions, N as RuntimeDevicePresenceStatus, O as RuntimeDeviceStatus, m as RuntimeDeviceStatusSnapshot, f as RuntimeIncomingStream, p as RuntimeJoinRoomOptions, h as RuntimeLocalDeviceInfo, i as RuntimeLocalDeviceProfile, Q as RuntimeLogicalChannelFraming, l as RuntimeManagedSession, S as RuntimeManagedSessionKind, k as RuntimeManagedSessionOptions, T as RuntimeManagedSessionPlatform, e as RuntimePeerConnectOptions, x as RuntimePeerHealth, U as RuntimePeerLifecycleStatus, d as RuntimePeerReadinessSnapshot, V as RuntimePeerScope, W as RuntimePeerSessionSnapshot, b as RuntimePeerState, u as RuntimePeerStreamOptions, w as RuntimePresenceLoopOptions, X as RuntimePresencePolicy, q as RuntimeRoomMember, s as RuntimeScopedChannelOptions, t as RuntimeScopedLogicalChannel, o as RuntimeSession, Y as RuntimeUiConnectionStatus, Z as ScopedChannelOptions, _ as ScopedLogicalChannel, $ as Session, a0 as SessionOptions } from '../types-DkgaCyqS.js';
1
+ import { P as PeerReconciliationStats } from '../assembly-q0jRRpsc.js';
2
+ export { O as OPENRTC_RUNTIME_POLICY, a as RuntimeClient, R as RuntimePolicySnapshot, D as ScopedConnectionActorError, d as ScopedConnectionActorErrorKind, e as ScopedConnectionActorHandle, f as ScopedConnectionActorHandleOptions, g as ScopedConnectionActorRegistry, h as ScopedConnectionActorState, i as ScopedConnectionClose, j as ScopedConnectionDial, k as ScopedConnectionKey, l as ScopedLogicalChannelHandle, m as ScopedPreferredTransport, n as getRuntimePolicy, o as scopedConnectionKey, p as scopedConnectionKeyToString } from '../assembly-q0jRRpsc.js';
3
+ import { OpenRTCClient } from '../OpenRTCShared.js';
4
+ import { f as OpenRTCCapabilityHandle } from '../types-Di034GVQ.js';
5
+ import { C as Connection, D as RuntimeConnectionTarget, s as RuntimeRawConnection } from '../types-DVNSd5B9.js';
6
+ export { F as ChannelDescriptor, G as ConnectionEvent, H as ConnectionTarget, J as DeviceProfile, K as IncomingStream, I as IrohBrowserProtocolStore, y as IrohDocEntry, x as IrohMutationReceipt, w as IrohNamespaceDescriptor, P as PeerConnectOptions, L as PeerReadiness, M as PeerStreamOptions, N as PresenceLoopOptions, O as RawConnection, k as RuntimeApplicationPayloadReadinessOptions, Q as RuntimeApplicationPayloadRouteOptions, S as RuntimeAuthContext, z as RuntimeAuthIdentity, T as RuntimeAutoConnectPolicy, R as RuntimeChannelDescriptor, v as RuntimeClientOptions, l as RuntimeConnectionEvent, j as RuntimeConnectionStateSnapshot, h as RuntimeDevice, p as RuntimeDeviceConnectOptions, U as RuntimeDevicePresenceStatus, V as RuntimeDeviceStatus, o as RuntimeDeviceStatusSnapshot, f as RuntimeIncomingStream, t as RuntimeJoinRoomOptions, q as RuntimeLocalDeviceInfo, r as RuntimeLocalDeviceProfile, W as RuntimeLogicalChannelFraming, n as RuntimeManagedSession, X as RuntimeManagedSessionKind, m as RuntimeManagedSessionOptions, Y as RuntimeManagedSessionPlatform, b as RuntimePeerConnectOptions, d as RuntimePeerHealth, Z as RuntimePeerLifecycleStatus, c as RuntimePeerReadinessSnapshot, _ as RuntimePeerScope, $ as RuntimePeerSessionSnapshot, a as RuntimePeerState, e as RuntimePeerStreamOptions, E as RuntimePresenceLoopOptions, a0 as RuntimePresencePolicy, u as RuntimeRoomMember, g as RuntimeScopedChannelOptions, i as RuntimeScopedLogicalChannel, B as RuntimeSession, a1 as RuntimeUiConnectionStatus, a2 as ScopedChannelOptions, a3 as ScopedLogicalChannel, a4 as Session, a5 as SessionOptions } from '../types-DVNSd5B9.js';
6
7
  import * as Draft14 from '@moq/net';
7
- import { a0 as SignalingOptions, q as ISignalingBackend, R as RuntimeIdentity, j as RoomMember, r as SignalingEnvelope, S as SignalingSession, D as Device, x as DesiredPeerProjection, B as BackendConnectionState, $ as AppLimits, H as GrantScope, J as JoinRoomOptions, I as IncomingStreamChannelMetadata, U as ApplicationCryptoStreamTools, a1 as RoomCreationMode, i as ClientOptions, A as ApplicationPayloadCrypto, n as DiscoveryMode, Q as ProtocolCapabilityMap, a2 as ScanningLoopOptions, a3 as ScanningLoopHandle, a4 as RuntimeBootstrapOptions, a5 as RuntimeBootstrapResult, a as ApplicationPayloadReadinessOptions, a6 as ManagedApplicationRouteOptions, d as PeerState, e as PeerScope, f as PeerHealth, g as ChannelDescriptor, a7 as JoinRequest, N as NativeConnectParams, z as NativeConnectResult, a8 as SpaceTokenProvider } from '../types-BVJr065k.js';
8
- import { R as RuntimeCapabilities } from '../capabilities-YSskrE8H.js';
9
- export { B as BROWSER_WASM_RUNTIME_CAPABILITIES, b as BrowserRuntimeCapabilityHost, N as NATIVE_IPC_RUNTIME_CAPABILITIES, c as NativeRuntimeStatusSnapshot, d as NativeRuntimeTransportFeatureStatus, e as RuntimeAdapterKind, a as RuntimeCapabilityProfile, f as cloneRuntimeCapabilities, r as runtimeCapabilitiesForBrowserHost, g as runtimeCapabilitiesFromNativeStatus, h as runtimeCapabilityProfile } from '../capabilities-YSskrE8H.js';
8
+ import { a5 as SignalingOptions, I as ISignalingBackend, j as RuntimeIdentity, i as RoomMember, k as SignalingEnvelope, r as SignalingSession, D as Device, o as DesiredPeerProjection, t as BackendConnectionState, a4 as AppLimits, G as GrantScope, W as JoinRoomOptions, U as IncomingStreamChannelMetadata, a0 as ApplicationCryptoStreamTools, a6 as RoomCreationMode, g as ClientOptions, w as ApplicationPayloadCrypto, h as DiscoveryMode, $ as ProtocolCapabilityMap, a7 as ScanningLoopOptions, a8 as ScanningLoopHandle, a9 as RuntimeBootstrapOptions, aa as RuntimeBootstrapResult, x as ApplicationPayloadReadinessOptions, ab as ManagedApplicationRouteOptions, J as PeerState, K as PeerScope, O as PeerHealth, Q as ChannelDescriptor, ac as JoinRequest, N as NativeConnectParams, q as NativeConnectResult } from '../ITransport-WV6gGMnX.js';
9
+ import { R as RuntimeCapabilities } from '../capabilities-BfZi4Cd7.js';
10
+ export { B as BROWSER_WASM_RUNTIME_CAPABILITIES, b as BrowserRuntimeCapabilityHost, N as NATIVE_IPC_RUNTIME_CAPABILITIES, c as NativeRuntimeStatusSnapshot, d as NativeRuntimeTransportFeatureStatus, e as RuntimeAdapterKind, a as RuntimeCapabilityProfile, f as cloneRuntimeCapabilities, r as runtimeCapabilitiesForBrowserHost, g as runtimeCapabilitiesFromNativeStatus, h as runtimeCapabilityProfile } from '../capabilities-BfZi4Cd7.js';
10
11
  export { RuntimeDeviceActiveOptions, isRuntimeDeviceActive, isRuntimeDeviceConnectable, isRuntimeDeviceRoutable } from './device-status.js';
11
- import { I as IpcRuntimeAdapter } from '../tauri-Cz9n17g8.js';
12
- export { a as IpcRuntimeAdapterOptions, T as TauriRuntimeAdapter, b as TauriRuntimeAdapterOptions, c as createTauriIpcBridge } from '../tauri-Cz9n17g8.js';
13
- import { a as WasmBridge } from '../DelegatingRuntimeAdapter-DqfHkjLy.js';
14
- import { P as PlutoIpcBridge } from '../ipc-CflAVodw.js';
15
- export { N as NativeIpcFailureKind, a as PlutoIpcUnlisten, c as classifyNativeIpcFailure, i as isNativeIpcCommandUnavailable } from '../ipc-CflAVodw.js';
16
- export { WasmRuntimeAdapter } from './WasmRuntimeAdapter.js';
17
- import '../IEngineBridge-BbsT8hof.js';
18
- import '../ITransport-BsPcaov7.js';
12
+ export { I as IpcRuntimeAdapter, a as IpcRuntimeAdapterOptions } from '../IpcRuntimeAdapter-CJq3dRBF.js';
13
+ export { P as NativeBridge, N as NativeIpcFailureKind, P as PlutoIpcBridge, a as PlutoIpcUnlisten, c as classifyNativeIpcFailure, i as isNativeIpcCommandUnavailable } from '../ipc-CflAVodw.js';
14
+ import '../DelegatingRuntimeAdapter-BFZDC604.js';
19
15
 
20
16
  declare class Signaling {
21
17
  private readonly appTag;
@@ -34,6 +30,10 @@ declare class Signaling {
34
30
  signInWithPluto(): Promise<void>;
35
31
  signOut(): Promise<void>;
36
32
  stopAuthScopedActivity(): Promise<void>;
33
+ setCoordinationHostAvailability(input: {
34
+ available: boolean;
35
+ reason: string;
36
+ }): void;
37
37
  getRuntimeCapabilities(): RuntimeCapabilities | undefined;
38
38
  getTurnCredentials(): Promise<any>;
39
39
  updatePresence(localNodeId: string, ticketStr: string, isOnline?: boolean, ttlMs?: number, metadata?: string): Promise<void>;
@@ -63,18 +63,6 @@ declare class Signaling {
63
63
  setWasmClient(client: any): void;
64
64
  }
65
65
 
66
- /**
67
- * @deprecated Legacy assembly helper. Use `OpenRTC()` for app code.
68
- * Removal target: OpenRTC 0.2.0.
69
- */
70
- declare function createWasmClient(options: RuntimeFactoryOptions): Promise<PlutoRuntimeAssembly<WasmBridge>>;
71
- /**
72
- * @deprecated Legacy assembly helper. Native applications should use
73
- * `createNativeOpenRTC` from `openrtc/native`.
74
- * Removal target: OpenRTC 0.2.0.
75
- */
76
- declare function createIpcClient(options: RuntimeFactoryOptions, bridge: PlutoIpcBridge): PlutoRuntimeAssembly<IpcRuntimeAdapter>;
77
-
78
66
  type OpenRTCCapabilityRuntime = OpenRTCClient;
79
67
  /**
80
68
  * Low-level escape hatch used only by `openrtc/runtime`. Product code should
@@ -124,6 +112,12 @@ interface TransportInterface {
124
112
  interface MoQSessionOptions {
125
113
  onSubscriptionTerminated?: (namespace: string, name: string, error: unknown) => void;
126
114
  }
115
+ interface MoQDatagramDuplex {
116
+ readonly maxDatagramSize?: number;
117
+ readonly readable: ReadableStream<Uint8Array>;
118
+ readonly writable: WritableStream<Uint8Array>;
119
+ close(): void;
120
+ }
127
121
  /**
128
122
  * Draft-14 MoQT adapter. The OpenRTC controller owns reconnect and lifecycle;
129
123
  * this class owns only one negotiated relay session and its protocol handles.
@@ -142,6 +136,12 @@ declare class MoQSession {
142
136
  private readonly setupPromise;
143
137
  constructor(transport: TransportInterface, onObject?: (ns: string, name: string, obj: Uint8Array, meta: unknown) => void, role?: number, relayUrl?: URL, options?: MoQSessionOptions);
144
138
  requireConnection(): Draft14.Connection.Established;
139
+ /**
140
+ * Open the patched Draft 14 object-datagram surface used only by the Iroh
141
+ * packet carrier. Existing application-data publishing remains on subgroup
142
+ * streams and never shares readiness with this duplex.
143
+ */
144
+ openDatagramDuplex(publishNamespace: string, subscribeNamespace: string, trackName: string): Promise<MoQDatagramDuplex>;
145
145
  init(): Promise<void>;
146
146
  waitForSetup(): Promise<void>;
147
147
  onClose(callback: (reason?: unknown) => void): () => void;
@@ -383,7 +383,7 @@ declare class Client {
383
383
  buildCompoundTicketWithToken(irohTicket: string, grantScope: GrantScope, maxConnections?: number): string;
384
384
  setManagedPresenceTicket(ticket: string | null): void;
385
385
  clearManagedPresenceTicket(): void;
386
- registerSessionToken(token: string, grantScope: GrantScope, maxConnections: number): void;
386
+ registerSessionToken(token: string, grantScope: GrantScope, maxConnections: number, expiresAtMs?: number): void;
387
387
  revokeSessionToken(token: string): void;
388
388
  revokeTokensByScope(grantScope: GrantScope): Promise<string[]>;
389
389
  clearSessionTokens(): Promise<void>;
@@ -540,52 +540,4 @@ declare function createRuntimeJsonFrameDecoder<T = unknown>(onValue: RuntimeJson
540
540
  declare function concatRuntimeBytes(a: ByteArrayLike, b: ByteArrayLike): ByteArray;
541
541
  declare function readRuntimeU32BE(bytes: ByteArrayLike, offset: number): number;
542
542
 
543
- type MintSpaceTokenRequest = {
544
- spaceKey: string;
545
- memberId?: string;
546
- ttl?: number;
547
- sandboxAppId?: string;
548
- };
549
- type MintSpaceTokenResponse = {
550
- token: string;
551
- expiresAt: number;
552
- tokenLifetimeSeconds: number;
553
- namespaceId: string;
554
- spaceAppTag: string;
555
- };
556
- /**
557
- * Mint a namespace-scoped Firebase custom token from your backend using the
558
- * OpenRTC `POST /v1/spaces/tokens` endpoint. Never call this from browser code
559
- * with a secret key — proxy through your server.
560
- */
561
- type EnableSpaceAuthResponse = {
562
- success: true;
563
- space: {
564
- namespaceId: string;
565
- requireScopedAuth: boolean;
566
- status: 'active' | 'revoked';
567
- };
568
- };
569
- /**
570
- * Opt a provisioned space into scoped-auth mode (required for all spaces).
571
- * Call from your backend with sk_live_... only.
572
- */
573
- declare function enableSpaceAuth(endpointUrl: string, secretKey: string, namespaceId: string): Promise<EnableSpaceAuthResponse>;
574
- declare function mintSpaceToken(endpointUrl: string, secretKey: string, request: MintSpaceTokenRequest): Promise<MintSpaceTokenResponse>;
575
- /**
576
- * Browser-safe space auth for static sites. Calls the rate-limited
577
- * `v1SpacePublicTokens` endpoint (pk_live_ + spaceKey only).
578
- */
579
- declare function createPublicSpaceTokenProvider(options: {
580
- apiKey: string;
581
- space?: string;
582
- spaceKey?: string;
583
- endpointUrl?: string;
584
- memberIdStorageKey?: string;
585
- sandboxAppId?: string;
586
- }): SpaceTokenProvider;
587
- declare function sandboxSpaceKey(spaceKey: string, sandboxAppId?: string): string;
588
- declare const spaceToken: typeof createPublicSpaceTokenProvider;
589
- declare const createSpaceTokenProvider: typeof createPublicSpaceTokenProvider;
590
-
591
- export { Connection, type CorrelationFields, type EnableSpaceAuthResponse, IpcRuntimeAdapter, type MintSpaceTokenRequest, type MintSpaceTokenResponse, PlutoIpcBridge as NativeBridge, type OpenRTCCapabilityRuntime, PlutoIpcBridge, PlutoRuntimeAssembly, RuntimeCapabilities, RuntimeConnectionController, RuntimeConnectionTarget, RuntimeFactoryOptions, type RuntimeJsonFrameDecoderOptions, type RuntimeJsonFrameHandler, RuntimeRawConnection, type RuntimeU32BEFrameHandler, clog, concatRuntimeBytes, correlationForDriveGrantScope, createIpcClient, createPublicSpaceTokenProvider, createRuntimeJsonFrameDecoder, createRuntimeU32BEFrameDecoder, createSpaceTokenProvider, createWasmClient, decodeRuntimeJsonPayload, enableSpaceAuth, encodeRuntimeJsonFrame, encodeRuntimeJsonPayload, encodeRuntimeU32BEFrame, logOpenRtcTeardownTrace, mintSpaceToken, openRtcDebug, openRtcDebugEnabled, openRtcDebugInfo, openRtcDebugLog, readRuntimeU32BE, renderCorrelationFields, runtimeForCapability as runtimeFromCapability, sandboxSpaceKey, spaceToken };
543
+ export { Connection, type CorrelationFields, type OpenRTCCapabilityRuntime, RuntimeCapabilities, RuntimeConnectionController, RuntimeConnectionTarget, type RuntimeJsonFrameDecoderOptions, type RuntimeJsonFrameHandler, RuntimeRawConnection, type RuntimeU32BEFrameHandler, clog, concatRuntimeBytes, correlationForDriveGrantScope, createRuntimeJsonFrameDecoder, createRuntimeU32BEFrameDecoder, decodeRuntimeJsonPayload, encodeRuntimeJsonFrame, encodeRuntimeJsonPayload, encodeRuntimeU32BEFrame, logOpenRtcTeardownTrace, openRtcDebug, openRtcDebugEnabled, openRtcDebugInfo, openRtcDebugLog, readRuntimeU32BE, renderCorrelationFields, runtimeForCapability as runtimeFromCapability };
@@ -1,2 +1 @@
1
- export{a as WasmRuntimeAdapter}from'../chunk-GW7P3D54.js';export{b as TauriRuntimeAdapter,a as createTauriIpcBridge}from'../chunk-5LRLWIT5.js';export{b as runtimeFromCapability}from'../chunk-PODAMIL6.js';export{b as createIpcClient,a as createWasmClient}from'../chunk-PRVFZI2T.js';export{b as Connection,t as RuntimeClient,c as RuntimeConnectionController,g as ScopedConnectionActorError,j as ScopedConnectionActorHandle,k as ScopedConnectionActorRegistry,f as clog,r as concatRuntimeBytes,e as correlationForDriveGrantScope,q as createRuntimeJsonFrameDecoder,m as createRuntimeU32BEFrameDecoder,o as decodeRuntimeJsonPayload,p as encodeRuntimeJsonFrame,n as encodeRuntimeJsonPayload,l as encodeRuntimeU32BEFrame,s as readRuntimeU32BE,d as renderCorrelationFields,h as scopedConnectionKey,i as scopedConnectionKeyToString}from'../chunk-3USHQ7QW.js';export{f as IpcRuntimeAdapter}from'../chunk-F2XGNLXL.js';import'../chunk-A3IAG6EL.js';import'../chunk-7Z6N46RB.js';export{q as BROWSER_WASM_RUNTIME_CAPABILITIES,r as NATIVE_IPC_RUNTIME_CAPABILITIES,o as OPENRTC_RUNTIME_POLICY,s as cloneRuntimeCapabilities,p as getRuntimePolicy,g as logOpenRtcTeardownTrace,t as runtimeCapabilitiesForBrowserHost,u as runtimeCapabilitiesFromNativeStatus,v as runtimeCapabilityProfile}from'../chunk-YBXGNKM7.js';export{b as openRtcDebug,a as openRtcDebugEnabled,c as openRtcDebugInfo,d as openRtcDebugLog}from'../chunk-VK6KX433.js';import'../chunk-NT5YHZQH.js';export{a as classifyNativeIpcFailure,b as isNativeIpcCommandUnavailable}from'../chunk-K37WVIZL.js';import'../chunk-BXFXPIXO.js';import {b}from'../chunk-N26S7V4N.js';import'../chunk-NB4H5TP3.js';import'../chunk-RD3JEGGF.js';import'../chunk-C7YN5MSV.js';export{a as isRuntimeDeviceActive,c as isRuntimeDeviceConnectable,b as isRuntimeDeviceRoutable}from'../chunk-CK6WQV7J.js';var j="https://api.openrtc.app";function c(e){if(typeof globalThis.crypto?.randomUUID!="function")throw new Error(`Secure request identity is unavailable for ${e}.`);return `${e}:${globalThis.crypto.randomUUID()}`}async function z(e,t,n){let o=e.replace(/\/$/,""),r=await fetch(`${o}/v1/spaces/${encodeURIComponent(n)}/scoped-auth`,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","X-OpenRTC-Idempotency-Key":c("enable-space-auth")},body:"{}"}),a=await r.json().catch(()=>({}));if(!r.ok){let s=typeof a?.error=="string"?a.error:`enableSpaceAuth failed (${r.status})`;throw new Error(s)}return a}async function q(e,t,n){let o=await fetch(e,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","X-OpenRTC-Idempotency-Key":c("mint-space-token")},body:JSON.stringify(n)}),r=await o.json().catch(()=>({}));if(!o.ok){let a=typeof r?.error=="string"?r.error:`mintSpaceToken failed (${o.status})`;throw new Error(a)}if(typeof r?.token!="string"||!r.token.trim())throw new Error("mintSpaceToken response missing token");return r}function d(e){let t=e.apiKey.trim(),n=(e.spaceKey??e.space??"").trim(),o=g(e.sandboxAppId),r=(e.endpointUrl??j).replace(/\/$/,""),a=e.memberIdStorageKey??`openrtc:space-member:${n}${o?`:sandbox:${o}`:""}`;return async()=>{if(!t||!n)throw new Error("spaceToken requires apiKey and space");let s=null;typeof sessionStorage<"u"?(s=sessionStorage.getItem(a),s||(s=globalThis.crypto?.randomUUID?.()??`member-${Date.now()}`,sessionStorage.setItem(a,s))):s=`member-${Date.now()}`;let m=await b().getAppCheckToken(),i=await fetch(`${r}/v1SpacePublicTokens`,{method:"POST",headers:{"Content-Type":"application/json","X-OpenRTC-Idempotency-Key":c("mint-public-space-token"),...m?{"X-Firebase-AppCheck":m}:{}},body:JSON.stringify({apiKey:t,spaceKey:n,memberId:s,...o?{sandboxAppId:o}:{}})}),{text:u,payload:p}=await B(i);if(!i.ok){let f=typeof p?.error=="string"?p.error:u.trim()?u.trim().slice(0,240):`public space token mint failed (${i.status})`;throw new Error(f)}let l=typeof p?.token=="string"?p.token.trim():"";if(!l)throw new Error("public space token response missing token");return {customToken:l}}}function M(e){if(!e.trim())return {};try{let t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return {}}}async function B(e){let t=e.text;if(typeof t=="function"){let o=await t.call(e).catch(()=>"");return {text:o,payload:M(o)}}let n=await e.json().catch(()=>({}));return {text:JSON.stringify(n),payload:n&&typeof n=="object"?n:{}}}function g(e){let t=e?.trim().toLowerCase()??"";if(!t)return "";if(!/^[a-z0-9][a-z0-9-]{0,47}$/.test(t))throw new Error("sandboxAppId must be 1-48 lowercase letters, numbers, or dashes.");return t}function J(e,t){let n=e.trim(),o=g(t);return o?`${n}::sandbox::${o}`:n}var L=d,H=d;
2
- export{d as createPublicSpaceTokenProvider,H as createSpaceTokenProvider,z as enableSpaceAuth,q as mintSpaceToken,J as sandboxSpaceKey,L as spaceToken};
1
+ export{a as runtimeFromCapability}from'../chunk-OEVPKC3W.js';import'../chunk-XPL7PUBW.js';export{a as isRuntimeDeviceActive,c as isRuntimeDeviceConnectable,b as isRuntimeDeviceRoutable}from'../chunk-CK6WQV7J.js';export{b as Connection,u as IpcRuntimeAdapter,t as RuntimeClient,c as RuntimeConnectionController,g as ScopedConnectionActorError,j as ScopedConnectionActorHandle,k as ScopedConnectionActorRegistry,f as clog,r as concatRuntimeBytes,e as correlationForDriveGrantScope,q as createRuntimeJsonFrameDecoder,m as createRuntimeU32BEFrameDecoder,o as decodeRuntimeJsonPayload,p as encodeRuntimeJsonFrame,n as encodeRuntimeJsonPayload,l as encodeRuntimeU32BEFrame,s as readRuntimeU32BE,d as renderCorrelationFields,h as scopedConnectionKey,i as scopedConnectionKeyToString}from'../chunk-H5R5ZXXN.js';import'../chunk-LRT5GEGH.js';export{a as classifyNativeIpcFailure,b as isNativeIpcCommandUnavailable}from'../chunk-Z2WVSXPW.js';import'../chunk-DUY34MGT.js';import'../chunk-D2OJN5S5.js';export{s as BROWSER_WASM_RUNTIME_CAPABILITIES,t as NATIVE_IPC_RUNTIME_CAPABILITIES,q as OPENRTC_RUNTIME_POLICY,u as cloneRuntimeCapabilities,r as getRuntimePolicy,i as logOpenRtcTeardownTrace,v as runtimeCapabilitiesForBrowserHost,w as runtimeCapabilitiesFromNativeStatus,x as runtimeCapabilityProfile}from'../chunk-VOCOZ57Q.js';export{b as openRtcDebug,a as openRtcDebugEnabled,c as openRtcDebugInfo,d as openRtcDebugLog}from'../chunk-AG2F6MOB.js';import'../chunk-CWGKLGJZ.js';import'../chunk-KJTJLLJE.js';import'../chunk-45WBH7E3.js';import'../chunk-NRXEG5GQ.js';
package/dist/testing.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- import { d as OpenRTCClient } from './OpenRTCShared-ZQPu5LqL.js';
2
1
  import { P as PlutoIpcBridge } from './ipc-CflAVodw.js';
3
- import { a as RuntimeClientOptions } from './types-DkgaCyqS.js';
4
- import { O as OpenRTCOptions, a as OpenRTCClient$1 } from './types-DNl4KHHY.js';
5
- import './types-BVJr065k.js';
6
- import './IEngineBridge-BbsT8hof.js';
7
- import './capabilities-YSskrE8H.js';
8
- import './ITransport-BsPcaov7.js';
2
+ import { O as OpenRTCOptions, a as OpenRTCClient } from './types-Di034GVQ.js';
3
+ import './OpenRTCShared.js';
4
+ import './assembly-q0jRRpsc.js';
5
+ import './types-DVNSd5B9.js';
6
+ import './ITransport-WV6gGMnX.js';
7
+ import './capabilities-BfZi4Cd7.js';
9
8
 
10
9
  interface OpenRTCV2Endpoints {
11
10
  controlPlane: string;
@@ -15,16 +14,8 @@ interface OpenRTCV2Endpoints {
15
14
  declare function createTestingOpenRTC(options: OpenRTCOptions, endpoints: OpenRTCV2Endpoints, testing?: {
16
15
  deviceId?: string;
17
16
  irohTestRelayUrl?: string;
18
- }): OpenRTCClient$1;
17
+ }): OpenRTCClient;
19
18
  /** Native equivalent for emulator and harness lanes; never import in product code. */
20
- declare function createTestingNativeOpenRTC(options: OpenRTCOptions, endpoints: OpenRTCV2Endpoints, bridge: PlutoIpcBridge): OpenRTCClient$1;
21
- /**
22
- * Rollback-harness constructor. This is intentionally confined to the
23
- * `openrtc/testing` export because it enables plaintext loopback coordination
24
- * for local emulators and also carries the time-bounded v1 runtime.
25
- */
26
- declare const createTestingLegacyOpenRTC: ((options: RuntimeClientOptions) => Promise<OpenRTCClient>) & {
27
- native: (options: RuntimeClientOptions, bridge?: PlutoIpcBridge) => OpenRTCClient;
28
- };
19
+ declare function createTestingNativeOpenRTC(options: OpenRTCOptions, endpoints: OpenRTCV2Endpoints, bridge: PlutoIpcBridge): OpenRTCClient;
29
20
 
30
- export { createTestingLegacyOpenRTC, createTestingNativeOpenRTC, createTestingOpenRTC };
21
+ export { createTestingNativeOpenRTC, createTestingOpenRTC };
package/dist/testing.js CHANGED
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-UEYM6WTT.js';import {c}from'./chunk-PODAMIL6.js';import {a}from'./chunk-7H2JPCBN.js';import'./chunk-2QHDEGVX.js';import'./chunk-6TAVJ46R.js';import'./chunk-N4SX7C3W.js';import'./chunk-PRVFZI2T.js';import'./chunk-3USHQ7QW.js';import'./chunk-F2XGNLXL.js';import'./chunk-A3IAG6EL.js';import'./chunk-7Z6N46RB.js';import'./chunk-YBXGNKM7.js';import'./chunk-VK6KX433.js';import'./chunk-NT5YHZQH.js';import'./chunk-K37WVIZL.js';import'./chunk-BXFXPIXO.js';import'./chunk-N26S7V4N.js';import'./chunk-NB4H5TP3.js';import'./chunk-RD3JEGGF.js';import'./chunk-C7YN5MSV.js';function m(e,t,n={}){return c(e,{endpoints:t,testingAllowInsecureLoopback:true,platform:"web",...n.deviceId?{deviceIdProvider:async()=>n.deviceId}:{},...n.irohTestRelayUrl?{irohTestRelayUrl:n.irohTestRelayUrl}:{},runtimeFactory:async i=>{let{createWasmClient:o}=await import('./factories-LI53SFLH.js');return o(i)}})}function d(e,t,n){return c(e,{endpoints:t,testingAllowInsecureLoopback:true,platform:"native",deviceKeyProvider:a$1(n),deviceIdProvider:async()=>{let i=await n.invoke("get_rtc_local_device_info");return String(i?.deviceId??"")},runtimeFactory:async i=>{let{createIpcClient:o}=await import('./ipcFactory-QY44OIKA.js');return o(i,n)}})}function p(e){let t=e.coordinationGateway;return {...e,...t?{coordinationGateway:{...t,testingAllowInsecureLoopback:true}}:{}}}var C=Object.assign(e=>a(p(e)),{native:(e,t)=>a.native(p(e),t)});export{C as createTestingLegacyOpenRTC,d as createTestingNativeOpenRTC,m as createTestingOpenRTC};
1
+ import {a}from'./chunk-7FPG3MFF.js';import'./chunk-VBUDERMM.js';import {b}from'./chunk-OEVPKC3W.js';import'./chunk-XPL7PUBW.js';import'./chunk-DUY34MGT.js';import'./chunk-NRXEG5GQ.js';function l(r,n,e={}){return b(r,{endpoints:n,testingAllowInsecureLoopback:true,platform:"web",...e.deviceId?{deviceIdProvider:async()=>e.deviceId}:{},...e.irohTestRelayUrl?{irohTestRelayUrl:e.irohTestRelayUrl}:{},runtimeFactory:async t=>{let{createWasmClient:i}=await import('./runtime/factories.js');return i(t)}})}function s(r,n,e){return b(r,{endpoints:n,testingAllowInsecureLoopback:true,platform:"native",deviceKeyProvider:a(e),deviceIdProvider:async()=>{let t=await e.invoke("get_rtc_local_device_info");return String(t?.deviceId??"")},runtimeFactory:async t=>{let{createIpcClient:i}=await import('./ipcFactory-B6HBECSU.js');return i(t,e)}})}export{s as createTestingNativeOpenRTC,l as createTestingOpenRTC};
@@ -1,6 +1,5 @@
1
- import { P as ProtocolName, K as RouteDescriptor, O as ProtocolCapability, Q as ProtocolCapabilityMap, A as ApplicationPayloadCrypto, U as ApplicationCryptoStreamTools } from '../types-BVJr065k.js';
2
- export { V as ApplicationCryptoBiStream, W as RouteFamily, X as RouteImplementationKind } from '../types-BVJr065k.js';
3
- import { I as ITransport } from '../ITransport-BsPcaov7.js';
1
+ import { c as ProtocolName, Z as RouteDescriptor, F as ITransport, _ as ProtocolCapability, $ as ProtocolCapabilityMap, w as ApplicationPayloadCrypto, a0 as ApplicationCryptoStreamTools } from '../ITransport-WV6gGMnX.js';
2
+ export { a1 as ApplicationCryptoBiStream, a2 as RouteFamily, a3 as RouteImplementationKind } from '../ITransport-WV6gGMnX.js';
4
3
 
5
4
  declare const TRANSPORT_LABELS: readonly ProtocolName[];
6
5
  declare function normalizeTransportLabel(value: unknown): ProtocolName | undefined;
@@ -1 +1 @@
1
- export{e as KEY_AGREEMENT_ALGORITHM,d as KEY_AGREEMENT_PUBLIC_KEY_BYTES,g as deriveApplicationCryptoKey,i as encodeApplicationKeyAgreementPayload,f as generateEphemeralKeyAgreement,c as getPreferredProtocolOrder}from'../chunk-7Z6N46RB.js';export{e as TRANSPORT_LABELS,o as createApplicationCryptoStreamTools,n as createSharedSecretApplicationCrypto,m as isApplicationEncryptedPayload,h as isDirectIrohTransportLabel,l as isIndependentTransportLabel,g as isIrohBaseTransportLabel,i as isOptionalTransportLabel,j as isWebRtcTransportLabel,f as normalizeTransportLabel}from'../chunk-VK6KX433.js';import'../chunk-NB4H5TP3.js';export{a as ROUTE_DESCRIPTORS,e as getRouteDescriptor,f as listRouteDescriptors}from'../chunk-C7YN5MSV.js';
1
+ export{e as KEY_AGREEMENT_ALGORITHM,d as KEY_AGREEMENT_PUBLIC_KEY_BYTES,g as deriveApplicationCryptoKey,i as encodeApplicationKeyAgreementPayload,f as generateEphemeralKeyAgreement,c as getPreferredProtocolOrder}from'../chunk-LRT5GEGH.js';export{o as TRANSPORT_LABELS,z as createApplicationCryptoStreamTools,y as createSharedSecretApplicationCrypto,x as isApplicationEncryptedPayload,r as isDirectIrohTransportLabel,w as isIndependentTransportLabel,q as isIrohBaseTransportLabel,s as isOptionalTransportLabel,t as isWebRtcTransportLabel,p as normalizeTransportLabel}from'../chunk-AG2F6MOB.js';export{a as ROUTE_DESCRIPTORS,e as getRouteDescriptor,f as listRouteDescriptors}from'../chunk-45WBH7E3.js';
@@ -1,6 +1,4 @@
1
- import { A as AuthContext } from './IEngineBridge-BbsT8hof.js';
2
- import { C as ConnectionOptions, A as ApplicationPayloadCrypto, a as ApplicationPayloadReadinessOptions, b as ApplicationPayloadRouteOptions, P as ProtocolName, c as ApplicationPayloadSendOptions, T as TransportLatencySnapshot, d as PeerState, e as PeerScope, f as PeerHealth, g as ChannelDescriptor$1, I as IncomingStreamChannelMetadata, D as Device, B as BackendConnectionState, L as LocalDeviceInfo, h as DeviceStatusSnapshot, M as ManagedDeviceConnectOptions, i as ClientOptions, S as SignalingSession, R as RuntimeIdentity, J as JoinRoomOptions, j as RoomMember, k as DevicePresenceStatus, l as PeerLifecycleStatus, m as PeerSessionSnapshot } from './types-BVJr065k.js';
3
- import { I as ITransport } from './ITransport-BsPcaov7.js';
1
+ import { v as ConnectionOptions, w as ApplicationPayloadCrypto, x as ApplicationPayloadReadinessOptions, y as ApplicationPayloadRouteOptions, c as ProtocolName, z as ApplicationPayloadSendOptions, F as ITransport, H as TransportLatencySnapshot, J as PeerState, K as PeerScope, O as PeerHealth, Q as ChannelDescriptor$1, U as IncomingStreamChannelMetadata, D as Device, t as BackendConnectionState, L as LocalDeviceInfo, l as DeviceStatusSnapshot, V as ManagedDeviceConnectOptions, g as ClientOptions, r as SignalingSession, j as RuntimeIdentity, W as JoinRoomOptions, i as RoomMember, X as DevicePresenceStatus, Y as PeerLifecycleStatus, d as PeerSessionSnapshot } from './ITransport-WV6gGMnX.js';
4
2
 
5
3
  type ConnectionHealth = 'unknown' | 'healthy' | 'suspect' | 'stale';
6
4
 
@@ -401,6 +399,22 @@ declare class Connection {
401
399
  private normalizeNegotiationId;
402
400
  }
403
401
 
402
+ type AuthContext = {
403
+ userId: string;
404
+ token?: string | null;
405
+ refreshToken?: string | null;
406
+ customToken?: string | null;
407
+ tokenProvider?: (forceRefresh?: boolean) => Promise<string | null>;
408
+ /**
409
+ * Supplies the platform attestation token required by the configured
410
+ * control plane. Firebase-backed hosted deployments use App Check today;
411
+ * keeping acquisition on the auth context prevents coordination code from
412
+ * owning a second Firebase app or assuming one global project.
413
+ */
414
+ appCheckTokenProvider?: (forceRefresh?: boolean) => Promise<string | null>;
415
+ expiresAtMs?: number | null;
416
+ };
417
+
404
418
  /**
405
419
  * App-facing options intentionally hide transport node identifiers from callbacks.
406
420
  */
@@ -439,6 +453,59 @@ interface RuntimeConnectionTarget {
439
453
  ticket: string;
440
454
  timeoutMs?: number;
441
455
  }
456
+ /**
457
+ * Durable browser storage used by the optional upstream Iroh docs, blobs, and
458
+ * gossip protocols. Implementations normally map these atomic operations to
459
+ * IndexedDB; OpenRTC deliberately does not own a second browser database.
460
+ */
461
+ interface IrohBrowserProtocolStore {
462
+ loadIdentity(): Promise<{
463
+ defaultAuthor: Uint8Array;
464
+ } | null>;
465
+ exportSnapshot(): Promise<{
466
+ authors: unknown[];
467
+ namespaces: unknown[];
468
+ entries: unknown[];
469
+ }>;
470
+ importAuthor(authorId: string, author: Uint8Array): Promise<void>;
471
+ importNamespace(capability: unknown): Promise<void>;
472
+ deleteNamespace(namespaceId: string): Promise<void>;
473
+ applyEntryTransaction(mutation: unknown): Promise<void>;
474
+ acknowledgeOutbox(operationId: string): Promise<void>;
475
+ listBlobManifests(): Promise<unknown[]>;
476
+ getBlobResumeState(contentHash: string): Promise<unknown | null>;
477
+ readBlobRange(contentHash: string, offset: number, length: number): Promise<Uint8Array | null>;
478
+ writeBlobRange(contentHash: string, size: number, chunkBytes: number, offset: number, bytes: Uint8Array): Promise<void>;
479
+ finalizeBlobIfComplete(contentHash: string): Promise<boolean>;
480
+ readBlobOutboardNode(contentHash: string, nodeId: string): Promise<Uint8Array | null>;
481
+ writeBlobOutboardNode(contentHash: string, nodeId: string, pair: Uint8Array): Promise<void>;
482
+ markBlobBaoReady(contentHash: string): Promise<void>;
483
+ writeBlobStagingChunk(sessionId: string, chunkIndex: number, bytes: Uint8Array): Promise<void>;
484
+ finalizeBlobStaging(sessionId: string, contentHash: string, size: number, chunkBytes: number): Promise<void>;
485
+ abortBlobStaging(sessionId: string): Promise<void>;
486
+ deleteBlob(contentHash: string, force: boolean): Promise<boolean>;
487
+ beginBlobImport(contentHash: string, size: number, chunkBytes: number): Promise<void>;
488
+ writeBlobChunk(contentHash: string, size: number, chunkBytes: number, chunkIndex: number, bytes: Uint8Array): Promise<void>;
489
+ finalizeBlobImport(contentHash: string, size: number, chunkBytes: number): Promise<void>;
490
+ flush(): Promise<void>;
491
+ }
492
+ interface IrohNamespaceDescriptor {
493
+ namespaceId: string;
494
+ capabilityKind: 'read' | 'write';
495
+ capability: Uint8Array;
496
+ }
497
+ interface IrohMutationReceipt {
498
+ contentHash: string;
499
+ operationId: string;
500
+ }
501
+ interface IrohDocEntry {
502
+ namespaceId: string;
503
+ authorId: string;
504
+ key: Uint8Array;
505
+ timestamp: number;
506
+ contentHash: string;
507
+ contentLength: number;
508
+ }
442
509
  interface RuntimePeerConnectOptions {
443
510
  deviceId?: string;
444
511
  ticket?: string;
@@ -595,4 +662,4 @@ type SessionOptions = RuntimeManagedSessionOptions;
595
662
  type Session = RuntimeManagedSession;
596
663
  type ChannelDescriptor = RuntimeChannelDescriptor;
597
664
 
598
- export { type Session as $, type ChannelDescriptor as A, type ConnectionEvent as B, Connection as C, type ConnectionTarget as D, type DeviceProfile as E, type PeerReadiness as F, type PeerStreamOptions as G, type PresenceLoopOptions as H, type IncomingStream as I, type RawConnection as J, type RuntimeApplicationPayloadRouteOptions as K, type RuntimeAuthContext as L, type RuntimeAutoConnectPolicy as M, type RuntimeDevicePresenceStatus as N, type RuntimeDeviceStatus as O, type PeerConnectOptions as P, type RuntimeLogicalChannelFraming as Q, type RuntimeChannelDescriptor as R, type RuntimeManagedSessionKind as S, type RuntimeManagedSessionPlatform as T, type RuntimePeerLifecycleStatus as U, type RuntimePeerScope as V, type RuntimePeerSessionSnapshot as W, type RuntimePresencePolicy as X, type RuntimeUiConnectionStatus as Y, type ScopedChannelOptions as Z, type ScopedLogicalChannel as _, type RuntimeClientOptions as a, type SessionOptions as a0, type RuntimePeerState as b, type RuntimeConnectionStateSnapshot as c, type RuntimePeerReadinessSnapshot as d, type RuntimePeerConnectOptions as e, type RuntimeIncomingStream as f, type RuntimeAuthIdentity as g, type RuntimeLocalDeviceInfo as h, type RuntimeLocalDeviceProfile as i, type RuntimeDevice as j, type RuntimeManagedSessionOptions as k, type RuntimeManagedSession as l, type RuntimeDeviceStatusSnapshot as m, type RuntimeDeviceConnectOptions as n, type RuntimeSession as o, type RuntimeJoinRoomOptions as p, type RuntimeRoomMember as q, type RuntimeConnectionTarget as r, type RuntimeScopedChannelOptions as s, type RuntimeScopedLogicalChannel as t, type RuntimePeerStreamOptions as u, type RuntimeRawConnection as v, type RuntimePresenceLoopOptions as w, type RuntimePeerHealth as x, type RuntimeApplicationPayloadReadinessOptions as y, type RuntimeConnectionEvent as z };
665
+ export { type RuntimePeerSessionSnapshot as $, type AuthContext as A, type RuntimeSession as B, Connection as C, type RuntimeConnectionTarget as D, type RuntimePresenceLoopOptions as E, type ChannelDescriptor as F, type ConnectionEvent as G, type ConnectionTarget as H, type IrohBrowserProtocolStore as I, type DeviceProfile as J, type IncomingStream as K, type PeerReadiness as L, type PeerStreamOptions as M, type PresenceLoopOptions as N, type RawConnection as O, type PeerConnectOptions as P, type RuntimeApplicationPayloadRouteOptions as Q, type RuntimeChannelDescriptor as R, type RuntimeAuthContext as S, type RuntimeAutoConnectPolicy as T, type RuntimeDevicePresenceStatus as U, type RuntimeDeviceStatus as V, type RuntimeLogicalChannelFraming as W, type RuntimeManagedSessionKind as X, type RuntimeManagedSessionPlatform as Y, type RuntimePeerLifecycleStatus as Z, type RuntimePeerScope as _, type RuntimePeerState as a, type RuntimePresencePolicy as a0, type RuntimeUiConnectionStatus as a1, type ScopedChannelOptions as a2, type ScopedLogicalChannel as a3, type Session as a4, type SessionOptions as a5, type RuntimePeerConnectOptions as b, type RuntimePeerReadinessSnapshot as c, type RuntimePeerHealth as d, type RuntimePeerStreamOptions as e, type RuntimeIncomingStream as f, type RuntimeScopedChannelOptions as g, type RuntimeDevice as h, type RuntimeScopedLogicalChannel as i, type RuntimeConnectionStateSnapshot as j, type RuntimeApplicationPayloadReadinessOptions as k, type RuntimeConnectionEvent as l, type RuntimeManagedSessionOptions as m, type RuntimeManagedSession as n, type RuntimeDeviceStatusSnapshot as o, type RuntimeDeviceConnectOptions as p, type RuntimeLocalDeviceInfo as q, type RuntimeLocalDeviceProfile as r, type RuntimeRawConnection as s, type RuntimeJoinRoomOptions as t, type RuntimeRoomMember as u, type RuntimeClientOptions as v, type IrohNamespaceDescriptor as w, type IrohMutationReceipt as x, type IrohDocEntry as y, type RuntimeAuthIdentity as z };
@@ -1,12 +1,38 @@
1
- import { O as OpenRTCPeerNamespace, a as OpenRTCChannelNamespace, b as OpenRTCDiagnosticsNamespace, c as OpenRTCDeviceNamespace } from './OpenRTCShared-ZQPu5LqL.js';
2
- import { R as RuntimeChannelDescriptor } from './types-DkgaCyqS.js';
1
+ import { OpenRTCPeerNamespace, OpenRTCChannelNamespace, OpenRTCDiagnosticsNamespace, OpenRTCDeviceNamespace } from './OpenRTCShared.js';
2
+ import { R as RuntimeChannelDescriptor } from './types-DVNSd5B9.js';
3
+ import { P as PlutoIrohConfiguration, a as PlutoRTCConfiguration, b as PlutoMoQConfiguration, T as TransportOptimization, c as ProtocolName } from './ITransport-WV6gGMnX.js';
3
4
 
4
5
  interface OpenRTCAuthProvider {
5
6
  /** Registered provider ID from the developer app capability manifest. */
6
7
  readonly providerId?: string;
8
+ /**
9
+ * Stable, non-secret, local-only identifier for the currently signed-in
10
+ * principal. It changes on login, logout, or account switch, but never for
11
+ * an ordinary access-token refresh. OpenRTC hashes this value together
12
+ * with the app and installation-key thumbprint before persisting a lookup.
13
+ *
14
+ * Optional during the 2.0 RC compatibility window. Providers that omit it
15
+ * use the assertion-first flow and remain correct, but cannot skip the
16
+ * assertion exchange on a cold process start.
17
+ */
18
+ getSessionKey?(): Promise<string | null>;
7
19
  getAssertion(input: {
8
20
  audience: 'https://api.openrtc.app/v2/assertions/exchange';
9
21
  forceRefresh: boolean;
22
+ /**
23
+ * Stable OpenRTC installation ID being enrolled. Consumer backends
24
+ * may bind product admission (for example a paid device allowance) to
25
+ * this value in the signed assertion. It is supplied only for an
26
+ * enrollment/renewal assertion, never for hourly gateway refreshes.
27
+ */
28
+ deviceId: string;
29
+ /**
30
+ * Present only after OpenRTC receives the exact structured response
31
+ * indicating that this installation ID is enrolled with another
32
+ * public key. Consumer backends should require recent interactive
33
+ * authentication before authorizing the replacement.
34
+ */
35
+ recoveryReason?: 'device-key-rotation';
10
36
  }): Promise<string | null>;
11
37
  /**
12
38
  * Optional identity-epoch observer. Notify only when the signed-in
@@ -14,7 +40,31 @@ interface OpenRTCAuthProvider {
14
40
  * revocation). Do not notify for ordinary OAuth/Firebase access-token
15
41
  * refreshes: OpenRTC refreshes its own avenue grant in place.
16
42
  */
17
- subscribe?(listener: () => void): () => void;
43
+ subscribe?(listener: (event: {
44
+ type: 'principal-changed';
45
+ sessionKey: string | null;
46
+ }) => void): () => void;
47
+ }
48
+ interface OpenRTCEnrolledDevice {
49
+ deviceId: string;
50
+ name?: string;
51
+ platform?: string;
52
+ enrolledAtMs: number | null;
53
+ lastGrantAtMs: number | null;
54
+ current: boolean;
55
+ }
56
+ /**
57
+ * Public, non-secret presentation metadata for one enrolled installation.
58
+ * OpenRTC derives a useful browser default when these fields are omitted;
59
+ * native hosts should pass the OS/device information reported by their host.
60
+ */
61
+ interface OpenRTCDeviceProfile {
62
+ /** Human-readable label such as `Bryant's iPhone` or `Chrome on Android`. */
63
+ name?: string;
64
+ /** Raw OS/runtime label such as `ios`, `android`, `macos`, or `web`. */
65
+ platform?: string;
66
+ /** Optional application-owned public presence metadata, bounded to 4 KiB. */
67
+ metadata?: string;
18
68
  }
19
69
  interface OpenRTCAttestationProvider {
20
70
  readonly kind: 'firebase-app-check' | 'apple-app-attest' | 'play-integrity' | `custom:${string}`;
@@ -54,10 +104,10 @@ interface OpenRTCUsageWarning extends OpenRTCUsageUpdate {
54
104
  kind: 'warning' | 'session-limit';
55
105
  }
56
106
  interface OpenRTCTransportPreferences {
57
- iroh?: boolean;
58
- webrtc?: boolean;
107
+ iroh?: boolean | PlutoIrohConfiguration;
108
+ webrtc?: boolean | PlutoRTCConfiguration;
59
109
  relay?: boolean;
60
- moq?: boolean;
110
+ moq?: boolean | PlutoMoQConfiguration;
61
111
  ble?: boolean;
62
112
  /**
63
113
  * Advanced privacy mode. `relay-only` suppresses direct Iroh addresses,
@@ -65,13 +115,16 @@ interface OpenRTCTransportPreferences {
65
115
  * developer manifest's relay opt-in.
66
116
  */
67
117
  privacy?: 'direct' | 'relay-only';
118
+ /** Optimize eligible routes for stability/cost or measured latency. */
119
+ optimizeFor?: TransportOptimization;
68
120
  /**
69
121
  * Advanced native integration for hosts whose Rust process owns the
70
122
  * application protocol registry (for example, a Tauri file-transfer host).
71
123
  * Normal SDK consumers should leave this disabled.
72
124
  */
73
125
  nativeHostProtocols?: boolean;
74
- priority?: readonly ('iroh' | 'webrtc' | 'moq' | 'ble')[];
126
+ /** Exact route order. Unsupported routes are skipped, never treated as failures. */
127
+ priority?: readonly ProtocolName[];
75
128
  }
76
129
  interface OpenRTCOptions {
77
130
  apiKey: string;
@@ -90,6 +143,30 @@ interface OpenRTCOptions {
90
143
  }
91
144
  type OpenRTCAccessMode = 'capability' | 'authenticated';
92
145
  type OpenRTCLatestStateMode = 'reliable' | 'latest-state';
146
+ interface OpenRTCConnection {
147
+ readonly id: string;
148
+ readonly peerId: string;
149
+ send(message: unknown): Promise<void>;
150
+ onMessage<T = unknown>(callback: (message: T) => void): () => void;
151
+ onClose(callback: () => void): () => void;
152
+ }
153
+ interface OpenRTCChannel<T> {
154
+ send(message: T): Promise<void>;
155
+ sendTo(peerId: string, message: T): Promise<void>;
156
+ onMessage(callback: (event: {
157
+ peerId: string;
158
+ message: T;
159
+ }) => void): () => void;
160
+ }
161
+ interface OpenRTCState<T> {
162
+ /** Replace the locally published value. Delivery is best-effort and coalesced. */
163
+ set(value: T): void;
164
+ /** A null value means the peer disconnected. */
165
+ watch(callback: (event: {
166
+ peerId: string;
167
+ value: T | null;
168
+ }) => void): () => void;
169
+ }
93
170
  interface OpenRTCCapabilityHandle {
94
171
  readonly kind: 'devices' | 'space' | 'room' | 'ticket';
95
172
  readonly id: string;
@@ -97,6 +174,10 @@ interface OpenRTCCapabilityHandle {
97
174
  readonly channels: OpenRTCChannelNamespace;
98
175
  readonly diagnostics: OpenRTCDiagnosticsNamespace;
99
176
  readonly closed: boolean;
177
+ state<T>(name: string): OpenRTCState<T>;
178
+ channel<T>(name: string): OpenRTCChannel<T>;
179
+ /** Observe current and future connections without taking lifecycle ownership. */
180
+ onConnection(callback: (connection: OpenRTCConnection) => void): () => void;
100
181
  close(): Promise<void>;
101
182
  }
102
183
  interface OpenRTCDevicesHandle extends OpenRTCCapabilityHandle {
@@ -121,20 +202,20 @@ interface OpenRTCRoomHandle extends OpenRTCCapabilityHandle {
121
202
  }
122
203
  interface OpenRTCTicketHandle extends OpenRTCCapabilityHandle {
123
204
  readonly kind: 'ticket';
205
+ /**
206
+ * Opaque, install-bound OpenRTC capability credential. This is not a
207
+ * transferable invitation or recipient redemption token. Do not display,
208
+ * log, persist, or send it to another installation.
209
+ * @deprecated This credential exposure is retained only for RC source
210
+ * compatibility and will not be part of the stable invitation workflow.
211
+ */
124
212
  readonly token: string;
125
213
  }
126
214
  interface OpenRTCDevicesStartOptions {
127
215
  auth?: OpenRTCAuthProvider;
128
216
  autoConnect?: 'none' | 'online';
129
217
  /** Optional local profile; it does not alter the durable device identity. */
130
- profile?: {
131
- name?: string;
132
- /**
133
- * Optional application-owned public presence metadata. It is bounded
134
- * to 4 KiB and folded into the initial connection/presence operation.
135
- */
136
- metadata?: string;
137
- };
218
+ profile?: OpenRTCDeviceProfile;
138
219
  maxPeers?: number;
139
220
  /** Requires the app manifest's advanced-fanout opt-in. */
140
221
  advancedFanout?: boolean;
@@ -176,7 +257,22 @@ interface OpenRTCUsageNamespace {
176
257
  }
177
258
  interface OpenRTCClient {
178
259
  readonly devices: {
260
+ /**
261
+ * Returns this installation's durable, app-scoped device ID without
262
+ * starting a capability or performing network work.
263
+ */
264
+ localId(): Promise<string>;
179
265
  start(options?: OpenRTCDevicesStartOptions): Promise<OpenRTCDevicesHandle>;
266
+ listEnrolled(options?: {
267
+ auth?: OpenRTCAuthProvider;
268
+ }): Promise<OpenRTCEnrolledDevice[]>;
269
+ revoke(deviceId: string, options?: {
270
+ auth?: OpenRTCAuthProvider;
271
+ }): Promise<void>;
272
+ revokeAll(options?: {
273
+ auth?: OpenRTCAuthProvider;
274
+ exceptCurrent?: boolean;
275
+ }): Promise<void>;
180
276
  };
181
277
  readonly spaces: {
182
278
  join(id: string, options?: OpenRTCSpaceJoinOptions): Promise<OpenRTCSpaceHandle>;
@@ -192,4 +288,4 @@ interface OpenRTCClient {
192
288
  close(): Promise<void>;
193
289
  }
194
290
 
195
- export type { OpenRTCOptions as O, OpenRTCClient as a, OpenRTCAccessMode as b, OpenRTCAttestationProvider as c, OpenRTCAuthProvider as d, OpenRTCBotVerificationProvider as e, OpenRTCCapabilityHandle as f, OpenRTCChannelCatalog as g, OpenRTCDevicesHandle as h, OpenRTCDevicesStartOptions as i, OpenRTCLatestStateMode as j, OpenRTCRoomHandle as k, OpenRTCRoomJoinOptions as l, OpenRTCSpaceHandle as m, OpenRTCSpaceJoinOptions as n, OpenRTCTicketHandle as o, OpenRTCTicketIssueOptions as p, OpenRTCTransportPreferences as q, OpenRTCUsageNamespace as r, OpenRTCUsageUpdate as s, OpenRTCUsageWarning as t };
291
+ export type { OpenRTCOptions as O, OpenRTCClient as a, OpenRTCAccessMode as b, OpenRTCAttestationProvider as c, OpenRTCAuthProvider as d, OpenRTCBotVerificationProvider as e, OpenRTCCapabilityHandle as f, OpenRTCChannel as g, OpenRTCChannelCatalog as h, OpenRTCConnection as i, OpenRTCDeviceProfile as j, OpenRTCDevicesHandle as k, OpenRTCDevicesStartOptions as l, OpenRTCEnrolledDevice as m, OpenRTCLatestStateMode as n, OpenRTCRoomHandle as o, OpenRTCRoomJoinOptions as p, OpenRTCSpaceHandle as q, OpenRTCSpaceJoinOptions as r, OpenRTCState as s, OpenRTCTicketHandle as t, OpenRTCTicketIssueOptions as u, OpenRTCTransportPreferences as v, OpenRTCUsageNamespace as w, OpenRTCUsageUpdate as x, OpenRTCUsageWarning as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openrtc",
3
- "version": "2.0.0-rc.3",
3
+ "version": "2.0.0-rc.30",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -43,18 +43,10 @@
43
43
  "types": "./dist/testing.d.ts",
44
44
  "import": "./dist/testing.js"
45
45
  },
46
- "./auth": {
47
- "types": "./dist/auth/index.d.ts",
48
- "import": "./dist/auth/index.js"
49
- },
50
46
  "./runtime": {
51
47
  "types": "./dist/runtime/index.d.ts",
52
48
  "import": "./dist/runtime/index.js"
53
49
  },
54
- "./runtime/legacy": {
55
- "types": "./dist/runtime/legacy.d.ts",
56
- "import": "./dist/runtime/legacy.js"
57
- },
58
50
  "./runtime/device-status": {
59
51
  "types": "./dist/runtime/device-status.d.ts",
60
52
  "import": "./dist/runtime/device-status.js"
@@ -63,18 +55,10 @@
63
55
  "types": "./dist/runtime/WasmRuntimeAdapter.d.ts",
64
56
  "import": "./dist/runtime/WasmRuntimeAdapter.js"
65
57
  },
66
- "./runtime/tauri": {
67
- "types": "./dist/runtime/tauri.d.ts",
68
- "import": "./dist/runtime/tauri.js"
69
- },
70
58
  "./transport": {
71
59
  "types": "./dist/transport/index.d.ts",
72
60
  "import": "./dist/transport/index.js"
73
61
  },
74
- "./auth/internal": {
75
- "types": "./dist/auth/internal.d.ts",
76
- "import": "./dist/auth/internal.js"
77
- },
78
62
  "./package.json": "./package.json"
79
63
  },
80
64
  "scripts": {
@@ -84,8 +68,8 @@
84
68
  "build:clean": "rm -rf dist && pnpm run build",
85
69
  "release:prepare": "pnpm run build:wasm && pnpm run build:clean && pnpm run check:lightweight-entry && pnpm run check:native-bundle",
86
70
  "build:types": "tsc --noEmit",
87
- "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 . && rm -rf ../../packages/openrtc/wasm/.gitignore",
88
- "build:wasm:legacy": "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 legacy-v1 && rm -rf ../../packages/openrtc/wasm/.gitignore",
71
+ "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,iroh-transport-webrtc,iroh-transport-moq && rm -rf ../../packages/openrtc/wasm/.gitignore",
72
+ "build:wasm:legacy": "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 legacy-v1,iroh-protocols-wasm,iroh-transport-webrtc,iroh-transport-moq && rm -rf ../../packages/openrtc/wasm/.gitignore",
89
73
  "test": "pnpm run test:deterministic && pnpm run test:emulator",
90
74
  "test:deterministic": "OPENRTC_DETERMINISTIC_TESTS=1 vitest run tests/unit tests/contract",
91
75
  "test:emulator": "node ../../tests/emulator/run-emulator-suite.mjs",
@@ -107,14 +91,6 @@
107
91
  "@noble/hashes": "^1.8.0",
108
92
  "tweetnacl": "^1.0.3"
109
93
  },
110
- "peerDependencies": {
111
- "firebase": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0"
112
- },
113
- "peerDependenciesMeta": {
114
- "firebase": {
115
- "optional": true
116
- }
117
- },
118
94
  "devDependencies": {
119
95
  "@types/node": "^20.0.0",
120
96
  "@vitest/coverage-v8": "^4.0.18",