openrtc 2.0.0-rc.8 → 2.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.
Files changed (90) hide show
  1. package/README.md +12 -8
  2. package/dist/DelegatingRuntimeAdapter-BFZDC604.d.ts +397 -0
  3. package/dist/{types-BHePJWbM.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-BswnbjpG.d.ts → assembly-q0jRRpsc.d.ts} +51 -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-C6PAXO3N.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-BFF336RG.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 +29 -62
  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-D0pqNSOf.d.ts → types-DVNSd5B9.d.ts} +71 -4
  52. package/dist/{types-ZdRrnIRw.d.ts → types-Di034GVQ.d.ts} +79 -15
  53. package/package.json +3 -27
  54. package/dist/DelegatingRuntimeAdapter-BLNigcS4.d.ts +0 -134
  55. package/dist/IEngineBridge-BbsT8hof.d.ts +0 -17
  56. package/dist/ITransport-BsPcaov7.d.ts +0 -16
  57. package/dist/OpenRTCShared-TKAQLONA.js +0 -1
  58. package/dist/WasmBridge-B7NTRYN5.js +0 -1
  59. package/dist/auth/index.d.ts +0 -78
  60. package/dist/auth/index.js +0 -1
  61. package/dist/auth/internal.d.ts +0 -4
  62. package/dist/auth/internal.js +0 -1
  63. package/dist/chunk-2QHDEGVX.js +0 -1
  64. package/dist/chunk-A7AMB23L.js +0 -2
  65. package/dist/chunk-BXFXPIXO.js +0 -1
  66. package/dist/chunk-BY3EPIAB.js +0 -2
  67. package/dist/chunk-C7YN5MSV.js +0 -1
  68. package/dist/chunk-D45U2NXV.js +0 -1
  69. package/dist/chunk-DZCZLRM5.js +0 -1
  70. package/dist/chunk-EUNCYGJD.js +0 -1
  71. package/dist/chunk-IAEGDK4P.js +0 -2
  72. package/dist/chunk-IAIGT5G3.js +0 -1
  73. package/dist/chunk-JIVVHBCB.js +0 -2
  74. package/dist/chunk-K37WVIZL.js +0 -1
  75. package/dist/chunk-N26S7V4N.js +0 -1
  76. package/dist/chunk-N4SX7C3W.js +0 -2
  77. package/dist/chunk-NB4H5TP3.js +0 -1
  78. package/dist/chunk-NCL672QJ.js +0 -3
  79. package/dist/chunk-NT5YHZQH.js +0 -1
  80. package/dist/chunk-O3D7S5MD.js +0 -1
  81. package/dist/chunk-RD3JEGGF.js +0 -2
  82. package/dist/chunk-VK6KX433.js +0 -1
  83. package/dist/factories-TLUZAXUG.js +0 -1
  84. package/dist/ipcFactory-QOAZVE56.js +0 -1
  85. package/dist/openrtc-C53CKZUM.js +0 -2
  86. package/dist/runtime/legacy.d.ts +0 -18
  87. package/dist/runtime/legacy.js +0 -1
  88. package/dist/runtime/tauri.d.ts +0 -6
  89. package/dist/runtime/tauri.js +0 -1
  90. package/dist/tauri-BgLgJoQA.d.ts +0 -33
