openrtc 2.0.0-rc.9 → 2.0.1

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 (91) hide show
  1. package/README.md +12 -8
  2. package/dist/DelegatingRuntimeAdapter-fgz5OPQx.d.ts +397 -0
  3. package/dist/{types-BHePJWbM.d.ts → ITransport-UNOXiRJD.d.ts} +44 -5
  4. package/dist/IpcRuntimeAdapter-CI3vCzk0.d.ts +19 -0
  5. package/dist/OpenRTCShared.d.ts +250 -0
  6. package/dist/OpenRTCShared.js +1 -0
  7. package/dist/WasmBridge-P5646IVR.js +1 -0
  8. package/dist/{OpenRTCShared-BswnbjpG.d.ts → assembly-CLdwe5T-.d.ts} +51 -250
  9. package/dist/{capabilities-YSskrE8H.d.ts → capabilities-BUe5YldR.d.ts} +4 -0
  10. package/dist/chunk-45WBH7E3.js +1 -0
  11. package/dist/chunk-5OTF7W2N.js +3 -0
  12. package/dist/chunk-7FPG3MFF.js +2 -0
  13. package/dist/chunk-AG2F6MOB.js +1 -0
  14. package/dist/chunk-CWGKLGJZ.js +1 -0
  15. package/dist/chunk-DUY34MGT.js +1 -0
  16. package/dist/chunk-HIXXBEWX.js +1 -0
  17. package/dist/chunk-IKZ33R7R.js +2 -0
  18. package/dist/chunk-KJTJLLJE.js +2 -0
  19. package/dist/{chunk-7Z6N46RB.js → chunk-LRT5GEGH.js} +2 -2
  20. package/dist/chunk-NRXEG5GQ.js +1 -0
  21. package/dist/chunk-QCPSLUKO.js +1 -0
  22. package/dist/chunk-VBUDERMM.js +2 -0
  23. package/dist/chunk-XPL7PUBW.js +2 -0
  24. package/dist/{chunk-C6PAXO3N.js → chunk-Y35AKFCM.js} +1 -1
  25. package/dist/chunk-Z2WVSXPW.js +1 -0
  26. package/dist/chunk-ZQF5KSOK.js +2 -0
  27. package/dist/controlPlane-YAMXWHAF.js +1 -0
  28. package/dist/deviceEnrollment-33NZEARB.js +2 -0
  29. package/dist/deviceKey-SBNKLVYF.js +1 -0
  30. package/dist/deviceManagement-PHY5TIOS.js +1 -0
  31. package/dist/deviceProfile-3BEQZLJF.js +2 -0
  32. package/dist/deviceRoster-VZA3TQOR.js +1 -0
  33. package/dist/dist-FIVA6EPA.js +277 -0
  34. package/dist/index.d.ts +10 -8
  35. package/dist/index.js +1 -1
  36. package/dist/ipcFactory-JTMNUTZI.js +1 -0
  37. package/dist/native.d.ts +7 -8
  38. package/dist/native.js +1 -1
  39. package/dist/openrtc-JUV7TOTL.js +2 -0
  40. package/dist/openrtc_bg.wasm +0 -0
  41. package/dist/runtime/WasmRuntimeAdapter.d.ts +4 -4
  42. package/dist/runtime/WasmRuntimeAdapter.js +1 -1
  43. package/dist/runtime/device-status.d.ts +2 -4
  44. package/dist/runtime/factories.d.ts +21 -0
  45. package/dist/runtime/factories.js +1 -0
  46. package/dist/runtime/index.d.ts +29 -62
  47. package/dist/runtime/index.js +1 -2
  48. package/dist/testing.d.ts +121 -18
  49. package/dist/testing.js +1 -1
  50. package/dist/transport/index.d.ts +2 -3
  51. package/dist/transport/index.js +1 -1
  52. package/dist/{types-byWIP-WI.d.ts → types-DhmY9hBy.d.ts} +74 -18
  53. package/dist/{types-D0pqNSOf.d.ts → types-l3m3GrOe.d.ts} +71 -4
  54. package/package.json +4 -34
  55. package/dist/DelegatingRuntimeAdapter-BLNigcS4.d.ts +0 -134
  56. package/dist/IEngineBridge-BbsT8hof.d.ts +0 -17
  57. package/dist/ITransport-BsPcaov7.d.ts +0 -16
  58. package/dist/OpenRTCShared-TKAQLONA.js +0 -1
  59. package/dist/WasmBridge-B7NTRYN5.js +0 -1
  60. package/dist/auth/index.d.ts +0 -78
  61. package/dist/auth/index.js +0 -1
  62. package/dist/auth/internal.d.ts +0 -4
  63. package/dist/auth/internal.js +0 -1
  64. package/dist/chunk-23XC6TGK.js +0 -2
  65. package/dist/chunk-2QHDEGVX.js +0 -1
  66. package/dist/chunk-A7AMB23L.js +0 -2
  67. package/dist/chunk-BXFXPIXO.js +0 -1
  68. package/dist/chunk-C7YN5MSV.js +0 -1
  69. package/dist/chunk-D45U2NXV.js +0 -1
  70. package/dist/chunk-DZCZLRM5.js +0 -1
  71. package/dist/chunk-EUNCYGJD.js +0 -1
  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-KWXAZUAZ.js +0 -2
  76. package/dist/chunk-N26S7V4N.js +0 -1
  77. package/dist/chunk-N4SX7C3W.js +0 -2
  78. package/dist/chunk-NB4H5TP3.js +0 -1
  79. package/dist/chunk-NCL672QJ.js +0 -3
  80. package/dist/chunk-NT5YHZQH.js +0 -1
  81. package/dist/chunk-O3D7S5MD.js +0 -1
  82. package/dist/chunk-RD3JEGGF.js +0 -2
  83. package/dist/chunk-VK6KX433.js +0 -1
  84. package/dist/factories-TLUZAXUG.js +0 -1
  85. package/dist/ipcFactory-QOAZVE56.js +0 -1
  86. package/dist/openrtc-C53CKZUM.js +0 -2
  87. package/dist/runtime/legacy.d.ts +0 -18
  88. package/dist/runtime/legacy.js +0 -1
  89. package/dist/runtime/tauri.d.ts +0 -6
  90. package/dist/runtime/tauri.js +0 -1
  91. 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-byWIP-WI.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-CLdwe5T-.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-CLdwe5T-.js';