@@ -1,18 +1,17 @@
1
- import { d as OpenRTCClient, P as PeerReconciliationStats } from '../OpenRTCShared-BswnbjpG.js';
2
- export { e as OPENRTC_RUNTIME_POLICY, R as RuntimeClient, f as RuntimePolicySnapshot, D as ScopedConnectionActorError, g as ScopedConnectionActorErrorKind, h as ScopedConnectionActorHandle, i as ScopedConnectionActorHandleOptions, j as ScopedConnectionActorRegistry, k as ScopedConnectionActorState, l as ScopedConnectionClose, m as ScopedConnectionDial, n as ScopedConnectionKey, o as ScopedLogicalChannelHandle, p as ScopedPreferredTransport, q as getRuntimePolicy, r as scopedConnectionKey, s as scopedConnectionKeyToString } from '../OpenRTCShared-BswnbjpG.js';
3
- import { f as OpenRTCCapabilityHandle } from '../types-ZdRrnIRw.js';
4
- import { C as Connection, r as RuntimeConnectionTarget, v as RuntimeRawConnection } from '../types-D0pqNSOf.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-D0pqNSOf.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 { $ as SignalingOptions, I as ISignalingBackend, R as RuntimeIdentity, a as RoomMember, e as SignalingEnvelope, h as SignalingSession, b as Device, g as DesiredPeerProjection, m as BackendConnectionState, _ as AppLimits, G as GrantScope, J as JoinRoomOptions, x as IncomingStreamChannelMetadata, Q as ApplicationCryptoStreamTools, a0 as RoomCreationMode, C as ClientOptions, o as ApplicationPayloadCrypto, D as DiscoveryMode, O as ProtocolCapabilityMap, a1 as ScanningLoopOptions, a2 as ScanningLoopHandle, a3 as RuntimeBootstrapOptions, a4 as RuntimeBootstrapResult, p as ApplicationPayloadReadinessOptions, a5 as ManagedApplicationRouteOptions, t as PeerState, u as PeerScope, v as PeerHealth, w as ChannelDescriptor, a6 as JoinRequest, k as NativeConnectParams, l as NativeConnectResult, a7 as SpaceTokenProvider } from '../types-BHePJWbM.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
- export { I as IpcRuntimeAdapter, a as IpcRuntimeAdapterOptions, T as TauriRuntimeAdapter, b as TauriRuntimeAdapterOptions, c as createTauriIpcBridge } from '../tauri-BgLgJoQA.js';
12
+ export { I as IpcRuntimeAdapter, a as IpcRuntimeAdapterOptions } from '../IpcRuntimeAdapter-CJq3dRBF.js';
12
13
  export { P as NativeBridge, N as NativeIpcFailureKind, P as PlutoIpcBridge, a as PlutoIpcUnlisten, c as classifyNativeIpcFailure, i as isNativeIpcCommandUnavailable } from '../ipc-CflAVodw.js';
13
- import '../IEngineBridge-BbsT8hof.js';
14
- import '../ITransport-BsPcaov7.js';
15
- import '../DelegatingRuntimeAdapter-BLNigcS4.js';
14
+ import '../DelegatingRuntimeAdapter-BFZDC604.js';
16
15
 