3
+ import { OpenRTCClient } from '../OpenRTCShared.js';
4
+ import { f as OpenRTCCapabilityHandle } from '../types-DhmY9hBy.js';
5
+ import { C as Connection, D as RuntimeConnectionTarget, s as RuntimeRawConnection } from '../types-l3m3GrOe.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-l3m3GrOe.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 { a7 as SignalingOptions, I as ISignalingBackend, l as RuntimeIdentity, k as RoomMember, m as SignalingEnvelope, t as SignalingSession, D as Device, q as DesiredPeerProjection, v as BackendConnectionState, a6 as AppLimits, G as GrantScope, Y as JoinRoomOptions, W as IncomingStreamChannelMetadata, a2 as ApplicationCryptoStreamTools, a8 as RoomCreationMode, g as ClientOptions, y as ApplicationPayloadCrypto, j as DiscoveryMode, a1 as ProtocolCapabilityMap, a9 as ScanningLoopOptions, aa as ScanningLoopHandle, ab as RuntimeBootstrapOptions, ac as RuntimeBootstrapResult, z as ApplicationPayloadReadinessOptions, ad as ManagedApplicationRouteOptions, O as PeerState, Q as PeerScope, U as PeerHealth, V as ChannelDescriptor, ae as JoinRequest, N as NativeConnectParams, s as NativeConnectResult } from '../ITransport-UNOXiRJD.js';
9
+ import { R as RuntimeCapabilities } from '../capabilities-BUe5YldR.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-BUe5YldR.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-CI3vCzk0.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-fgz5OPQx.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-23XC6TGK.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-QCPSLUKO.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-5OTF7W2N.js';import'../chunk-LRT5GEGH.js';export{a as classifyNativeIpcFailure,b as isNativeIpcCommandUnavailable}from'../chunk-Z2WVSXPW.js';import'../chunk-DUY34MGT.js';import'../chunk-Y35AKFCM.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-ZQF5KSOK.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,30 +1,133 @@
1
- import { d as OpenRTCClient } from './OpenRTCShared-BswnbjpG.js';
1
+ import { h as CoordinationGatewayGrantRequest, i as CoordinationGatewayGrant } from './ITransport-UNOXiRJD.js';
2
+ import { c as OpenRTCAttestationProvider, d as OpenRTCAuthProvider, e as OpenRTCBotVerificationProvider, j as OpenRTCDeviceProfile, O as OpenRTCOptions, a as OpenRTCClient } from './types-DhmY9hBy.js';
2
3
  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-byWIP-WI.js';
5
- import './types-BHePJWbM.js';
6
- import './IEngineBridge-BbsT8hof.js';
7
- import './capabilities-YSskrE8H.js';
8
- import './ITransport-BsPcaov7.js';
4
+ import './OpenRTCShared.js';
5
+ import './assembly-CLdwe5T-.js';
6
+ import './types-l3m3GrOe.js';
7
+ import './capabilities-BUe5YldR.js';
8
+
9
+ interface OpenRTCDeviceProof {
10
+ publicKeyJwk: JsonWebKey;
11
+ signature: string;
12
+ nonce: string;
13
+ issuedAt: number;
14
+ }
15
+ interface OpenRTCDeviceKey {
16
+ readonly publicKeyJwk: JsonWebKey;
17
+ readonly thumbprint: string;
18
+ proof(challenge: (nonce: string, issuedAt: number) => string): Promise<OpenRTCDeviceProof>;
19
+ }
20
+ interface OpenRTCDeviceKeyProvider {
21
+ getOrCreate(appTag: string): Promise<OpenRTCDeviceKey>;
22
+ delete?(appTag: string): Promise<void>;
23
+ /**
24
+ * Optional platform-secure record storage. Native hosts use this for the
25
+ * device certificate that is bound to the private key; browsers retain
26
+ * their same-origin localStorage implementation.
27
+ */
28
+ readSecureRecord?(appTag: string, key: string): Promise<string | null>;
29
+ writeSecureRecord?(appTag: string, key: string, value: string): Promise<void>;
30
+ deleteSecureRecord?(appTag: string, key: string): Promise<void>;
31
+ }
9
32
 
10
33
  interface OpenRTCV2Endpoints {
11
34
  controlPlane: string;
12
35
  gateway: string;
13
36
  }
14
37
 