17
16
  declare class Signaling {
18
17
  private readonly appTag;
@@ -31,6 +30,10 @@ declare class Signaling {
31
30
  signInWithPluto(): Promise<void>;
32
31
  signOut(): Promise<void>;
33
32
  stopAuthScopedActivity(): Promise<void>;
33
+ setCoordinationHostAvailability(input: {
34
+ available: boolean;
35
+ reason: string;
36
+ }): void;
34
37
  getRuntimeCapabilities(): RuntimeCapabilities | undefined;
35
38
  getTurnCredentials(): Promise<any>;
36
39
  updatePresence(localNodeId: string, ticketStr: string, isOnline?: boolean, ttlMs?: number, metadata?: string): Promise<void>;
@@ -109,6 +112,12 @@ interface TransportInterface {
109
112
  interface MoQSessionOptions {
110
113
  onSubscriptionTerminated?: (namespace: string, name: string, error: unknown) => void;
111
114
  }
115
+ interface MoQDatagramDuplex {
116
+ readonly maxDatagramSize?: number;
117
+ readonly readable: ReadableStream<Uint8Array>;
118
+ readonly writable: WritableStream<Uint8Array>;
119
+ close(): void;
120
+ }
112
121
  /**
113
122
  * Draft-14 MoQT adapter. The OpenRTC controller owns reconnect and lifecycle;
114
123
  * this class owns only one negotiated relay session and its protocol handles.
@@ -127,6 +136,12 @@ declare class MoQSession {
127
136
  private readonly setupPromise;
128
137
  constructor(transport: TransportInterface, onObject?: (ns: string, name: string, obj: Uint8Array, meta: unknown) => void, role?: number, relayUrl?: URL, options?: MoQSessionOptions);
129
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>;
130
145
  init(): Promise<void>;
131
146
  waitForSetup(): Promise<void>;
132
147
  onClose(callback: (reason?: unknown) => void): () => void;
@@ -368,7 +383,7 @@ declare class Client {
368
383
  buildCompoundTicketWithToken(irohTicket: string, grantScope: GrantScope, maxConnections?: number): string;
369
384
  setManagedPresenceTicket(ticket: string | null): void;
370
385
  clearManagedPresenceTicket(): void;
371
- registerSessionToken(token: string, grantScope: GrantScope, maxConnections: number): void;
386
+ registerSessionToken(token: string, grantScope: GrantScope, maxConnections: number, expiresAtMs?: number): void;
372
387
  revokeSessionToken(token: string): void;
373
388
  revokeTokensByScope(grantScope: GrantScope): Promise<string[]>;
374
389
  clearSessionTokens(): Promise<void>;
@@ -525,52 +540,4 @@ declare function createRuntimeJsonFrameDecoder<T = unknown>(onValue: RuntimeJson
525
540
  declare function concatRuntimeBytes(a: ByteArrayLike, b: ByteArrayLike): ByteArray;
526
541
  declare function readRuntimeU32BE(bytes: ByteArrayLike, offset: number): number;
527
542
 
528
- type MintSpaceTokenRequest = {
529
- spaceKey: string;
530
- memberId?: string;
531
- ttl?: number;
532
- sandboxAppId?: string;
533
- };
534
- type MintSpaceTokenResponse = {
535
- token: string;
536
- expiresAt: number;
537
- tokenLifetimeSeconds: number;
538
- namespaceId: string;
539
- spaceAppTag: string;
540
- };
541
- /**
542
- * Mint a namespace-scoped Firebase custom token from your backend using the
543
- * OpenRTC `POST /v1/spaces/tokens` endpoint. Never call this from browser code
544
- * with a secret key — proxy through your server.
545
- */
546
- type EnableSpaceAuthResponse = {
547
- success: true;
548
- space: {
549
- namespaceId: string;
550
- requireScopedAuth: boolean;
551
- status: 'active' | 'revoked';
552
- };
553
- };
554
- /**
555
- * Opt a provisioned space into scoped-auth mode (required for all spaces).
556
- * Call from your backend with sk_live_... only.
557
- */
558
- declare function enableSpaceAuth(endpointUrl: string, secretKey: string, namespaceId: string): Promise<EnableSpaceAuthResponse>;
559
- declare function mintSpaceToken(endpointUrl: string, secretKey: string, request: MintSpaceTokenRequest): Promise<MintSpaceTokenResponse>;
560
- /**
561
- * Browser-safe space auth for static sites. Calls the rate-limited
562
- * `v1SpacePublicTokens` endpoint (pk_live_ + spaceKey only).
563
- */
564
- declare function createPublicSpaceTokenProvider(options: {
565
- apiKey: string;
566
- space?: string;
567
- spaceKey?: string;
568
- endpointUrl?: string;
569
- memberIdStorageKey?: string;
570
- sandboxAppId?: string;
571
- }): SpaceTokenProvider;
572
- declare function sandboxSpaceKey(spaceKey: string, sandboxAppId?: string): string;
573
- declare const spaceToken: typeof createPublicSpaceTokenProvider;
574
- declare const createSpaceTokenProvider: typeof createPublicSpaceTokenProvider;
575
-
576
- export { Connection, type CorrelationFields, type EnableSpaceAuthResponse, type MintSpaceTokenRequest, type MintSpaceTokenResponse, type OpenRTCCapabilityRuntime, RuntimeCapabilities, RuntimeConnectionController, RuntimeConnectionTarget, type RuntimeJsonFrameDecoderOptions, type RuntimeJsonFrameHandler, RuntimeRawConnection, type RuntimeU32BEFrameHandler, clog, concatRuntimeBytes, correlationForDriveGrantScope, createPublicSpaceTokenProvider, createRuntimeJsonFrameDecoder, createRuntimeU32BEFrameDecoder, createSpaceTokenProvider, 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{b as TauriRuntimeAdapter,a as createTauriIpcBridge}from'../chunk-O3D7S5MD.js';export{b as runtimeFromCapability}from'../chunk-IAEGDK4P.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-NCL672QJ.js';export{f as IpcRuntimeAdapter}from'../chunk-A7AMB23L.js';import'../chunk-C6PAXO3N.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-JIVVHBCB.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-BswnbjpG.js';
2
1
  import { P as PlutoIpcBridge } from './ipc-CflAVodw.js';
3
- import { a as RuntimeClientOptions } from './types-D0pqNSOf.js';
4
- import { O as OpenRTCOptions, a as OpenRTCClient$1 } from './types-ZdRrnIRw.js';
5
- import './types-BHePJWbM.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-BY3EPIAB.js';import {c}from'./chunk-IAEGDK4P.js';import {a}from'./chunk-DZCZLRM5.js';import'./chunk-2QHDEGVX.js';import'./chunk-D45U2NXV.js';import'./chunk-EUNCYGJD.js';import'./chunk-IAIGT5G3.js';import'./chunk-N4SX7C3W.js';import'./chunk-NCL672QJ.js';import'./chunk-A7AMB23L.js';import'./chunk-C6PAXO3N.js';import'./chunk-7Z6N46RB.js';import'./chunk-JIVVHBCB.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-TLUZAXUG.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-QOAZVE56.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 { r as ProtocolName, H as RouteDescriptor, K as ProtocolCapability, O as ProtocolCapabilityMap, o as ApplicationPayloadCrypto, Q as ApplicationCryptoStreamTools } from '../types-BHePJWbM.js';
2
- export { U as ApplicationCryptoBiStream, V as RouteFamily, W as RouteImplementationKind } from '../types-BHePJWbM.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 { n as ConnectionOptions, o as ApplicationPayloadCrypto, p as ApplicationPayloadReadinessOptions, q as ApplicationPayloadRouteOptions, r as ProtocolName, s as ApplicationPayloadSendOptions, T as TransportLatencySnapshot, t as PeerState, u as PeerScope, v as PeerHealth, w as ChannelDescriptor$1, x as IncomingStreamChannelMetadata, b as Device, m as BackendConnectionState, L as LocalDeviceInfo, c as DeviceStatusSnapshot, y as ManagedDeviceConnectOptions, C as ClientOptions, h as SignalingSession, R as RuntimeIdentity, J as JoinRoomOptions, a as RoomMember, z as DevicePresenceStatus, F as PeerLifecycleStatus, P as PeerSessionSnapshot } from './types-BHePJWbM.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,5 +1,6 @@
1
- import { O as OpenRTCPeerNamespace, a as OpenRTCChannelNamespace, b as OpenRTCDiagnosticsNamespace, c as OpenRTCDeviceNamespace } from './OpenRTCShared-BswnbjpG.js';
2
- import { R as RuntimeChannelDescriptor } from './types-D0pqNSOf.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. */
@@ -18,6 +19,20 @@ interface OpenRTCAuthProvider {
18
19
  getAssertion(input: {
19
20
  audience: 'https://api.openrtc.app/v2/assertions/exchange';
20
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';
21
36
  }): Promise<string | null>;
22
37
  /**
23
38
  * Optional identity-epoch observer. Notify only when the signed-in
@@ -38,6 +53,19 @@ interface OpenRTCEnrolledDevice {
38
53
  lastGrantAtMs: number | null;
39
54
  current: boolean;
40
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;
68
+ }
41
69
  interface OpenRTCAttestationProvider {
42
70
  readonly kind: 'firebase-app-check' | 'apple-app-attest' | 'play-integrity' | `custom:${string}`;
43
71
  /**
@@ -76,10 +104,10 @@ interface OpenRTCUsageWarning extends OpenRTCUsageUpdate {
76
104
  kind: 'warning' | 'session-limit';
77
105
  }
78
106
  interface OpenRTCTransportPreferences {
79
- iroh?: boolean;
80
- webrtc?: boolean;
107
+ iroh?: boolean | PlutoIrohConfiguration;
108
+ webrtc?: boolean | PlutoRTCConfiguration;
81
109
  relay?: boolean;
82
- moq?: boolean;
110
+ moq?: boolean | PlutoMoQConfiguration;
83
111
  ble?: boolean;
84
112
  /**
85
113
  * Advanced privacy mode. `relay-only` suppresses direct Iroh addresses,
@@ -87,13 +115,16 @@ interface OpenRTCTransportPreferences {
87
115
  * developer manifest's relay opt-in.
88
116
  */
89
117
  privacy?: 'direct' | 'relay-only';
118
+ /** Optimize eligible routes for stability/cost or measured latency. */
119
+ optimizeFor?: TransportOptimization;
90
120
  /**
91
121
  * Advanced native integration for hosts whose Rust process owns the
92
122
  * application protocol registry (for example, a Tauri file-transfer host).
93
123
  * Normal SDK consumers should leave this disabled.
94
124
  */
95
125
  nativeHostProtocols?: boolean;
96
- priority?: readonly ('iroh' | 'webrtc' | 'moq' | 'ble')[];
126
+ /** Exact route order. Unsupported routes are skipped, never treated as failures. */
127
+ priority?: readonly ProtocolName[];
97
128
  }
98
129
  interface OpenRTCOptions {
99
130
  apiKey: string;
@@ -112,6 +143,30 @@ interface OpenRTCOptions {
112
143
  }
113
144
  type OpenRTCAccessMode = 'capability' | 'authenticated';
114
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
+ }
115
170
  interface OpenRTCCapabilityHandle {
116
171
  readonly kind: 'devices' | 'space' | 'room' | 'ticket';
117
172
  readonly id: string;
@@ -119,6 +174,10 @@ interface OpenRTCCapabilityHandle {
119
174
  readonly channels: OpenRTCChannelNamespace;
120
175
  readonly diagnostics: OpenRTCDiagnosticsNamespace;
121
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;
122
181
  close(): Promise<void>;
123
182
  }
124
183
  interface OpenRTCDevicesHandle extends OpenRTCCapabilityHandle {
@@ -143,20 +202,20 @@ interface OpenRTCRoomHandle extends OpenRTCCapabilityHandle {
143
202
  }
144
203
  interface OpenRTCTicketHandle extends OpenRTCCapabilityHandle {
145
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
+ */
146
212
  readonly token: string;
147
213
  }
148
214
  interface OpenRTCDevicesStartOptions {
149
215
  auth?: OpenRTCAuthProvider;
150
216
  autoConnect?: 'none' | 'online';
151
217
  /** Optional local profile; it does not alter the durable device identity. */
152
- profile?: {
153
- name?: string;
154
- /**
155
- * Optional application-owned public presence metadata. It is bounded
156
- * to 4 KiB and folded into the initial connection/presence operation.
157
- */
158
- metadata?: string;
159
- };
218
+ profile?: OpenRTCDeviceProfile;
160
219
  maxPeers?: number;
161
220
  /** Requires the app manifest's advanced-fanout opt-in. */
162
221
  advancedFanout?: boolean;
@@ -198,6 +257,11 @@ interface OpenRTCUsageNamespace {
198
257
  }
199
258
  interface OpenRTCClient {
200
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>;
201
265
  start(options?: OpenRTCDevicesStartOptions): Promise<OpenRTCDevicesHandle>;
202
266
  listEnrolled(options?: {
203
267
  auth?: OpenRTCAuthProvider;
@@ -224,4 +288,4 @@ interface OpenRTCClient {
224
288
  close(): Promise<void>;
225
289
  }
226
290
 
227
- 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, OpenRTCEnrolledDevice as j, OpenRTCLatestStateMode as k, OpenRTCRoomHandle as l, OpenRTCRoomJoinOptions as m, OpenRTCSpaceHandle as n, OpenRTCSpaceJoinOptions as o, OpenRTCTicketHandle as p, OpenRTCTicketIssueOptions as q, OpenRTCTransportPreferences as r, OpenRTCUsageNamespace as s, OpenRTCUsageUpdate as t, OpenRTCUsageWarning as u };
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.8",
3
+ "version": "2.0.0",
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",