38
+ interface CredentialSource {
39
+ type: 'capability' | 'device-certificate';
40
+ token: string;
41
+ avenue: CoordinationGatewayGrantRequest['avenue'];
42
+ expiresAtMs: number;
43
+ renew?: () => Promise<CredentialSource>;
44
+ /**
45
+ * Re-establishes an authenticated device certificate only after the
46
+ * control plane explicitly reports a stale generation. This is separate
47
+ * from time-based renewal so revocation cannot create a refresh loop.
48
+ */
49
+ recoverRejectedCertificate?: () => Promise<CredentialSource>;
50
+ }
51
+ interface CachedDeviceCertificate {
52
+ token: string;
53
+ expiresAtMs: number;
54
+ principalId?: string;
55
+ signingPublicJwk: JsonWebKey & {
56
+ kid?: string;
57
+ };
58
+ }
59
+ interface AuthenticatedDeviceCertificate extends CachedDeviceCertificate {
60
+ principalId: string;
61
+ enrolled: boolean;
62
+ }
63
+ interface OpenRTCV2ControlPlaneEvents {
64
+ beforeLogicalOperation?: (operation: string) => void;
65
+ onLogicalOperation?: (operation: string) => void;
66
+ onAuthEpochChanged?: (auth: OpenRTCAuthProvider) => void;
67
+ }
68
+ declare class OpenRTCV2ControlPlane {
69
+ readonly apiKey: string;
70
+ private readonly endpoints;
71
+ private readonly keyProvider;
72
+ private readonly attestation?;
73
+ private readonly events;
74
+ private readonly botVerification?;
75
+ readonly appTag: string;
76
+ private keyPromise;
77
+ private readonly authEpochs;
78
+ constructor(apiKey: string, endpoints: OpenRTCV2Endpoints, keyProvider: OpenRTCDeviceKeyProvider, attestation?: OpenRTCAttestationProvider | undefined, events?: OpenRTCV2ControlPlaneEvents, botVerification?: OpenRTCBotVerificationProvider | undefined);
79
+ private record;
80
+ private before;
81
+ private authEpoch;
82
+ dispose(): void;
83
+ private key;
84
+ private post;
85
+ capability(kind: 'space' | 'room' | 'ticket', id: string, maxPeers?: number, advancedFanout?: boolean): Promise<CredentialSource>;
86
+ deviceCertificate(auth: OpenRTCAuthProvider, deviceId: string, avenue?: CoordinationGatewayGrantRequest['avenue'], profile?: OpenRTCDeviceProfile, rejected?: AuthenticatedDeviceCertificate): Promise<{
87
+ source: CredentialSource;
88
+ principalId: string;
89
+ enrolled: boolean;
90
+ }>;
91
+ private resolveAuthenticatedDevice;
92
+ private deviceCertificateResult;
93
+ private enrollAuthenticatedDevice;
94
+ listEnrolledDevices(auth: OpenRTCAuthProvider, deviceId: string): Promise<Array<{
95
+ deviceId: string;
96
+ name?: string;
97
+ platform?: string;
98
+ enrolledAtMs: number | null;
99
+ lastGrantAtMs: number | null;
100
+ current: boolean;
101
+ }>>;
102
+ revokeDevice(auth: OpenRTCAuthProvider, currentDeviceId: string, targetDeviceId: string): Promise<void>;
103
+ revokeAllDevices(auth: OpenRTCAuthProvider, currentDeviceId: string, exceptCurrent: boolean): Promise<void>;
104
+ private deleteDeviceKey;
105
+ private deviceManagement;
106
+ durableRoomMembership(source: CredentialSource, roomId: string, action: 'join' | 'leave'): Promise<void>;
107
+ grantProvider(source: CredentialSource, input?: {
108
+ maxPeers?: number;
109
+ features?: Record<string, boolean>;
110
+ deviceProfile?: Pick<OpenRTCDeviceProfile, 'name' | 'platform'>;
111
+ /**
112
+ * Keeps the transport/admission credential relay synchronized
113
+ * when a capability or device certificate is renewed in place.
114
+ * The callback runs only after the replacement source has
115
+ * successfully produced a gateway grant.
116
+ */
117
+ onSourceRenewed?: (source: {
118
+ token: string;
119
+ expiresAtMs: number;
120
+ }) => Promise<void> | void;
121
+ }): (request: CoordinationGatewayGrantRequest) => Promise<CoordinationGatewayGrant>;
122
+ }
123
+
124
+ /** Focused control-plane factory for live harnesses that do not need a transport runtime. */
125
+ declare function createTestingOpenRTCControlPlane(apiKey: string, endpoints: OpenRTCV2Endpoints, keyNamespace: string): OpenRTCV2ControlPlane;
15
126
  declare function createTestingOpenRTC(options: OpenRTCOptions, endpoints: OpenRTCV2Endpoints, testing?: {
16
127
  deviceId?: string;
17
128
  irohTestRelayUrl?: string;
18
- }): OpenRTCClient$1;
129
+ }): OpenRTCClient;
19
130
  /** 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
- };
131
+ declare function createTestingNativeOpenRTC(options: OpenRTCOptions, endpoints: OpenRTCV2Endpoints, bridge: PlutoIpcBridge): OpenRTCClient;
29
132
 
30
- export { createTestingLegacyOpenRTC, createTestingNativeOpenRTC, createTestingOpenRTC };
133
+ export { createTestingNativeOpenRTC, createTestingOpenRTC, createTestingOpenRTCControlPlane };
package/dist/testing.js CHANGED
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-KWXAZUAZ.js';import {c}from'./chunk-23XC6TGK.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-IKZ33R7R.js';import {a as a$1}from'./chunk-7FPG3MFF.js';import {b as b$1}from'./chunk-VBUDERMM.js';import {b}from'./chunk-QCPSLUKO.js';import'./chunk-XPL7PUBW.js';import'./chunk-DUY34MGT.js';import'./chunk-NRXEG5GQ.js';function l(n){let r=e=>`${e}:${n}`;return {getOrCreate:e=>b$1.getOrCreate(r(e)),delete:async e=>{await b$1.delete?.(r(e));},readSecureRecord:(e,t)=>b$1.readSecureRecord?.(r(e),t)??Promise.resolve(null),writeSecureRecord:(e,t,i)=>b$1.writeSecureRecord?.(r(e),t,i)??Promise.resolve(),deleteSecureRecord:(e,t)=>b$1.deleteSecureRecord?.(r(e),t)??Promise.resolve()}}function C(n,r,e){return new a(n,r,l(e))}function R(n,r,e={}){return b(n,{endpoints:r,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 m(n,r,e){return b(n,{endpoints:r,testingAllowInsecureLoopback:true,platform:"native",deviceKeyProvider:a$1(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-JTMNUTZI.js');return i(t,e)}})}export{m as createTestingNativeOpenRTC,R as createTestingOpenRTC,C as createTestingOpenRTCControlPlane};
@@ -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, $ as RouteDescriptor, J as ITransport, a0 as ProtocolCapability, a1 as ProtocolCapabilityMap, y as ApplicationPayloadCrypto, a2 as ApplicationCryptoStreamTools } from '../ITransport-UNOXiRJD.js';
2
+ export { a3 as ApplicationCryptoBiStream, a4 as RouteFamily, a5 as RouteImplementationKind } from '../ITransport-UNOXiRJD.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,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-l3m3GrOe.js';
3
+ import { P as PlutoIrohConfiguration, a as PlutoRTCConfiguration, b as PlutoMoQConfiguration, T as TransportOptimization, c as ProtocolName } from './ITransport-UNOXiRJD.js';
3
4
 
4
5
  interface OpenRTCAuthProvider {
5
6
  /** Registered provider ID from the developer app capability manifest. */
@@ -10,9 +11,8 @@ interface OpenRTCAuthProvider {
10
11
  * an ordinary access-token refresh. OpenRTC hashes this value together
11
12
  * with the app and installation-key thumbprint before persisting a lookup.
12
13
  *
13
- * Optional during the 2.0 RC compatibility window. Providers that omit it
14
- * use the assertion-first flow and remain correct, but cannot skip the
15
- * assertion exchange on a cold process start.
14
+ * Optional because assertion-only providers remain valid, though they
15
+ * cannot skip the assertion exchange on a cold process start.
16
16
  */
17
17
  getSessionKey?(): Promise<string | null>;
18
18
  getAssertion(input: {
@@ -25,6 +25,13 @@ interface OpenRTCAuthProvider {
25
25
  * enrollment/renewal assertion, never for hourly gateway refreshes.
26
26
  */
27
27
  deviceId: string;
28
+ /**
29
+ * Present only after OpenRTC receives the exact structured response
30
+ * indicating that this installation ID is enrolled with another
31
+ * public key. Consumer backends should require recent interactive
32
+ * authentication before authorizing the replacement.
33
+ */
34
+ recoveryReason?: 'device-key-rotation';
28
35
  }): Promise<string | null>;
29
36
  /**
30
37
  * Optional identity-epoch observer. Notify only when the signed-in
@@ -45,6 +52,19 @@ interface OpenRTCEnrolledDevice {
45
52
  lastGrantAtMs: number | null;
46
53
  current: boolean;
47
54
  }
55
+ /**
56
+ * Public, non-secret presentation metadata for one enrolled installation.
57
+ * OpenRTC derives a useful browser default when these fields are omitted;
58
+ * native hosts should pass the OS/device information reported by their host.
59
+ */
60
+ interface OpenRTCDeviceProfile {
61
+ /** Human-readable label such as `Bryant's iPhone` or `Chrome on Android`. */
62
+ name?: string;
63
+ /** Raw OS/runtime label such as `ios`, `android`, `macos`, or `web`. */
64
+ platform?: string;
65
+ /** Optional application-owned public presence metadata, bounded to 4 KiB. */
66
+ metadata?: string;
67
+ }
48
68
  interface OpenRTCAttestationProvider {
49
69
  readonly kind: 'firebase-app-check' | 'apple-app-attest' | 'play-integrity' | `custom:${string}`;
50
70
  /**
@@ -83,10 +103,10 @@ interface OpenRTCUsageWarning extends OpenRTCUsageUpdate {
83
103
  kind: 'warning' | 'session-limit';
84
104
  }
85
105
  interface OpenRTCTransportPreferences {
86
- iroh?: boolean;
87
- webrtc?: boolean;
106
+ iroh?: boolean | PlutoIrohConfiguration;
107
+ webrtc?: boolean | PlutoRTCConfiguration;
88
108
  relay?: boolean;
89
- moq?: boolean;
109
+ moq?: boolean | PlutoMoQConfiguration;
90
110
  ble?: boolean;
91
111
  /**
92
112
  * Advanced privacy mode. `relay-only` suppresses direct Iroh addresses,
@@ -94,13 +114,16 @@ interface OpenRTCTransportPreferences {
94
114
  * developer manifest's relay opt-in.
95
115
  */
96
116
  privacy?: 'direct' | 'relay-only';
117
+ /** Optimize eligible routes for stability/cost or measured latency. */
118
+ optimizeFor?: TransportOptimization;
97
119
  /**
98
120
  * Advanced native integration for hosts whose Rust process owns the
99
121
  * application protocol registry (for example, a Tauri file-transfer host).
100
122
  * Normal SDK consumers should leave this disabled.
101
123
  */
102
124
  nativeHostProtocols?: boolean;
103
- priority?: readonly ('iroh' | 'webrtc' | 'moq' | 'ble')[];
125
+ /** Exact route order. Unsupported routes are skipped, never treated as failures. */
126
+ priority?: readonly ProtocolName[];
104
127
  }
105
128
  interface OpenRTCOptions {
106
129
  apiKey: string;
@@ -119,6 +142,30 @@ interface OpenRTCOptions {
119
142
  }
120
143
  type OpenRTCAccessMode = 'capability' | 'authenticated';
121
144
  type OpenRTCLatestStateMode = 'reliable' | 'latest-state';
145
+ interface OpenRTCConnection {
146
+ readonly id: string;
147
+ readonly peerId: string;
148
+ send(message: unknown): Promise<void>;
149
+ onMessage<T = unknown>(callback: (message: T) => void): () => void;
150
+ onClose(callback: () => void): () => void;
151
+ }
152
+ interface OpenRTCChannel<T> {
153
+ send(message: T): Promise<void>;
154
+ sendTo(peerId: string, message: T): Promise<void>;
155
+ onMessage(callback: (event: {
156
+ peerId: string;
157
+ message: T;
158
+ }) => void): () => void;
159
+ }
160
+ interface OpenRTCState<T> {
161
+ /** Replace the locally published value. Delivery is best-effort and coalesced. */
162
+ set(value: T): void;
163
+ /** A null value means the peer disconnected. */
164
+ watch(callback: (event: {
165
+ peerId: string;
166
+ value: T | null;
167
+ }) => void): () => void;
168
+ }
122
169
  interface OpenRTCCapabilityHandle {
123
170
  readonly kind: 'devices' | 'space' | 'room' | 'ticket';
124
171
  readonly id: string;
@@ -126,6 +173,10 @@ interface OpenRTCCapabilityHandle {
126
173
  readonly channels: OpenRTCChannelNamespace;
127
174
  readonly diagnostics: OpenRTCDiagnosticsNamespace;
128
175
  readonly closed: boolean;
176
+ state<T>(name: string): OpenRTCState<T>;
177
+ channel<T>(name: string): OpenRTCChannel<T>;
178
+ /** Observe current and future connections without taking lifecycle ownership. */
179
+ onConnection(callback: (connection: OpenRTCConnection) => void): () => void;
129
180
  close(): Promise<void>;
130
181
  }
131
182
  interface OpenRTCDevicesHandle extends OpenRTCCapabilityHandle {
@@ -150,20 +201,20 @@ interface OpenRTCRoomHandle extends OpenRTCCapabilityHandle {
150
201
  }
151
202
  interface OpenRTCTicketHandle extends OpenRTCCapabilityHandle {
152
203
  readonly kind: 'ticket';
204
+ /**
205
+ * Opaque, install-bound OpenRTC capability credential. This is not a
206
+ * transferable invitation or recipient redemption token. Do not display,
207
+ * log, persist, or send it to another installation.
208
+ * @deprecated This credential exposure is retained only for RC source
209
+ * compatibility and will not be part of the stable invitation workflow.
210
+ */
153
211
  readonly token: string;
154
212
  }
155
213
  interface OpenRTCDevicesStartOptions {
156
214
  auth?: OpenRTCAuthProvider;
157
215
  autoConnect?: 'none' | 'online';
158
216
  /** Optional local profile; it does not alter the durable device identity. */
159
- profile?: {
160
- name?: string;
161
- /**
162
- * Optional application-owned public presence metadata. It is bounded
163
- * to 4 KiB and folded into the initial connection/presence operation.
164
- */
165
- metadata?: string;
166
- };
217
+ profile?: OpenRTCDeviceProfile;
167
218
  maxPeers?: number;
168
219
  /** Requires the app manifest's advanced-fanout opt-in. */
169
220
  advancedFanout?: boolean;
@@ -205,6 +256,11 @@ interface OpenRTCUsageNamespace {
205
256
  }
206
257
  interface OpenRTCClient {
207
258
  readonly devices: {
259
+ /**
260
+ * Returns this installation's durable, app-scoped device ID without
261
+ * starting a capability or performing network work.
262
+ */
263
+ localId(): Promise<string>;
208
264
  start(options?: OpenRTCDevicesStartOptions): Promise<OpenRTCDevicesHandle>;
209
265
  listEnrolled(options?: {
210
266
  auth?: OpenRTCAuthProvider;
@@ -231,4 +287,4 @@ interface OpenRTCClient {
231
287
  close(): Promise<void>;
232
288
  }
233
289
 
234
- 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 };
290
+ 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 };
@@ -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 { x as ConnectionOptions, y as ApplicationPayloadCrypto, z as ApplicationPayloadReadinessOptions, F as ApplicationPayloadRouteOptions, c as ProtocolName, H as ApplicationPayloadSendOptions, J as ITransport, K as TransportLatencySnapshot, O as PeerState, Q as PeerScope, U as PeerHealth, V as ChannelDescriptor$1, W as IncomingStreamChannelMetadata, D as Device, v as BackendConnectionState, L as LocalDeviceInfo, n as DeviceStatusSnapshot, X as ManagedDeviceConnectOptions, g as ClientOptions, t as SignalingSession, l as RuntimeIdentity, Y as JoinRoomOptions, k as RoomMember, Z as DevicePresenceStatus, _ as PeerLifecycleStatus, d as PeerSessionSnapshot } from './ITransport-UNOXiRJD.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 };