openrtc 3.0.3 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/BrowserCoordinationGatewaySignaling-GOLSTJMA.js +1 -0
  2. package/dist/WasmBridge-CJNESUGJ.js +1 -0
  3. package/dist/{chunk-TYZS5LXQ.js → chunk-2AAZFBRZ.js} +1 -1
  4. package/dist/chunk-5LNRJE6L.js +1 -0
  5. package/dist/{chunk-HL3TV2QA.js → chunk-5LO6PLWZ.js} +1 -1
  6. package/dist/{chunk-TFOFTLTV.js → chunk-CQHLD52E.js} +1 -1
  7. package/dist/chunk-FNCEVW7G.js +1 -0
  8. package/dist/chunk-FPJAUAEU.js +2 -0
  9. package/dist/chunk-LB27VQRL.js +1 -0
  10. package/dist/chunk-LCJQ7RSR.js +1 -0
  11. package/dist/{chunk-AYQSDKSK.js → chunk-LVLU4YQY.js} +1 -1
  12. package/dist/{chunk-PW2WEI6L.js → chunk-RLPWFHOY.js} +1 -1
  13. package/dist/chunk-SADNIMUO.js +2 -0
  14. package/dist/{chunk-XTMFYAIJ.js → chunk-VARKDQGM.js} +1 -1
  15. package/dist/coreClient.js +1 -1
  16. package/dist/{deviceHandle-YV5LJ5A5.js → deviceHandle-Y2XA57WF.js} +1 -1
  17. package/dist/external-broadcast.d.ts +1 -1
  18. package/dist/external-broadcast.js +1 -1
  19. package/dist/index.d.ts +4 -4
  20. package/dist/index.js +1 -1
  21. package/dist/ipcFactory-F75IXEIE.js +1 -0
  22. package/dist/native.d.ts +2 -2
  23. package/dist/native.js +1 -1
  24. package/dist/node.d.ts +2 -2
  25. package/dist/node.js +2 -2
  26. package/dist/openrtc_bg.wasm +0 -0
  27. package/dist/{room-ELXNZIYX.js → room-E4NRHQFD.js} +1 -1
  28. package/dist/runtime/WasmRuntimeAdapter.js +1 -1
  29. package/dist/runtime/factories.js +1 -1
  30. package/dist/runtime/index.d.ts +1 -1
  31. package/dist/runtime/index.js +1 -1
  32. package/dist/server-browser.d.ts +1 -1
  33. package/dist/server.d.ts +1 -1
  34. package/dist/server.js +1 -1
  35. package/dist/service-node.d.ts +1 -1
  36. package/dist/service-node.js +1 -1
  37. package/dist/testing/native.d.ts +1 -1
  38. package/dist/testing/native.js +1 -1
  39. package/dist/testing.d.ts +1 -1
  40. package/dist/testing.js +1 -1
  41. package/dist/transport/index.js +1 -1
  42. package/dist/{types-YGlXXpQA.d.ts → types-Cruu-MsF.d.ts} +43 -1
  43. package/native/darwin-arm64/openrtc-node-host +0 -0
  44. package/native/darwin-arm64/openrtc-node-host.manifest.json +4 -4
  45. package/native/darwin-x64/openrtc-node-host +0 -0
  46. package/native/darwin-x64/openrtc-node-host.manifest.json +4 -4
  47. package/native/linux-x64/openrtc-node-host +0 -0
  48. package/native/linux-x64/openrtc-node-host.manifest.json +4 -4
  49. package/package.json +1 -1
  50. package/dist/WasmBridge-L76OAD5U.js +0 -1
  51. package/dist/chunk-K32BROMJ.js +0 -2
  52. package/dist/chunk-OT7IPLZE.js +0 -1
  53. package/dist/chunk-QL4CJCV4.js +0 -1
  54. package/dist/chunk-UCNK7KB6.js +0 -2
  55. package/dist/ipcFactory-4LCCR23Q.js +0 -1
@@ -1 +1 @@
1
- import {s}from'./chunk-K32BROMJ.js';import {e}from'./chunk-UCNK7KB6.js';function v(i,d){let t=new s(i,d),a=i.spaceKey??i.space,l=(i.discoveryMode===void 0||i.discoveryMode==="space")&&typeof i.apiKey=="string"&&i.apiKey.trim().length>0&&typeof a=="string"&&a.trim().length>0,o={runtime:t,async setAuthContext(e){await t.setAuthContext(e);},async syncPlutoAuth(e$1){if(l)return;let n=e(),c=n.getCurrentUser(),r=(typeof e$1?.userId=="string"?e$1.userId.trim():"")||c?.uid||null;if(!r){await o.setAuthContext(null);return}let m=await n.getIdToken({forceRefresh:e$1?.forceRefresh??false}).catch(()=>null),g=n.getCurrentUser()?.refreshToken??null,h=n.getCurrentUser()?.stsTokenManager?.expirationTime??null;await o.setAuthContext({userId:r,token:m,refreshToken:g,tokenProvider:async y=>n.getIdToken({forceRefresh:y??false}),expiresAtMs:h});},bindPlutoAuthHost(){let e$1=e();return o.syncPlutoAuth({userId:e$1.getCurrentUser()?.uid??null,forceRefresh:false}),e$1.onIdTokenChanged(n=>{o.syncPlutoAuth({userId:n?.uid??null,forceRefresh:false});})},signInWithPluto:()=>t.signInWithPluto(),signOut:()=>t.signOut(),stopManagedSession:()=>t.stopManagedSession(),startManagedSession:e=>t.startManagedSession(e),onAuthChange:e=>t.onIdentityChange(e),getManagedNodeId:e=>t.getManagedNodeId(e),getRuntimeStatus:()=>t.getRuntimeStatus(),listDeviceStatus:()=>t.listDeviceStatus(),watchDeviceStatus:e=>t.watchDeviceStatus(e),connectDevice:(e,n)=>t.connectDevice(e,n),excludeAutoConnect:(e,n)=>t.excludeAutoConnect(e,n)};return Object.defineProperty(o,"identity",{get:()=>t.identity,enumerable:true}),o}export{v as a};
1
+ import {s}from'./chunk-SADNIMUO.js';import {e}from'./chunk-LCJQ7RSR.js';function v(i,d){let t=new s(i,d),a=i.spaceKey??i.space,l=(i.discoveryMode===void 0||i.discoveryMode==="space")&&typeof i.apiKey=="string"&&i.apiKey.trim().length>0&&typeof a=="string"&&a.trim().length>0,o={runtime:t,async setAuthContext(e){await t.setAuthContext(e);},async syncPlutoAuth(e$1){if(l)return;let n=e(),c=n.getCurrentUser(),r=(typeof e$1?.userId=="string"?e$1.userId.trim():"")||c?.uid||null;if(!r){await o.setAuthContext(null);return}let m=await n.getIdToken({forceRefresh:e$1?.forceRefresh??false}).catch(()=>null),g=n.getCurrentUser()?.refreshToken??null,h=n.getCurrentUser()?.stsTokenManager?.expirationTime??null;await o.setAuthContext({userId:r,token:m,refreshToken:g,tokenProvider:async y=>n.getIdToken({forceRefresh:y??false}),expiresAtMs:h});},bindPlutoAuthHost(){let e$1=e();return o.syncPlutoAuth({userId:e$1.getCurrentUser()?.uid??null,forceRefresh:false}),e$1.onIdTokenChanged(n=>{o.syncPlutoAuth({userId:n?.uid??null,forceRefresh:false});})},signInWithPluto:()=>t.signInWithPluto(),signOut:()=>t.signOut(),stopManagedSession:()=>t.stopManagedSession(),startManagedSession:e=>t.startManagedSession(e),onAuthChange:e=>t.onIdentityChange(e),getManagedNodeId:e=>t.getManagedNodeId(e),getRuntimeStatus:()=>t.getRuntimeStatus(),listDeviceStatus:()=>t.listDeviceStatus(),watchDeviceStatus:e=>t.watchDeviceStatus(e),connectDevice:(e,n)=>t.connectDevice(e,n),excludeAutoConnect:(e,n)=>t.excludeAutoConnect(e,n)};return Object.defineProperty(o,"identity",{get:()=>t.identity,enumerable:true}),o}export{v as a};
@@ -1 +1 @@
1
- import {l}from'./chunk-L4HWDDXL.js';import'./chunk-OWKAJPOI.js';import {c}from'./chunk-PW2WEI6L.js';import'./chunk-2GX6GB6L.js';function w(o){let r=l({...o});if("auth"in o&&!o.authMode){let n=o.auth;r.authMode=n==="none"?"anonymous":n;}if("identity"in o){let n=o.identity,s=n==="temporary"?"ephemeral":n;!o.deviceIdPersistence&&!o.nodeIdPersistence&&(r.deviceIdPersistence=s),!o.endpointIdPersistence&&!o.nodeIdPersistence&&(r.endpointIdPersistence=s);}return "namespace"in o&&!o.storagePrefix&&(r.storagePrefix=o.namespace),"privacy"in o&&o.strictMode===void 0&&(r.strictMode=!!o.privacy),r}function O(o,r){let n=o.runtime,s=Object.create(n),d=async e=>{if(typeof e!="string")return e;let i=(await n.listDevices()).find(a=>a.deviceId===e);if(!i)throw new Error(`OpenRTC device '${e}' is not currently discoverable.`);return i},g=async e=>({...e,localDeviceId:e?.localDeviceId??await n.getLocalDeviceId()??""}),P=async e=>{let{device:t,scope:i,...a}=e,c=a.deviceId??(typeof t=="string"?t:t?.deviceId)??null,l=a.ticket??(typeof t=="string"?void 0:t?.ticket);c&&!l&&(l=(await d(c).catch(()=>null))?.ticket);let m={...a,scope:i??"session"};return c&&(m.deviceId=c),l&&(m.ticket=l),m},v={requestTransferPeer:e=>n.requestTransferPeer(e),transferPeerDemandStatus:(e,t)=>n.transferPeerDemandStatus(e,t),releaseTransferPeer:(e,t)=>n.releaseTransferPeer(e,t),setTransferPeerBudget:(e,t)=>n.setTransferPeerBudget(e,t),list:()=>n.listDevices(),startSession:(e={})=>n.startManagedSession({...e,platform:e.platform??r}),stopSession:e=>n.stopManagedSession(e),listWithStatus:()=>n.listDeviceStatus(),watch:e=>n.watchDevices(e),watchWithStatus:e=>n.watchDeviceStatus(e),connect:async(e,t)=>n.connectDevice(await d(e),await g(t)),connectWithRetry:async(e,t,i)=>n.connectWithRetry(await d(e),t,i),disconnect:e=>n.disconnectDevice(e),update:(e,t)=>n.updateDevice(e,t),delete:e=>n.deleteDevice(e),localId:()=>n.getLocalDeviceId(),localInfo:()=>n.getLocalDeviceInfo(),localProfile:e=>n.localDeviceProfile(e),updateLocalName:e=>n.updateDeviceName(e)},C={watch:e=>n.watchPeerStates(e),watchLifecycle:e=>typeof n.watchPeerLifecycle=="function"?n.watchPeerLifecycle(e):typeof n.watchPeerStates=="function"?n.watchPeerStates(e):()=>{},get:e=>n.getPeerState(e),listConnected:()=>n.listConnectedPeers(),connect:e=>n.connectPeer(e),disconnect:(e,t)=>n.disconnectPeer(e,t),forceDisconnect:e=>n.forceDisconnectPeer(e),session:e=>n.getPeerSession(e),sessions:()=>n.listPeerSessions(),waitConnected:(e,t)=>n.waitForConnectedPeer(e,t),readiness:(e,t)=>n.getPeerReadiness(e,t),health:e=>n.getPeerHealth(e),identity:e=>n.resolvePeerIdentity(e),addScope:(e,t)=>n.addPeerScope(e,t),releaseScope:(e,t)=>n.releasePeerScope(e,t),scopes:e=>n.getPeerScopes(e),refresh:()=>n.refreshPeerSnapshot()},h={register:e=>n.registerChannel(e),unregister:e=>n.unregisterChannel(e),list:()=>n.listChannels(),openBi:(e,t,i)=>n.openPeerBi(e,{...i,channelId:t}),openUni:(e,t,i)=>n.openPeerUni(e,{...i,channelId:t}),onIncoming:e=>n.onIncomingStream(e),onIncomingChannel:(e,t)=>n.onChannelStream(e,i=>{if(i.channel)return t(i)}),connect:async e=>n.connectScopedChannel(await P(e)),connectScoped:e=>n.connectScopedChannel(e)},S={create:e=>n.createRoom(e),join:(e,t)=>n.joinRoom(e,t),leave:e=>n.leaveRoom(e),watch:(e,t)=>n.watchRoom(e,t),members:e=>n.getRoomMembers(e)},f={raw:()=>n.getInvite(),share:e=>n.getTicketWithToken("share",e?.maxConnections??1),grant:(e,t)=>n.getTicketWithToken(e,t?.maxConnections??0),revoke:e=>n.revokeTokensByScope(e)},b={capture:e=>c(t=>n.watchPeerStates(t),e),status:()=>n.getRuntimeStatus(),policy:()=>n.getRuntimePolicy(),capabilities:()=>n.capabilities(),capabilityProfile:()=>n.getCapabilityProfile(),watchConnectionMetrics:e=>n.watchConnectionMetrics(e),connectionStates:()=>n.getConnectionStates(),onStateChange:e=>n.onStateChange(e),connections:()=>n.getConnections(),applicationReadyConnections:e=>n.readyConnections(e),onConnection:e=>n.onConnection(e),onDisconnection:e=>n.onDisconnection(e),onConnectionEvent:e=>n.onConnectionEvent(e),forceReconnect:()=>n.forceReconnect(),peerReconciliation:()=>n.reconciliationStats()},y={runtime:n,assembly:o,nodeId:()=>n.getNodeId(),nodeIdFromTicket:e=>n.getNodeIdFromTicket(e),endpointTicket:()=>n.getEndpointTicket(),connectRaw:e=>n.connectRaw(e),openBi:e=>n.openBi(e),openUni:e=>n.openUni(e),isConnected:e=>n.isConnected(e),disconnectNode:e=>n.disconnectNode(e),excludeAutoConnect:(e,t)=>n.excludeAutoConnect(e,t),notifyNetworkChange:e=>n.notifyNetworkChange(e)};return Object.defineProperties(s,{devices:{get:()=>v,enumerable:true},peers:{get:()=>C,enumerable:true},channels:{get:()=>h,enumerable:true},rooms:{get:()=>S,enumerable:true},tickets:{get:()=>f,enumerable:true},diagnostics:{get:()=>b,enumerable:true},advanced:{get:()=>y,enumerable:true},setAuth:{value:e=>o.setAuthContext(e),enumerable:true,writable:true,configurable:true},setAuthContext:{value:e=>o.setAuthContext(e),enumerable:true,writable:true,configurable:true},syncPlutoAuth:{value:e=>o.syncPlutoAuth(e),enumerable:true,writable:true,configurable:true},bindPlutoAuthHost:{value:()=>o.bindPlutoAuthHost(),enumerable:true,writable:true,configurable:true},signIn:{value:()=>o.signInWithPluto(),enumerable:true,writable:true,configurable:true},signOut:{value:()=>o.signOut(),enumerable:true,writable:true,configurable:true},runtime:{get:()=>n,enumerable:false},_assembly:{get:()=>o,enumerable:false}}),s}export{w as resolveOptions,O as wrapAssembly};
1
+ import {l}from'./chunk-L4HWDDXL.js';import'./chunk-OWKAJPOI.js';import {c}from'./chunk-RLPWFHOY.js';import'./chunk-2GX6GB6L.js';function w(o){let r=l({...o});if("auth"in o&&!o.authMode){let n=o.auth;r.authMode=n==="none"?"anonymous":n;}if("identity"in o){let n=o.identity,s=n==="temporary"?"ephemeral":n;!o.deviceIdPersistence&&!o.nodeIdPersistence&&(r.deviceIdPersistence=s),!o.endpointIdPersistence&&!o.nodeIdPersistence&&(r.endpointIdPersistence=s);}return "namespace"in o&&!o.storagePrefix&&(r.storagePrefix=o.namespace),"privacy"in o&&o.strictMode===void 0&&(r.strictMode=!!o.privacy),r}function O(o,r){let n=o.runtime,s=Object.create(n),d=async e=>{if(typeof e!="string")return e;let i=(await n.listDevices()).find(a=>a.deviceId===e);if(!i)throw new Error(`OpenRTC device '${e}' is not currently discoverable.`);return i},g=async e=>({...e,localDeviceId:e?.localDeviceId??await n.getLocalDeviceId()??""}),P=async e=>{let{device:t,scope:i,...a}=e,c=a.deviceId??(typeof t=="string"?t:t?.deviceId)??null,l=a.ticket??(typeof t=="string"?void 0:t?.ticket);c&&!l&&(l=(await d(c).catch(()=>null))?.ticket);let m={...a,scope:i??"session"};return c&&(m.deviceId=c),l&&(m.ticket=l),m},v={requestTransferPeer:e=>n.requestTransferPeer(e),transferPeerDemandStatus:(e,t)=>n.transferPeerDemandStatus(e,t),releaseTransferPeer:(e,t)=>n.releaseTransferPeer(e,t),setTransferPeerBudget:(e,t)=>n.setTransferPeerBudget(e,t),list:()=>n.listDevices(),startSession:(e={})=>n.startManagedSession({...e,platform:e.platform??r}),stopSession:e=>n.stopManagedSession(e),listWithStatus:()=>n.listDeviceStatus(),watch:e=>n.watchDevices(e),watchWithStatus:e=>n.watchDeviceStatus(e),connect:async(e,t)=>n.connectDevice(await d(e),await g(t)),connectWithRetry:async(e,t,i)=>n.connectWithRetry(await d(e),t,i),disconnect:e=>n.disconnectDevice(e),update:(e,t)=>n.updateDevice(e,t),delete:e=>n.deleteDevice(e),localId:()=>n.getLocalDeviceId(),localInfo:()=>n.getLocalDeviceInfo(),localProfile:e=>n.localDeviceProfile(e),updateLocalName:e=>n.updateDeviceName(e)},C={watch:e=>n.watchPeerStates(e),watchLifecycle:e=>typeof n.watchPeerLifecycle=="function"?n.watchPeerLifecycle(e):typeof n.watchPeerStates=="function"?n.watchPeerStates(e):()=>{},get:e=>n.getPeerState(e),listConnected:()=>n.listConnectedPeers(),connect:e=>n.connectPeer(e),disconnect:(e,t)=>n.disconnectPeer(e,t),forceDisconnect:e=>n.forceDisconnectPeer(e),session:e=>n.getPeerSession(e),sessions:()=>n.listPeerSessions(),waitConnected:(e,t)=>n.waitForConnectedPeer(e,t),readiness:(e,t)=>n.getPeerReadiness(e,t),health:e=>n.getPeerHealth(e),identity:e=>n.resolvePeerIdentity(e),addScope:(e,t)=>n.addPeerScope(e,t),releaseScope:(e,t)=>n.releasePeerScope(e,t),scopes:e=>n.getPeerScopes(e),refresh:()=>n.refreshPeerSnapshot()},h={register:e=>n.registerChannel(e),unregister:e=>n.unregisterChannel(e),list:()=>n.listChannels(),openBi:(e,t,i)=>n.openPeerBi(e,{...i,channelId:t}),openUni:(e,t,i)=>n.openPeerUni(e,{...i,channelId:t}),onIncoming:e=>n.onIncomingStream(e),onIncomingChannel:(e,t)=>n.onChannelStream(e,i=>{if(i.channel)return t(i)}),connect:async e=>n.connectScopedChannel(await P(e)),connectScoped:e=>n.connectScopedChannel(e)},S={create:e=>n.createRoom(e),join:(e,t)=>n.joinRoom(e,t),leave:e=>n.leaveRoom(e),watch:(e,t)=>n.watchRoom(e,t),members:e=>n.getRoomMembers(e)},f={raw:()=>n.getInvite(),share:e=>n.getTicketWithToken("share",e?.maxConnections??1),grant:(e,t)=>n.getTicketWithToken(e,t?.maxConnections??0),revoke:e=>n.revokeTokensByScope(e)},b={capture:e=>c(t=>n.watchPeerStates(t),e),status:()=>n.getRuntimeStatus(),policy:()=>n.getRuntimePolicy(),capabilities:()=>n.capabilities(),capabilityProfile:()=>n.getCapabilityProfile(),watchConnectionMetrics:e=>n.watchConnectionMetrics(e),connectionStates:()=>n.getConnectionStates(),onStateChange:e=>n.onStateChange(e),connections:()=>n.getConnections(),applicationReadyConnections:e=>n.readyConnections(e),onConnection:e=>n.onConnection(e),onDisconnection:e=>n.onDisconnection(e),onConnectionEvent:e=>n.onConnectionEvent(e),forceReconnect:()=>n.forceReconnect(),peerReconciliation:()=>n.reconciliationStats()},y={runtime:n,assembly:o,nodeId:()=>n.getNodeId(),nodeIdFromTicket:e=>n.getNodeIdFromTicket(e),endpointTicket:()=>n.getEndpointTicket(),connectRaw:e=>n.connectRaw(e),openBi:e=>n.openBi(e),openUni:e=>n.openUni(e),isConnected:e=>n.isConnected(e),disconnectNode:e=>n.disconnectNode(e),excludeAutoConnect:(e,t)=>n.excludeAutoConnect(e,t),notifyNetworkChange:e=>n.notifyNetworkChange(e)};return Object.defineProperties(s,{devices:{get:()=>v,enumerable:true},peers:{get:()=>C,enumerable:true},channels:{get:()=>h,enumerable:true},rooms:{get:()=>S,enumerable:true},tickets:{get:()=>f,enumerable:true},diagnostics:{get:()=>b,enumerable:true},advanced:{get:()=>y,enumerable:true},setAuth:{value:e=>o.setAuthContext(e),enumerable:true,writable:true,configurable:true},setAuthContext:{value:e=>o.setAuthContext(e),enumerable:true,writable:true,configurable:true},syncPlutoAuth:{value:e=>o.syncPlutoAuth(e),enumerable:true,writable:true,configurable:true},bindPlutoAuthHost:{value:()=>o.bindPlutoAuthHost(),enumerable:true,writable:true,configurable:true},signIn:{value:()=>o.signInWithPluto(),enumerable:true,writable:true,configurable:true},signOut:{value:()=>o.signOut(),enumerable:true,writable:true,configurable:true},runtime:{get:()=>n,enumerable:false},_assembly:{get:()=>o,enumerable:false}}),s}export{w as resolveOptions,O as wrapAssembly};
@@ -1 +1 @@
1
- import {h as h$1}from'./chunk-QL4CJCV4.js';import'./chunk-FKAQDDUM.js';import'./chunk-ZA44REGI.js';import'./chunk-PW2WEI6L.js';import'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';var h=class extends h$1{constructor(e,t,u,S){super("devices",e,t,u);this.roster=S;this.kind="devices";this.rosterStopped=false;this.localId=()=>this.client.devices.localId();this.localInfo=()=>this.client.devices.localInfo();this.list=async()=>this.roster.mergeDevices(await this.client.devices.list());this.listWithStatus=async()=>this.roster.mergeStatus(await this.client.devices.listWithStatus());this.watch=e=>this.client.devices.watch(t=>e(this.roster.mergeDevices(t)));this.requestTransferPeer=async e=>{if(this.closed)throw new Error("[OpenRTC] Capability is closed.");return this.client.devices.requestTransferPeer(e)};this.transferPeerDemandStatus=async(e,t)=>{if(this.closed)throw new Error("[OpenRTC] Capability is closed.");return this.client.devices.transferPeerDemandStatus(e,t)};this.releaseTransferPeer=async(e,t)=>{if(this.closed)throw new Error("[OpenRTC] Capability is closed.");return this.client.devices.releaseTransferPeer(e,t)};this.setTransferPeerBudget=async(e,t)=>{if(this.closed)throw new Error("[OpenRTC] Capability is closed.");return this.client.devices.setTransferPeerBudget(e,t)};this.connect=this.client.devices.connect;this.disconnect=this.client.devices.disconnect;let p=t.devices.list,m=t.devices.listWithStatus,c=t.devices.watch,f=t.devices.watchWithStatus,i=s=>(this.roster.reconcileLiveSnapshot(s),s),a=async()=>this.roster.mergeDevices(i(await p())),o=async()=>this.roster.mergeStatus(await m()),n=s=>c(r=>s(this.roster.mergeDevices(i(r)))),l=s=>f(r=>s(this.roster.mergeStatus(r))),d=Object.create(t);Object.defineProperties(d,{listDevices:{value:a,enumerable:false},listDeviceStatus:{value:o,enumerable:false},watchDevices:{value:n,enumerable:false},watchDeviceStatus:{value:l,enumerable:false},devices:{value:{...t.devices,list:a,listWithStatus:o,watch:n,watchWithStatus:l},enumerable:true}}),this.projectRuntime(d),this.stopRosterSync=c(i);}replaceEnrolledDevices(e){this.roster.replace(e);}removeEnrolledDevice(e){this.roster.remove(e);}retainCurrentEnrolledDevice(e){this.roster.retain(e);}beforeRuntimeShutdown(){this.rosterStopped||(this.stopRosterSync(),this.rosterStopped=true);}};export{h as DeviceHandle};
1
+ import {h as h$1}from'./chunk-5LNRJE6L.js';import'./chunk-FKAQDDUM.js';import'./chunk-RLPWFHOY.js';import'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import'./chunk-ZA44REGI.js';import'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';var h=class extends h$1{constructor(e,t,u,S){super("devices",e,t,u);this.roster=S;this.kind="devices";this.rosterStopped=false;this.localId=()=>this.client.devices.localId();this.localInfo=()=>this.client.devices.localInfo();this.list=async()=>this.roster.mergeDevices(await this.client.devices.list());this.listWithStatus=async()=>this.roster.mergeStatus(await this.client.devices.listWithStatus());this.watch=e=>this.client.devices.watch(t=>e(this.roster.mergeDevices(t)));this.requestTransferPeer=async e=>{if(this.closed)throw new Error("[OpenRTC] Capability is closed.");return this.client.devices.requestTransferPeer(e)};this.transferPeerDemandStatus=async(e,t)=>{if(this.closed)throw new Error("[OpenRTC] Capability is closed.");return this.client.devices.transferPeerDemandStatus(e,t)};this.releaseTransferPeer=async(e,t)=>{if(this.closed)throw new Error("[OpenRTC] Capability is closed.");return this.client.devices.releaseTransferPeer(e,t)};this.setTransferPeerBudget=async(e,t)=>{if(this.closed)throw new Error("[OpenRTC] Capability is closed.");return this.client.devices.setTransferPeerBudget(e,t)};this.connect=this.client.devices.connect;this.disconnect=this.client.devices.disconnect;let p=t.devices.list,m=t.devices.listWithStatus,c=t.devices.watch,f=t.devices.watchWithStatus,i=s=>(this.roster.reconcileLiveSnapshot(s),s),a=async()=>this.roster.mergeDevices(i(await p())),o=async()=>this.roster.mergeStatus(await m()),n=s=>c(r=>s(this.roster.mergeDevices(i(r)))),l=s=>f(r=>s(this.roster.mergeStatus(r))),d=Object.create(t);Object.defineProperties(d,{listDevices:{value:a,enumerable:false},listDeviceStatus:{value:o,enumerable:false},watchDevices:{value:n,enumerable:false},watchDeviceStatus:{value:l,enumerable:false},devices:{value:{...t.devices,list:a,listWithStatus:o,watch:n,watchWithStatus:l},enumerable:true}}),this.projectRuntime(d),this.stopRosterSync=c(i);}replaceEnrolledDevices(e){this.roster.replace(e);}removeEnrolledDevice(e){this.roster.remove(e);}retainCurrentEnrolledDevice(e){this.roster.retain(e);}beforeRuntimeShutdown(){this.rosterStopped||(this.stopRosterSync(),this.rosterStopped=true);}};export{h as DeviceHandle};
@@ -1,4 +1,4 @@
1
- import { C as Client, e as BroadcastGrant, O as Options } from './types-YGlXXpQA.js';
1
+ import { C as Client, e as BroadcastGrant, O as Options } from './types-Cruu-MsF.js';
2
2
  import './coreClient-ByXs38IP.js';
3
3
  import './assembly-DGrOqsLW.js';
4
4
  import './Connection-BGVBMbWg.js';
@@ -1,2 +1,2 @@
1
- import {a as a$1}from'./chunk-5VJXDYP6.js';import'./chunk-IXQ4KWGP.js';import'./chunk-AYHD4X2R.js';import {a}from'./chunk-IAYQJZQQ.js';import'./chunk-GMPEZXPD.js';import {i}from'./chunk-QL4CJCV4.js';import'./chunk-FKAQDDUM.js';import'./chunk-ZA44REGI.js';import'./chunk-PW2WEI6L.js';import'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';async function K(r,e){if(!/^pk_(?:live|test)_[0-9a-f]{40}$/.test(r)||!/^[A-Za-z0-9_-]{1,64}$/.test(e))throw new Error("[OpenRTC] External broadcast identity is invalid.");return (await a(e).getOrCreate(`app_${r.slice(-16)}`)).publicKeyJwk}function h(r){let e=new URL(r),t=["localhost","127.0.0.1","[::1]"].includes(e.hostname);if(e.protocol!=="https:"&&!(t&&e.protocol==="http:")||e.pathname!=="/"||e.username||e.password||e.search||e.hash||r!==e.origin&&r!==`${e.origin}/`)throw new Error("[OpenRTC] External broadcast service must be an exact HTTPS origin.");return e.origin}function k(r){let e=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(Math.ceil(r.length/4)*4,"=");return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}function x(r){let e="";for(let t of r)e+=String.fromCharCode(t);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function C(r,e){if(!(r.issuerPublicKey instanceof Uint8Array)||r.issuerPublicKey.length!==32)throw new Error("[OpenRTC] External broadcast issuer key must be 32 bytes.");let t=r.relay;if(t.kind==="sfu"){let a=new URL(t.controlUrl,e);if(a.origin!==e||a.protocol!==new URL(e).protocol||a.pathname==="/"||a.username||a.password||a.search||a.hash)throw new Error("[OpenRTC] External SFU control must stay on the trusted service origin.");return {issuerPublicKey:r.issuerPublicKey,relay:{kind:"sfu",controlUrl:a.href.replace(/\/$/,"")}}}else {let a=new URL(t.relayUrl);if(a.protocol!=="https:"||a.username||a.password||!t.token||!t.namespace)throw new Error("[OpenRTC] External MoQ relay access is invalid.");if(t.serverCertificateHash&&!["localhost","127.0.0.1","[::1]"].includes(a.hostname))throw new Error("[OpenRTC] Custom relay certificate hashes are limited to loopback.")}return r}function P(r,e){if(!r||typeof r.apiKey!="string"||!/^pk_(?:live|test)_[0-9a-f]{40}$/.test(r.apiKey))throw new Error("[OpenRTC] External broadcast identity is invalid.");let t=h(e.serviceOrigin);if(!/^[A-Za-z0-9_-]{1,64}$/.test(e.keyNamespace)||typeof e.resolve!="function")throw new Error("[OpenRTC] External broadcast configuration is invalid.");let a$2=a(e.keyNamespace),d=`app_${r.apiKey.slice(-16)}`,l=()=>a$2.getOrCreate(d),u=async()=>{let{loadBrowserWasmRuntimeModule:i}=await import('./WasmBridge-L76OAD5U.js'),n=await i();return await n.initWasm(),n.start(),new n.WasmClient(r.apiKey)},w,f=()=>w??(w=u()),m=new a$1({loadWasm:f,resolve:async(i,n)=>{let o=await l(),s=C(await e.resolve(i,o.publicKeyJwk,n),t),g=s.relay.kind==="sfu"?{kind:"sfu",controlUrl:s.relay.controlUrl,grant:i,bindingPublicJwk:o.publicKeyJwk,...n?{publicationVerifyingKey:x(n)}:{}}:s.relay;return {token:i,issuerPublicKey:s.issuerPublicKey,relay:g,signBindingChallenge:async b=>k(await o.sign(b))}}});return {client:i(r,{platform:"web",endpoints:{controlPlane:t,gateway:t},testingAllowInsecureLoopback:t.startsWith("http:"),deviceKeyProvider:a$2,broadcastHost:m,runtimeFactory:async i=>{let{createWasmClient:n}=await import('./runtime/factories.js');return n(i)}}),bindingPublicJwk:async()=>(await l()).publicKeyJwk}}
1
+ import {a as a$1}from'./chunk-5VJXDYP6.js';import'./chunk-IXQ4KWGP.js';import'./chunk-AYHD4X2R.js';import {a}from'./chunk-IAYQJZQQ.js';import'./chunk-GMPEZXPD.js';import {i}from'./chunk-5LNRJE6L.js';import'./chunk-FKAQDDUM.js';import'./chunk-RLPWFHOY.js';import'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import'./chunk-ZA44REGI.js';import'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';async function K(r,e){if(!/^pk_(?:live|test)_[0-9a-f]{40}$/.test(r)||!/^[A-Za-z0-9_-]{1,64}$/.test(e))throw new Error("[OpenRTC] External broadcast identity is invalid.");return (await a(e).getOrCreate(`app_${r.slice(-16)}`)).publicKeyJwk}function h(r){let e=new URL(r),t=["localhost","127.0.0.1","[::1]"].includes(e.hostname);if(e.protocol!=="https:"&&!(t&&e.protocol==="http:")||e.pathname!=="/"||e.username||e.password||e.search||e.hash||r!==e.origin&&r!==`${e.origin}/`)throw new Error("[OpenRTC] External broadcast service must be an exact HTTPS origin.");return e.origin}function k(r){let e=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(Math.ceil(r.length/4)*4,"=");return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}function x(r){let e="";for(let t of r)e+=String.fromCharCode(t);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function C(r,e){if(!(r.issuerPublicKey instanceof Uint8Array)||r.issuerPublicKey.length!==32)throw new Error("[OpenRTC] External broadcast issuer key must be 32 bytes.");let t=r.relay;if(t.kind==="sfu"){let a=new URL(t.controlUrl,e);if(a.origin!==e||a.protocol!==new URL(e).protocol||a.pathname==="/"||a.username||a.password||a.search||a.hash)throw new Error("[OpenRTC] External SFU control must stay on the trusted service origin.");return {issuerPublicKey:r.issuerPublicKey,relay:{kind:"sfu",controlUrl:a.href.replace(/\/$/,"")}}}else {let a=new URL(t.relayUrl);if(a.protocol!=="https:"||a.username||a.password||!t.token||!t.namespace)throw new Error("[OpenRTC] External MoQ relay access is invalid.");if(t.serverCertificateHash&&!["localhost","127.0.0.1","[::1]"].includes(a.hostname))throw new Error("[OpenRTC] Custom relay certificate hashes are limited to loopback.")}return r}function P(r,e){if(!r||typeof r.apiKey!="string"||!/^pk_(?:live|test)_[0-9a-f]{40}$/.test(r.apiKey))throw new Error("[OpenRTC] External broadcast identity is invalid.");let t=h(e.serviceOrigin);if(!/^[A-Za-z0-9_-]{1,64}$/.test(e.keyNamespace)||typeof e.resolve!="function")throw new Error("[OpenRTC] External broadcast configuration is invalid.");let a$2=a(e.keyNamespace),d=`app_${r.apiKey.slice(-16)}`,l=()=>a$2.getOrCreate(d),u=async()=>{let{loadBrowserWasmRuntimeModule:i}=await import('./WasmBridge-CJNESUGJ.js'),n=await i();return await n.initWasm(),n.start(),new n.WasmClient(r.apiKey)},w,f=()=>w??(w=u()),m=new a$1({loadWasm:f,resolve:async(i,n)=>{let o=await l(),s=C(await e.resolve(i,o.publicKeyJwk,n),t),g=s.relay.kind==="sfu"?{kind:"sfu",controlUrl:s.relay.controlUrl,grant:i,bindingPublicJwk:o.publicKeyJwk,...n?{publicationVerifyingKey:x(n)}:{}}:s.relay;return {token:i,issuerPublicKey:s.issuerPublicKey,relay:g,signBindingChallenge:async b=>k(await o.sign(b))}}});return {client:i(r,{platform:"web",endpoints:{controlPlane:t,gateway:t},testingAllowInsecureLoopback:t.startsWith("http:"),deviceKeyProvider:a$2,broadcastHost:m,runtimeFactory:async i=>{let{createWasmClient:n}=await import('./runtime/factories.js');return n(i)}}),bindingPublicJwk:async()=>(await l()).publicKeyJwk}}
2
2
  export{P as createExternalBroadcastClient,K as externalBroadcastBindingPublicJwk};
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { P as PlutoIpcBridge } from './ipc-DgzKqHH3.js';
2
- import { O as Options, C as Client } from './types-YGlXXpQA.js';
3
- export { a as AttestationProvider, b as AuthProvider, c as Avenue, e as BroadcastGrant, i as BroadcastPublisher, j as BroadcastRole, k as BroadcastSession, l as BroadcastSource, m as BroadcastState, n as BroadcastStats, o as BroadcastTrackEvent, p as Channel, r as Connection, s as DeviceOptions, t as DeviceProfile, u as Devices, E as EnrolledDevice, N as Offline, P as OfflineAssurance, Q as OfflineEnrollmentRequest, R as OfflineRuntimeSupport, X as Room, Y as RoomMember, Z as RoomMembers, _ as RoomOptions, $ as Space, a0 as SpaceOptions, a1 as State, a2 as Ticket, a3 as TicketOptions, a4 as Transports } from './types-YGlXXpQA.js';
2
+ import { O as Options, z as LiveOnlyOptions, C as Client } from './types-Cruu-MsF.js';
3
+ export { a as AttestationProvider, b as AuthProvider, c as Avenue, e as BroadcastGrant, i as BroadcastPublisher, j as BroadcastRole, k as BroadcastSession, l as BroadcastSource, m as BroadcastState, n as BroadcastStats, o as BroadcastTrackEvent, p as Channel, r as Connection, s as DeviceOptions, t as DeviceProfile, u as Devices, E as EnrolledDevice, T as Offline, U as OfflineAssurance, V as OfflineEnrollmentRequest, W as OfflineRuntimeSupport, a0 as Room, a1 as RoomMember, a2 as RoomMembers, a3 as RoomOptions, a4 as Space, a5 as SpaceOptions, a6 as State, a7 as Ticket, a8 as TicketOptions, a9 as Transports } from './types-Cruu-MsF.js';
4
4
  import { am as ServiceErrorMetadata } from './Connection-BGVBMbWg.js';
5
5
  export { S as ServiceErrorObservation, T as TransferPeerDemandPurpose, d as TransferPeerDemandRequest, e as TransferPeerDemandState, f as TransferPeerDemandStatus } from './Connection-BGVBMbWg.js';
6
6
  export { c as DiagnosticBundle, d as DiagnosticCapture, e as DiagnosticCaptureOptions, f as DiagnosticEvent, b as DiagnosticOperationEvent, g as DiagnosticPeer } from './coreClient-ByXs38IP.js';
@@ -11,9 +11,9 @@ import './capabilities-DsKud7Sw.js';
11
11
  * Create a lazy OpenRTC 2.0 browser client. Construction validates only local
12
12
  * input and performs no network, storage, auth, timer, WASM, or transport work.
13
13
  */
14
- declare function OpenRTC(options: Options): Client;
14
+ declare function OpenRTC(options: Options | LiveOnlyOptions): Client;
15
15
  declare namespace OpenRTC {
16
- var native: (options: Options, bridge?: PlutoIpcBridge) => Client;
16
+ var native: (options: Options | LiveOnlyOptions, bridge?: PlutoIpcBridge) => Client;
17
17
  }
18
18
 
19
19
  /**
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import {a}from'./chunk-NS32P65Z.js';import {d}from'./chunk-72NEEJQG.js';import'./chunk-GMPEZXPD.js';import {i}from'./chunk-QL4CJCV4.js';import'./chunk-FKAQDDUM.js';import'./chunk-ZA44REGI.js';import'./chunk-PW2WEI6L.js';export{b as parseTicketInvite}from'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';export{a as ERROR_CODES,b as RTCError,e as classifyError,d as createError,c as projectError}from'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';function c(n){return i(n,{platform:"web",broadcastHostFactory:async e=>{let[{BrowserManagedBroadcastHost:o},{loadBrowserWasmRuntimeModule:a}]=await Promise.all([import('./BrowserManagedBroadcastHost-6VGHQQMF.js'),import('./WasmBridge-L76OAD5U.js')]),t=a().then(async r=>(await r.initWasm(),r.start(),new r.WasmClient(e.apiKey)));return new o({resolve:e.resolve,manage:e.manage,deviceId:e.deviceId,defaultAuth:e.defaultAuth,loadWasm:()=>t})},runtimeFactory:async e=>{let{createWasmClient:o}=await import('./runtime/factories.js');return o(e)}})}c.native=function(n,e=d()){let o,a$1=()=>o??(o=import('./NativeProjectionBroker-Z6LCR4WB.js').then(({NativeProjectionBroker:t})=>new t));return i(n,{platform:"native",broadcastHostFactory:async t=>{let{NativeManagedBroadcastHost:r}=await import('./NativeManagedBroadcastHost-6A2QP3A7.js');return new r(e,t)},offlineSupport:()=>e.invoke("openrtc_offline_runtime_support"),createOfflineEnrollmentRequest:async t=>{let r=await e.invoke("start_iroh_node");return e.invoke("openrtc_create_offline_enrollment_request",{trustDomain:t.trustDomain,deviceId:t.deviceId,endpointId:r,enrollmentNonce:crypto.randomUUID(),requestedRoles:t.requestedRoles})},close:async()=>{o&&await(await o).close();},deviceKeyProvider:a(e),deviceIdProvider:async()=>{let t=await e.invoke("get_rtc_local_device_info");return String(t?.deviceId??"")},runtimeFactory:async t=>{let[{createIpcClient:r},y]=await Promise.all([import('./ipcFactory-4LCCR23Q.js'),a$1()]);return r(t,e,y)}})};export{c as OpenRTC};
1
+ import {a as a$1}from'./chunk-NS32P65Z.js';import {d as d$1}from'./chunk-72NEEJQG.js';import'./chunk-GMPEZXPD.js';import {i}from'./chunk-5LNRJE6L.js';import'./chunk-FKAQDDUM.js';import'./chunk-RLPWFHOY.js';export{b as parseTicketInvite}from'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import'./chunk-ZA44REGI.js';export{a as ERROR_CODES,b as RTCError,e as classifyError,d as createError,c as projectError}from'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';function d(n){return i(n,{platform:"web",liveHostFactory:async(e,i)=>{let{BrowserCoordinationGatewaySignaling:r}=await import('./BrowserCoordinationGatewaySignaling-GOLSTJMA.js');return r.live(e,i)},broadcastHostFactory:async e=>{let[{BrowserManagedBroadcastHost:i},{loadBrowserWasmRuntimeModule:r}]=await Promise.all([import('./BrowserManagedBroadcastHost-6VGHQQMF.js'),import('./WasmBridge-CJNESUGJ.js')]),t=r().then(async o=>(await o.initWasm(),o.start(),new o.WasmClient(e.apiKey)));return new i({resolve:e.resolve,manage:e.manage,deviceId:e.deviceId,defaultAuth:e.defaultAuth,loadWasm:()=>t})},runtimeFactory:async e=>{let{createWasmClient:i}=await import('./runtime/factories.js');return i(e)}})}d.native=function(n,e=d$1()){let i$1,r=()=>i$1??(i$1=import('./NativeProjectionBroker-Z6LCR4WB.js').then(({NativeProjectionBroker:t})=>new t));return i(n,{platform:"native",liveHostFactory:t=>new a(e,t),broadcastHostFactory:async t=>{let{NativeManagedBroadcastHost:o}=await import('./NativeManagedBroadcastHost-6A2QP3A7.js');return new o(e,t)},offlineSupport:()=>e.invoke("openrtc_offline_runtime_support"),createOfflineEnrollmentRequest:async t=>{let o=await e.invoke("start_iroh_node");return e.invoke("openrtc_create_offline_enrollment_request",{trustDomain:t.trustDomain,deviceId:t.deviceId,endpointId:o,enrollmentNonce:crypto.randomUUID(),requestedRoles:t.requestedRoles})},close:async()=>{i$1&&await(await i$1).close();},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:o},l]=await Promise.all([import('./ipcFactory-F75IXEIE.js'),r()]);return o(t,e,l)}})};var a=class{constructor(e,i){this.bridge=e;this.endpoint=i;this.retired=false;this.opened=false;this.certificate="";this.abort=new AbortController;this.listeners=new Set;}get closed(){return this.retired}onEvent(e){return this.listeners.add(e),()=>{this.listeners.delete(e);}}emit(e){for(let i of this.listeners)try{i(e);}catch{}}async credentials(e){if(this.retired)throw new Error("[OpenRTC] Live session is closed.");let i,r=new Promise((t,o)=>{i=()=>o(new Error("[OpenRTC] Live credentials were closed.")),this.abort.signal.aborted?i():this.abort.signal.addEventListener("abort",i,{once:true});});try{let t=await Promise.race([this.options.credentials({forceRefresh:e,signal:this.abort.signal}),r]);if(this.retired||!t||typeof t.certificate!="string"||t.certificate.length>8192||typeof t.session!="string"||t.session.length>24e3)throw new Error("[OpenRTC] Invalid or retired live credentials.");return t}finally{this.abort.signal.removeEventListener("abort",i);}}async open(e){if(this.opened||this.retired||!this.bridge.createChannel)throw new Error("[OpenRTC] Native live coordination is unavailable.");this.opened=true,this.options=e;let i=await this.bridge.createChannel(t=>{t.type==="credentials-required"?this.retired||this.renew().catch(()=>this.close()):t.type==="closed"?(this.retired=true,this.abort.abort(),this.emit(t)):!this.retired&&t.type==="message"&&this.emit(t);}),r=await this.credentials(false);if(this.certificate=r.certificate,this.opening=this.bridge.invoke("openrtc_open_live_coordination",{endpoint:this.endpoint,credentials:r,channel:i}),this.id=await this.opening,this.retired)throw await this.close(),new Error("[OpenRTC] Native live activation was closed.")}async renew(){if(this.renewal)return this.renewal;let e=false,i=(async()=>{let r=await this.credentials(true);if(r.certificate!==this.certificate)throw new Error("[OpenRTC] Live term changed; open a new session.");try{await this.request({type:"renew",token:r.session});}catch(t){throw e=(t instanceof Error?t.message:String(t))==="live-certificate-expiry",t}})();this.renewal=i;try{await i;}catch(r){throw e||await this.close(),r}finally{this.renewal===i&&(this.renewal=void 0);}}async request(e){if(this.retired||!this.id)throw new Error("[OpenRTC] Native live session is closed.");return this.bridge.invoke("openrtc_send_live_coordination",{sessionId:this.id,frame:e})}close(){if(this.closing)return this.closing;this.retired=true,this.abort.abort();let e=(async()=>{let i=this.id??await this.opening?.catch(()=>{});i&&await this.bridge.invoke("openrtc_close_live_coordination",{sessionId:i}),this.id=void 0,this.emit({type:"closed"}),this.listeners.clear();})();return this.closing=e,e.catch(i=>{throw this.closing===e&&(this.closing=void 0),i})}};export{d as OpenRTC};
@@ -0,0 +1 @@
1
+ import {a as a$2}from'./chunk-VARKDQGM.js';import {t}from'./chunk-SADNIMUO.js';import'./chunk-IXQ4KWGP.js';import'./chunk-CQHLD52E.js';import'./chunk-LCJQ7RSR.js';import'./chunk-FPJAUAEU.js';import {a as a$1}from'./chunk-L4HWDDXL.js';import'./chunk-2AAZFBRZ.js';import'./chunk-FNCEVW7G.js';import'./chunk-LB27VQRL.js';import'./chunk-OWKAJPOI.js';import {a}from'./chunk-XXZEDZUU.js';import'./chunk-TPF643LU.js';import'./chunk-72NEEJQG.js';import'./chunk-L2ZZXECX.js';import'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import'./chunk-ZA44REGI.js';import'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';function l(p,n,m=new a){let t$1=a$1(p);return a$2(t$1,new t({...t$1,bridge:n,projectionBroker:m}))}export{l as createIpcClient};
package/dist/native.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { O as Options, C as Client } from './types-YGlXXpQA.js';
2
- export { A as AccessMode, a as AttestationProvider, b as AuthProvider, c as Avenue, B as BotVerificationProvider, d as BroadcastCreateOptions, e as BroadcastGrant, f as BroadcastInvite, g as BroadcastInviteOptions, h as BroadcastMedia, i as BroadcastPublisher, j as BroadcastRole, k as BroadcastSession, l as BroadcastSource, m as BroadcastState, n as BroadcastStats, o as BroadcastTrackEvent, p as Channel, q as Channels, r as Connection, D as Delivery, s as DeviceOptions, t as DeviceProfile, u as Devices, E as EnrolledDevice, I as IncomingPeerBidirectionalStream, v as IncomingPeerUnidirectionalStream, M as MediaConnection, w as MediaIncomingDemuxStats, x as MediaKind, y as MediaLatencySummary, z as MediaReceiver, F as MediaReceiverStats, G as MediaSender, H as MediaSenderStats, J as MediaStats, K as MediaTrackEvent, L as MediaTrackOptions, N as Offline, P as OfflineAssurance, Q as OfflineEnrollmentRequest, R as OfflineRuntimeSupport, S as PeerBidirectionalStream, T as PeerDatagramDuplexStream, U as PeerDatagramStats, V as PeerStreamOptions, W as PeerStreamTransport, X as Room, Y as RoomMember, Z as RoomMembers, _ as RoomOptions, $ as Space, a0 as SpaceOptions, a1 as State, a2 as Ticket, a3 as TicketOptions, a4 as Transports } from './types-YGlXXpQA.js';
1
+ import { O as Options, C as Client } from './types-Cruu-MsF.js';
2
+ export { A as AccessMode, a as AttestationProvider, b as AuthProvider, c as Avenue, B as BotVerificationProvider, d as BroadcastCreateOptions, e as BroadcastGrant, f as BroadcastInvite, g as BroadcastInviteOptions, h as BroadcastMedia, i as BroadcastPublisher, j as BroadcastRole, k as BroadcastSession, l as BroadcastSource, m as BroadcastState, n as BroadcastStats, o as BroadcastTrackEvent, p as Channel, q as Channels, r as Connection, D as Delivery, s as DeviceOptions, t as DeviceProfile, u as Devices, E as EnrolledDevice, I as IncomingPeerBidirectionalStream, v as IncomingPeerUnidirectionalStream, L as LiveCoordinationCredentials, w as LiveCoordinationMessage, x as LiveCoordinationOptions, y as LiveCoordinationSession, z as LiveOnlyOptions, M as MediaConnection, F as MediaIncomingDemuxStats, G as MediaKind, H as MediaLatencySummary, J as MediaReceiver, K as MediaReceiverStats, N as MediaSender, P as MediaSenderStats, Q as MediaStats, R as MediaTrackEvent, S as MediaTrackOptions, T as Offline, U as OfflineAssurance, V as OfflineEnrollmentRequest, W as OfflineRuntimeSupport, X as PeerBidirectionalStream, Y as PeerDatagramDuplexStream, Z as PeerDatagramStats, _ as PeerStreamOptions, $ as PeerStreamTransport, a0 as Room, a1 as RoomMember, a2 as RoomMembers, a3 as RoomOptions, a4 as Space, a5 as SpaceOptions, a6 as State, a7 as Ticket, a8 as TicketOptions, a9 as Transports } from './types-Cruu-MsF.js';
3
3
  import { P as PlutoIpcBridge } from './ipc-DgzKqHH3.js';
4
4
  export { E as EffectiveRoomArchitecture, R as RoomArchitectureMode, a as RoomArchitectureReason, b as RoomArchitectureSnapshot, c as RoomAuthorityAssignment, T as TransferPeerDemandPurpose, d as TransferPeerDemandRequest, e as TransferPeerDemandState, f as TransferPeerDemandStatus } from './Connection-BGVBMbWg.js';
5
5
  import './coreClient-ByXs38IP.js';
package/dist/native.js CHANGED
@@ -1 +1 @@
1
- import {a}from'./chunk-XXZEDZUU.js';import'./chunk-TPF643LU.js';import {a as a$1}from'./chunk-NS32P65Z.js';import {d}from'./chunk-72NEEJQG.js';import'./chunk-GMPEZXPD.js';import {i}from'./chunk-QL4CJCV4.js';import'./chunk-FKAQDDUM.js';import'./chunk-ZA44REGI.js';import'./chunk-PW2WEI6L.js';import'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';function u(p,t=d()){let r=new a;return i(p,{platform:"native",broadcastHostFactory:async e=>{let{NativeManagedBroadcastHost:o}=await import('./NativeManagedBroadcastHost-6A2QP3A7.js');return new o(t,e)},offlineSupport:()=>t.invoke("openrtc_offline_runtime_support"),createOfflineEnrollmentRequest:async e=>{let o=await t.invoke("start_iroh_node");return t.invoke("openrtc_create_offline_enrollment_request",{trustDomain:e.trustDomain,deviceId:e.deviceId,endpointId:o,enrollmentNonce:crypto.randomUUID(),requestedRoles:e.requestedRoles})},close:()=>r.close(),deviceKeyProvider:a$1(t),deviceIdProvider:async()=>{let e=await t.invoke("get_rtc_local_device_info");return String(e?.deviceId??"")},runtimeFactory:async e=>{let{createIpcClient:o}=await import('./ipcFactory-4LCCR23Q.js');return o(e,t,r)}})}export{u as OpenRTC};
1
+ import {a}from'./chunk-XXZEDZUU.js';import'./chunk-TPF643LU.js';import {a as a$1}from'./chunk-NS32P65Z.js';import {d}from'./chunk-72NEEJQG.js';import'./chunk-GMPEZXPD.js';import {i}from'./chunk-5LNRJE6L.js';import'./chunk-FKAQDDUM.js';import'./chunk-RLPWFHOY.js';import'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import'./chunk-ZA44REGI.js';import'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';function u(p,t=d()){let r=new a;return i(p,{platform:"native",broadcastHostFactory:async e=>{let{NativeManagedBroadcastHost:o}=await import('./NativeManagedBroadcastHost-6A2QP3A7.js');return new o(t,e)},offlineSupport:()=>t.invoke("openrtc_offline_runtime_support"),createOfflineEnrollmentRequest:async e=>{let o=await t.invoke("start_iroh_node");return t.invoke("openrtc_create_offline_enrollment_request",{trustDomain:e.trustDomain,deviceId:e.deviceId,endpointId:o,enrollmentNonce:crypto.randomUUID(),requestedRoles:e.requestedRoles})},close:()=>r.close(),deviceKeyProvider:a$1(t),deviceIdProvider:async()=>{let e=await t.invoke("get_rtc_local_device_info");return String(e?.deviceId??"")},runtimeFactory:async e=>{let{createIpcClient:o}=await import('./ipcFactory-F75IXEIE.js');return o(e,t,r)}})}export{u as OpenRTC};
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { O as Options, C as Client } from './types-YGlXXpQA.js';
2
- export { A as AccessMode, a as AttestationProvider, b as AuthProvider, c as Avenue, B as BotVerificationProvider, d as BroadcastCreateOptions, e as BroadcastGrant, f as BroadcastInvite, g as BroadcastInviteOptions, h as BroadcastMedia, i as BroadcastPublisher, j as BroadcastRole, k as BroadcastSession, l as BroadcastSource, m as BroadcastState, n as BroadcastStats, o as BroadcastTrackEvent, p as Channel, q as Channels, r as Connection, D as Delivery, s as DeviceOptions, t as DeviceProfile, u as Devices, E as EnrolledDevice, I as IncomingPeerBidirectionalStream, v as IncomingPeerUnidirectionalStream, M as MediaConnection, w as MediaIncomingDemuxStats, x as MediaKind, y as MediaLatencySummary, z as MediaReceiver, F as MediaReceiverStats, G as MediaSender, H as MediaSenderStats, J as MediaStats, K as MediaTrackEvent, L as MediaTrackOptions, N as Offline, P as OfflineAssurance, Q as OfflineEnrollmentRequest, R as OfflineRuntimeSupport, S as PeerBidirectionalStream, T as PeerDatagramDuplexStream, U as PeerDatagramStats, V as PeerStreamOptions, W as PeerStreamTransport, X as Room, Y as RoomMember, Z as RoomMembers, _ as RoomOptions, $ as Space, a0 as SpaceOptions, a1 as State, a2 as Ticket, a3 as TicketOptions, a4 as Transports } from './types-YGlXXpQA.js';
1
+ import { O as Options, C as Client } from './types-Cruu-MsF.js';
2
+ export { A as AccessMode, a as AttestationProvider, b as AuthProvider, c as Avenue, B as BotVerificationProvider, d as BroadcastCreateOptions, e as BroadcastGrant, f as BroadcastInvite, g as BroadcastInviteOptions, h as BroadcastMedia, i as BroadcastPublisher, j as BroadcastRole, k as BroadcastSession, l as BroadcastSource, m as BroadcastState, n as BroadcastStats, o as BroadcastTrackEvent, p as Channel, q as Channels, r as Connection, D as Delivery, s as DeviceOptions, t as DeviceProfile, u as Devices, E as EnrolledDevice, I as IncomingPeerBidirectionalStream, v as IncomingPeerUnidirectionalStream, L as LiveCoordinationCredentials, w as LiveCoordinationMessage, x as LiveCoordinationOptions, y as LiveCoordinationSession, z as LiveOnlyOptions, M as MediaConnection, F as MediaIncomingDemuxStats, G as MediaKind, H as MediaLatencySummary, J as MediaReceiver, K as MediaReceiverStats, N as MediaSender, P as MediaSenderStats, Q as MediaStats, R as MediaTrackEvent, S as MediaTrackOptions, T as Offline, U as OfflineAssurance, V as OfflineEnrollmentRequest, W as OfflineRuntimeSupport, X as PeerBidirectionalStream, Y as PeerDatagramDuplexStream, Z as PeerDatagramStats, _ as PeerStreamOptions, $ as PeerStreamTransport, a0 as Room, a1 as RoomMember, a2 as RoomMembers, a3 as RoomOptions, a4 as Space, a5 as SpaceOptions, a6 as State, a7 as Ticket, a8 as TicketOptions, a9 as Transports } from './types-Cruu-MsF.js';
3
3
  import { P as PlutoIpcBridge } from './ipc-DgzKqHH3.js';
4
4
  import { S as ServiceErrorObservation } from './Connection-BGVBMbWg.js';
5
5
  export { E as EffectiveRoomArchitecture, R as RoomArchitectureMode, a as RoomArchitectureReason, b as RoomArchitectureSnapshot, c as RoomAuthorityAssignment, T as TransferPeerDemandPurpose, d as TransferPeerDemandRequest, e as TransferPeerDemandState, f as TransferPeerDemandStatus } from './Connection-BGVBMbWg.js';
package/dist/node.js CHANGED
@@ -1,2 +1,2 @@
1
- import {a}from'./chunk-XXZEDZUU.js';import {a as a$2}from'./chunk-TPF643LU.js';import {a as a$1}from'./chunk-NS32P65Z.js';import {c}from'./chunk-72NEEJQG.js';import'./chunk-GMPEZXPD.js';import {i,b as b$2,a as a$3}from'./chunk-QL4CJCV4.js';import'./chunk-FKAQDDUM.js';import'./chunk-ZA44REGI.js';import'./chunk-PW2WEI6L.js';import'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import {e as e$1,b as b$3}from'./chunk-L7N4T2PX.js';import {b as b$1,d,e}from'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';import {spawn}from'child_process';import {constants}from'fs';import {access,readFile}from'fs/promises';import {isAbsolute,resolve,dirname}from'path';import {fileURLToPath}from'url';import {isDeepStrictEqual}from'util';import {randomUUID,verify,createHash}from'crypto';var E=1,F=24*1024,U=96*1024,N=128*1024,C=64*1024,ne=256,ie=256,L=3e4,se=/^[A-Za-z0-9_.:@-]+$/,ae=/(?:^|_)(?:SECRET|TOKEN|PASSWORD|PRIVATE(?:_KEY)?|CREDENTIALS?)(?:_|$)/i,ce=1;function de(r){return Buffer.from(JSON.stringify({schema:r.schema,kind:r.kind,platform:r.platform,arch:r.arch,rustTarget:r.rustTarget,sourceCommit:r.sourceCommit,sourceDigest:r.sourceDigest,binarySha256:r.binarySha256,protocol:r.protocol,signingKeySha256:r.signingKeySha256,signatureAlgorithm:r.signatureAlgorithm}),"utf8")}async function le(r,e,t){let[o,n,c]=await Promise.all([readFile(t),readFile(resolve(e,"openrtc-node-host.manifest.json")),readFile(resolve(r,"native","openrtc-node-host-signing-public.pem"))]).catch(()=>{throw new Error("[OpenRTC] Packaged Node host provenance is incomplete.")}),i;try{i=JSON.parse(n.toString("utf8"));}catch{throw new Error("[OpenRTC] Packaged Node host manifest is invalid.")}let a=s=>createHash("sha256").update(s).digest("hex"),u={"darwin-arm64":"aarch64-apple-darwin","darwin-x64":"x86_64-apple-darwin","linux-x64":"x86_64-unknown-linux-gnu"}[`${process.platform}-${process.arch}`];if(!(i!=null&&u!==void 0&&i.schema===ce&&i.kind==="openrtc-node-host"&&i.platform===process.platform&&i.arch===process.arch&&i.rustTarget===u&&/^[0-9a-f]{40}$/.test(i.sourceCommit)&&/^[0-9a-f]{64}$/.test(i.sourceDigest)&&i.binarySha256===a(o)&&i.signingKeySha256===a(c)&&i.signatureAlgorithm==="ed25519"&&/^[A-Za-z0-9+/]{86}==$/.test(i.signature)&&verify(null,de(i),c,Buffer.from(i.signature,"base64"))))throw new Error("[OpenRTC] Packaged Node host provenance verification failed.")}function z(r){return Object.fromEntries(Object.entries(process.env).filter(([e,t])=>!ae.test(e)&&(!r||!t?.includes(r))))}function f(r,e){queueMicrotask(()=>{try{let t=r(e);t&&typeof t.then=="function"&&t.catch(()=>{try{process.emitWarning("[OpenRTC] ServiceNode callback failed.",{code:"OPENRTC_SERVICE_CALLBACK"});}catch{}});}catch{try{process.emitWarning("[OpenRTC] ServiceNode callback failed.",{code:"OPENRTC_SERVICE_CALLBACK"});}catch{}}});}function $(r){let e=/^\d{1,20}$/;return typeof r.transportStableId!="string"||!e.test(r.transportStableId)||!e.test(r.transportGeneration)||!e.test(r.routeGeneration)?null:{transportStableId:r.transportStableId,transportGeneration:r.transportGeneration,routeGeneration:r.routeGeneration}}function ue(r,e){return r.transportStableId===e.transportStableId&&r.transportGeneration===e.transportGeneration&&r.routeGeneration===e.routeGeneration}function m(r,e,t=160){let o=r.trim();if(!o||o.length>t||!se.test(o))throw new TypeError(`[OpenRTC] ${e} is invalid.`);return o}function v(r,e,t=Number.MAX_SAFE_INTEGER){if(!Number.isSafeInteger(r)||r<1||r>t)throw new RangeError(`[OpenRTC] ${e} must be a positive safe integer.`);return r}function pe(r){if(!/^pk_(?:live|test)_[A-Za-z0-9]+$/.test(r.apiKey))throw new TypeError("[OpenRTC] apiKey is invalid.");if(!/^sk_(?:live|test)_[A-Za-z0-9_-]+$/.test(r.secretKey)||r.secretKey.length>128)throw new TypeError("[OpenRTC] secretKey is invalid.");let e=[...r.shardIds].map(t=>m(t,"shardId",80)).sort();if(e.length<1||e.length>64||new Set(e).size!==e.length)throw new RangeError("[OpenRTC] shardIds must contain 1..64 unique identifiers.");if(!isAbsolute(r.stateDirectory))throw new TypeError("[OpenRTC] stateDirectory must be absolute.");return r.maxPeers!==void 0&&v(r.maxPeers,"maxPeers",50),r.startupTimeoutMs!==void 0&&v(r.startupTimeoutMs,"startupTimeoutMs",12e4),{...r,serviceId:m(r.serviceId,"serviceId",80),generation:v(r.generation,"generation"),shardIds:e,deviceId:m(r.deviceId,"deviceId"),deviceName:r.deviceName?.trim()||"OpenRTC Node service"}}async function y(r){try{return await access(r,process.platform==="win32"?constants.F_OK:constants.X_OK),!0}catch{return false}}async function V(r,e,t,o,n){return new Promise((c,i)=>{let a=spawn(r,e,{cwd:t,env:z(n),stdio:["ignore","pipe","pipe"]}),d=Buffer.alloc(0),u=Buffer.alloc(0),l=(p,Y)=>Buffer.concat([p,Y]).subarray(-N);a.stdout.on("data",p=>{d=l(d,p);}),a.stderr.on("data",p=>{u=l(u,p);});let s=setTimeout(()=>{a.kill(),i(new Error(`[OpenRTC] Node host command timed out: ${r}.`));},o);a.once("error",p=>{clearTimeout(s),i(p);}),a.once("exit",p=>{clearTimeout(s),p===0?c(d.toString("utf8")):i(new Error(`[OpenRTC] Node host command failed (${p??"signal"}): ${u.toString("utf8").trim().slice(-4096)}`));});})}async function J(r){let e=r.binaryPath||process.env.OPENRTC_NODE_HOST_BINARY;if(e){if(!isAbsolute(e)||!await y(e))throw new Error("[OpenRTC] Node host binaryPath must name an executable absolute path.");return {command:e,args:[...r.binaryArgs??[]]}}if(r.buildFromSource){let c=r.sourceRoot||process.env.OPENRTC_SOURCE_ROOT;if(!c||!isAbsolute(c))throw new Error("[OpenRTC] buildFromSource requires an absolute sourceRoot or OPENRTC_SOURCE_ROOT.");let i=resolve(c,"crates/openrtc/Cargo.toml"),a=resolve(c,"target");await V("cargo",["build","--locked","--manifest-path",i,"--features","node-host","--bin","openrtc-node-host","--target-dir",a],c,12e4,r.secretKey);let d=resolve(a,"debug",`openrtc-node-host${process.platform==="win32"?".exe":""}`);if(!await y(d))throw new Error("[OpenRTC] local Node host build did not produce an executable.");return {command:d,args:[]}}let t=resolve(dirname(fileURLToPath(import.meta.url)),".."),o=resolve(t,"native",`${process.platform}-${process.arch}`),n=resolve(o,`openrtc-node-host${process.platform==="win32"?".exe":""}`);if(!await y(n))throw new Error(`[OpenRTC] This package has no Node host for ${process.platform}-${process.arch}. Install a supported OpenRTC package, set OPENRTC_NODE_HOST_BINARY, or use buildFromSource with sourceRoot.`);return await le(t,o,n),{command:n,args:[]}}async function X(r,e){let t=await V(r.command,[...r.args,"--protocol-info"],process.cwd(),12e4,e),o=JSON.parse(t);if(o.protocolVersion!==E||o.lifecycleOwner!=="rust-peer-session"||o.maxConfigBytes!==F||o.maxCommandBytes!==U||o.maxApplicationPayloadBytes!==C)throw new Error("[OpenRTC] Node host protocol is incompatible.");return o}var I=class{constructor(e,t,o){this.options=e;this.roomId=t;this.onEvent=o;this.child=null;this.childClosed=Promise.resolve();this.output=Buffer.alloc(0);this.stderr=Buffer.alloc(0);this.pending=new Map;this.writeQueue=Promise.resolve();this.stopped=false;this.closing=null;}async start(){let e=await J(this.options),t=await X(e,this.options.secretKey),o=new Promise((n,c)=>{let i=spawn(e.command,[...e.args],{env:z(this.options.secretKey),stdio:["pipe","pipe","pipe"]});this.child=i,this.childClosed=new Promise(l=>i.once("close",()=>l()));let a,d=setTimeout(()=>{c(this.failure("Node host startup timed out")),i.kill();},this.options.startupTimeoutMs??L),u=l=>{clearTimeout(d);let s=b$3.is(l)?l:this.failure(l.message);this.terminalFailure=a??s,c(s),this.failAll(s);};i.once("error",u),i.stdin.on("error",l=>{u(a??l),i.kill();}),i.stderr.on("data",l=>{this.stderr=Buffer.concat([this.stderr,l]).subarray(-4096);}),i.stdout.on("data",l=>{try{for(let s of this.parse(l)){if(s.type==="failure"){a=this.failure(s.error,s.serviceError),u(a);continue}if(t.testLane&&process.env.OPENRTC_NODE_HOST_LOCAL_TRACE==="1"&&s.type==="connection-state"&&console.error("[openrtc-local-node]",this.options.deviceId,{connectionId:s.snapshot.connectionId,deviceId:s.snapshot.deviceId,state:s.snapshot.state,routable:s.snapshot.routable,transportStableId:s.transportStableId,transportGeneration:s.transportGeneration,routeGeneration:s.routeGeneration}),s.type==="ready"){if(s.protocolVersion!==E||s.roomId!==this.roomId||s.deviceId!==this.options.deviceId||!isDeepStrictEqual(s.testLane,t.testLane))throw new Error("Node host returned inconsistent readiness metadata");clearTimeout(d),n();}this.dispatch(s);}}catch(s){u(s instanceof Error?s:new Error(String(s))),i.kill();}}),i.once("exit",(l,s)=>{clearTimeout(d),this.stopped=true;let p=a??this.failure(`Node host exited (${l??s??"unknown"})`);this.onEvent({type:"host-exit",error:p}),u(p);});});o.catch(()=>{});try{await this.writeLine({protocolVersion:E,apiKey:this.options.apiKey,secretKey:this.options.secretKey,serviceId:this.options.serviceId,generation:this.options.generation,shardIds:this.options.shardIds,deviceId:this.options.deviceId,roomId:this.roomId,deviceName:this.options.deviceName,stateDirectory:this.options.stateDirectory,maxPeers:this.options.maxPeers,irohRelay:this.options.irohRelay!==!1},F),await o;}catch(n){throw this.terminalFailure??n}}async request(e,t){if(!this.child||this.stopped||!this.child.stdin.writable)throw new Error("[OpenRTC] Node host is closed.");if(this.pending.size>=ne)throw new Error("[OpenRTC] Node host has too many pending requests.");let o=randomUUID(),n=new Promise((c,i)=>{let a=setTimeout(()=>{this.pending.delete(o),i(new Error(`[OpenRTC] Node host ${e} response timed out.`));},L);this.pending.set(o,{resolve:c,reject:i,timer:a});});n.catch(()=>{});try{await this.writeLine({type:e,id:o,...t},U);}catch(c){let i=this.pending.get(o);i&&(clearTimeout(i.timer),this.pending.delete(o),i.reject(this.terminalFailure??this.failure(c instanceof Error?c.message:String(c))));}return n}close(){return this.closing??(this.closing=this.stop())}async stop(){if(!this.child)return;let e=this.child;try{this.stopped||await this.request("shutdown",{});}finally{e.stdin.end();let t=setTimeout(()=>e.kill("SIGTERM"),2e3),o=setTimeout(()=>e.kill("SIGKILL"),4e3);try{await this.childClosed;}finally{clearTimeout(t),clearTimeout(o);}}}parse(e){if(this.output=Buffer.concat([this.output,e]),this.output.length>N&&!this.output.includes(10))throw new Error("Node host output line exceeded its byte limit");let t=[];for(;;){let o=this.output.indexOf(10);if(o<0)break;if(o>N)throw new Error("Node host output line exceeded its byte limit");let n=this.output.subarray(0,o).toString("utf8").trim();this.output=this.output.subarray(o+1),n&&t.push(JSON.parse(n));}return t}writeLine(e,t){let o=`${JSON.stringify(e)}
2
- `;if(Buffer.byteLength(o,"utf8")-1>t)return Promise.reject(new Error("Node host input line exceeded its byte limit"));let n=this.writeQueue.then(()=>new Promise((c,i)=>{if(!this.child||this.stopped||!this.child.stdin.writable){i(new Error("Node host is closed"));return}this.child.stdin.write(o,a=>{a?i(a):c();});}));return this.writeQueue=n.catch(()=>{}),n}dispatch(e){if(e.type!=="response"){this.onEvent(e);return}let t=this.pending.get(e.id);t&&(clearTimeout(t.timer),this.pending.delete(e.id),e.ok?t.resolve(e.value):t.reject(this.failure(e.error||"Node host request failed",e.serviceError)));}failure(e$2,t){let o=a=>a.split(this.options.secretKey).join("[REDACTED]"),n=o(e$2),c=o(this.stderr.toString("utf8")).trim(),i=`[OpenRTC] ${n}.${c?` Host stderr: ${c}`:""}`;if(t&&typeof t=="object"&&!Array.isArray(t)){let a=t,d$1=b$1(a.code);if(d(a.code)||d$1){let u=e(a);return e$1({...u,requestId:u.requestId?o(u.requestId):void 0,code:a.code,retryable:typeof a.retryable=="boolean"?a.retryable:!!d$1,message:i})}}return new Error(i)}failAll(e){for(let t of this.pending.values())clearTimeout(t.timer),t.reject(e);this.pending.clear();}},S=class{constructor(e,t,o,n,c){this.id=e;this.peerId=t;this.host=o;this.nativeGeneration=n;this.capabilityKey=c;this.messages=new Set;this.closeListeners=new Set;this.queued=[];this.isClosed=false;}async send(e){if(this.isClosed)throw new Error("[OpenRTC] Connection is closed.");let t=he(e instanceof Uint8Array||e instanceof ArrayBuffer?e:a$3("raw","message",e,this.capabilityKey));await this.host.request("send",{connectionId:this.id,payloadBase64:t.toString("base64")});}onMessage(e){let t=e;this.messages.add(t);for(let o of this.queued.splice(0))f(t,o);return ()=>this.messages.delete(t)}onClose(e){return this.isClosed?f(e,void 0):this.closeListeners.add(e),()=>this.closeListeners.delete(e)}receive(e){if(!this.isClosed){if(this.messages.size===0){this.queued.length===ie&&this.queued.shift(),this.queued.push(e);return}for(let t of this.messages)f(t,e);}}close(){if(!this.isClosed){this.isClosed=true,this.queued.length=0;for(let e of this.closeListeners)f(e,void 0);this.messages.clear(),this.closeListeners.clear();}}accepts(e){return ue(e,this.nativeGeneration)}replaceGeneration(e){this.nativeGeneration=e;}},T=class{constructor(e,t,o){this.id=e;this.host=t;this.onServiceError=o;this.kind="room";this.listeners=new Set;this.connections=new Map;this.closed=false;}publishAssignment(e){if(this.closed)return Promise.reject(new Error("[OpenRTC] Service room is closed."));let t=(e.priorityDeviceIds??[]).map(n=>m(n,"priorityDeviceId")),o=(e.relevantEntityIds??[]).map(n=>m(n,"relevantEntityId"));return t.length>8||o.length>32||new Set(t).size!==t.length||new Set(o).size!==o.length?Promise.reject(new Error("[OpenRTC] Authority assignment identifiers are invalid.")):this.host.request("publish-assignment",{revision:v(e.revision,"revision"),subjectDeviceId:m(e.subjectDeviceId,"subjectDeviceId"),shardId:m(e.shardId,"shardId",80),priorityDeviceIds:t,relevantEntityIds:o,ttlMs:e.ttlMs===void 0?void 0:v(e.ttlMs,"ttlMs",12e4)})}onConnection(e){this.listeners.add(e);for(let t of this.connections.values())f(e,t);return ()=>this.listeners.delete(e)}project(e){if(this.closed)return;if(e.type==="host-exit"){this.closed=true;for(let d of this.connections.values())d.close();this.connections.clear(),this.listeners.clear();return}if(e.type==="service-error"){let d=e.avenue;if(!d||typeof d!="object"||Array.isArray(d))return;let u=d;if(u.kind!=="room"||u.id!==this.id||typeof e.runtimeInstanceId!="string"||e.runtimeInstanceId.trim().length===0)return;let l=a$2(e.serviceError,{kind:"room",id:this.id});l&&this.onServiceError&&f(()=>{if(!this.closed)return this.onServiceError?.(l)},void 0);return}if(e.type==="peer-message"){let d=this.connections.get(e.connectionId),u=$(e);if(d&&u&&d.accepts(u)){let l=fe(e.payloadBase64),s=b$2(l);s?s.capability===`room:${this.id}`&&s.kind==="raw"&&d.receive(s.value):d.receive(l);}return}if(e.type!=="connection-state")return;let t=e.snapshot,o=$(e);if(typeof t.connectionId!="string"||!o)return;let n=this.connections.get(t.connectionId);if(typeof t.state=="string"&&["closed","failed"].includes(t.state.toLowerCase())){n?.accepts(o)&&(n.close(),this.connections.delete(t.connectionId));return}if(n){t.routable===true&&n.replaceGeneration(o);return}let i=typeof t.remoteNodeId=="string"?t.remoteNodeId:null;if(t.routable!==true||!i)return;let a=new S(t.connectionId,i,this.host,o,`room:${this.id}`);this.connections.set(a.id,a);for(let d of this.listeners)f(d,a);}async close(){if(this.closed)return this.host.close();this.closed=true;for(let e of this.connections.values())e.close();this.connections.clear(),this.listeners.clear(),await this.host.close();}};function he(r){let e;if(r instanceof Uint8Array)e=Buffer.from(r);else if(r instanceof ArrayBuffer)e=Buffer.from(r);else if(typeof r=="string")e=Buffer.from(r,"utf8");else {let t=JSON.stringify(r);if(t===void 0)throw new TypeError("[OpenRTC] Message must be a string, bytes, or JSON value.");e=Buffer.from(t,"utf8");}if(e.length>C)throw new RangeError("[OpenRTC] Message exceeds the Node host payload limit.");return e}function fe(r){let e=Buffer.from(r,"base64");if(e.length>C)throw new Error("[OpenRTC] Node host returned an oversized application payload.");try{let t=new TextDecoder("utf-8",{fatal:!0}).decode(e);try{return JSON.parse(t)}catch{return t}}catch{return new Uint8Array(e)}}var b=class{constructor(e){this.listeners=new Set;this.roomPromise=null;this.roomId=null;this.closed=false;this.closing=null;this.options=pe(e);}onConnection(e){if(this.closed)throw new Error("[OpenRTC] ServiceNode is closed.");return this.listeners.add(e),()=>this.listeners.delete(e)}listen(e){return this.closed?Promise.reject(new Error("[OpenRTC] ServiceNode is closed.")):(e=m(e,"roomId"),this.roomId&&this.roomId!==e?Promise.reject(new Error("[OpenRTC] A Node ServiceNode owns exactly one room.")):this.roomPromise?this.roomPromise:(this.roomId=e,this.roomPromise=this.open(e),this.roomPromise))}close(){return this.closing??(this.closing=this.stop())}async stop(){this.closed=true,await(await this.roomPromise?.catch(()=>null))?.close(),this.listeners.clear();}async open(e){let t,o=new I(this.options,e,n=>t?.project(n));t=new T(e,o,this.options.onServiceError);try{return await o.start(),t.onConnection(n=>{for(let c of this.listeners)f(c,{room:t,connection:n});}),t}catch(n){throw await o.close().catch(()=>{}),this.roomPromise=null,this.roomId=null,n}}};async function me(r){let e=await J(r);return X(e)}function ke(r,e){let t=c(e,"openrtc/node"),o=new a;return i(r,{platform:"native",broadcastHostFactory:async n=>{let{NativeManagedBroadcastHost:c}=await import('./NativeManagedBroadcastHost-6A2QP3A7.js');return new c(t,n)},offlineSupport:()=>t.invoke("openrtc_offline_runtime_support"),createOfflineEnrollmentRequest:async n=>{let c=await t.invoke("start_iroh_node");return t.invoke("openrtc_create_offline_enrollment_request",{trustDomain:n.trustDomain,deviceId:n.deviceId,endpointId:c,enrollmentNonce:crypto.randomUUID(),requestedRoles:n.requestedRoles})},close:()=>o.close(),deviceKeyProvider:a$1(t),deviceIdProvider:async()=>{let n=await t.invoke("get_rtc_local_device_info");return String(n?.deviceId??"")},runtimeFactory:async n=>{let{createIpcClient:c}=await import('./ipcFactory-4LCCR23Q.js');return c(n,t,o)}})}export{ke as OpenRTC,b as ServiceNode,me as inspectNodeHost};
1
+ import {a}from'./chunk-XXZEDZUU.js';import {a as a$2}from'./chunk-TPF643LU.js';import {a as a$1}from'./chunk-NS32P65Z.js';import {c}from'./chunk-72NEEJQG.js';import'./chunk-GMPEZXPD.js';import {i,b as b$2,a as a$3}from'./chunk-5LNRJE6L.js';import'./chunk-FKAQDDUM.js';import'./chunk-RLPWFHOY.js';import'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import'./chunk-ZA44REGI.js';import {e as e$1,b as b$3}from'./chunk-L7N4T2PX.js';import {b as b$1,d,e}from'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';import {spawn}from'child_process';import {constants}from'fs';import {access,readFile}from'fs/promises';import {isAbsolute,resolve,dirname}from'path';import {fileURLToPath}from'url';import {isDeepStrictEqual}from'util';import {randomUUID,verify,createHash}from'crypto';var E=1,F=24*1024,U=96*1024,N=128*1024,C=64*1024,ne=256,ie=256,L=3e4,se=/^[A-Za-z0-9_.:@-]+$/,ae=/(?:^|_)(?:SECRET|TOKEN|PASSWORD|PRIVATE(?:_KEY)?|CREDENTIALS?)(?:_|$)/i,ce=1;function de(r){return Buffer.from(JSON.stringify({schema:r.schema,kind:r.kind,platform:r.platform,arch:r.arch,rustTarget:r.rustTarget,sourceCommit:r.sourceCommit,sourceDigest:r.sourceDigest,binarySha256:r.binarySha256,protocol:r.protocol,signingKeySha256:r.signingKeySha256,signatureAlgorithm:r.signatureAlgorithm}),"utf8")}async function le(r,e,t){let[o,n,c]=await Promise.all([readFile(t),readFile(resolve(e,"openrtc-node-host.manifest.json")),readFile(resolve(r,"native","openrtc-node-host-signing-public.pem"))]).catch(()=>{throw new Error("[OpenRTC] Packaged Node host provenance is incomplete.")}),i;try{i=JSON.parse(n.toString("utf8"));}catch{throw new Error("[OpenRTC] Packaged Node host manifest is invalid.")}let a=s=>createHash("sha256").update(s).digest("hex"),u={"darwin-arm64":"aarch64-apple-darwin","darwin-x64":"x86_64-apple-darwin","linux-x64":"x86_64-unknown-linux-gnu"}[`${process.platform}-${process.arch}`];if(!(i!=null&&u!==void 0&&i.schema===ce&&i.kind==="openrtc-node-host"&&i.platform===process.platform&&i.arch===process.arch&&i.rustTarget===u&&/^[0-9a-f]{40}$/.test(i.sourceCommit)&&/^[0-9a-f]{64}$/.test(i.sourceDigest)&&i.binarySha256===a(o)&&i.signingKeySha256===a(c)&&i.signatureAlgorithm==="ed25519"&&/^[A-Za-z0-9+/]{86}==$/.test(i.signature)&&verify(null,de(i),c,Buffer.from(i.signature,"base64"))))throw new Error("[OpenRTC] Packaged Node host provenance verification failed.")}function z(r){return Object.fromEntries(Object.entries(process.env).filter(([e,t])=>!ae.test(e)&&(!r||!t?.includes(r))))}function f(r,e){queueMicrotask(()=>{try{let t=r(e);t&&typeof t.then=="function"&&t.catch(()=>{try{process.emitWarning("[OpenRTC] ServiceNode callback failed.",{code:"OPENRTC_SERVICE_CALLBACK"});}catch{}});}catch{try{process.emitWarning("[OpenRTC] ServiceNode callback failed.",{code:"OPENRTC_SERVICE_CALLBACK"});}catch{}}});}function $(r){let e=/^\d{1,20}$/;return typeof r.transportStableId!="string"||!e.test(r.transportStableId)||!e.test(r.transportGeneration)||!e.test(r.routeGeneration)?null:{transportStableId:r.transportStableId,transportGeneration:r.transportGeneration,routeGeneration:r.routeGeneration}}function ue(r,e){return r.transportStableId===e.transportStableId&&r.transportGeneration===e.transportGeneration&&r.routeGeneration===e.routeGeneration}function m(r,e,t=160){let o=r.trim();if(!o||o.length>t||!se.test(o))throw new TypeError(`[OpenRTC] ${e} is invalid.`);return o}function v(r,e,t=Number.MAX_SAFE_INTEGER){if(!Number.isSafeInteger(r)||r<1||r>t)throw new RangeError(`[OpenRTC] ${e} must be a positive safe integer.`);return r}function pe(r){if(!/^pk_(?:live|test)_[A-Za-z0-9]+$/.test(r.apiKey))throw new TypeError("[OpenRTC] apiKey is invalid.");if(!/^sk_(?:live|test)_[A-Za-z0-9_-]+$/.test(r.secretKey)||r.secretKey.length>128)throw new TypeError("[OpenRTC] secretKey is invalid.");let e=[...r.shardIds].map(t=>m(t,"shardId",80)).sort();if(e.length<1||e.length>64||new Set(e).size!==e.length)throw new RangeError("[OpenRTC] shardIds must contain 1..64 unique identifiers.");if(!isAbsolute(r.stateDirectory))throw new TypeError("[OpenRTC] stateDirectory must be absolute.");return r.maxPeers!==void 0&&v(r.maxPeers,"maxPeers",50),r.startupTimeoutMs!==void 0&&v(r.startupTimeoutMs,"startupTimeoutMs",12e4),{...r,serviceId:m(r.serviceId,"serviceId",80),generation:v(r.generation,"generation"),shardIds:e,deviceId:m(r.deviceId,"deviceId"),deviceName:r.deviceName?.trim()||"OpenRTC Node service"}}async function y(r){try{return await access(r,process.platform==="win32"?constants.F_OK:constants.X_OK),!0}catch{return false}}async function V(r,e,t,o,n){return new Promise((c,i)=>{let a=spawn(r,e,{cwd:t,env:z(n),stdio:["ignore","pipe","pipe"]}),d=Buffer.alloc(0),u=Buffer.alloc(0),l=(p,Y)=>Buffer.concat([p,Y]).subarray(-N);a.stdout.on("data",p=>{d=l(d,p);}),a.stderr.on("data",p=>{u=l(u,p);});let s=setTimeout(()=>{a.kill(),i(new Error(`[OpenRTC] Node host command timed out: ${r}.`));},o);a.once("error",p=>{clearTimeout(s),i(p);}),a.once("exit",p=>{clearTimeout(s),p===0?c(d.toString("utf8")):i(new Error(`[OpenRTC] Node host command failed (${p??"signal"}): ${u.toString("utf8").trim().slice(-4096)}`));});})}async function J(r){let e=r.binaryPath||process.env.OPENRTC_NODE_HOST_BINARY;if(e){if(!isAbsolute(e)||!await y(e))throw new Error("[OpenRTC] Node host binaryPath must name an executable absolute path.");return {command:e,args:[...r.binaryArgs??[]]}}if(r.buildFromSource){let c=r.sourceRoot||process.env.OPENRTC_SOURCE_ROOT;if(!c||!isAbsolute(c))throw new Error("[OpenRTC] buildFromSource requires an absolute sourceRoot or OPENRTC_SOURCE_ROOT.");let i=resolve(c,"crates/openrtc/Cargo.toml"),a=resolve(c,"target");await V("cargo",["build","--locked","--manifest-path",i,"--features","node-host","--bin","openrtc-node-host","--target-dir",a],c,12e4,r.secretKey);let d=resolve(a,"debug",`openrtc-node-host${process.platform==="win32"?".exe":""}`);if(!await y(d))throw new Error("[OpenRTC] local Node host build did not produce an executable.");return {command:d,args:[]}}let t=resolve(dirname(fileURLToPath(import.meta.url)),".."),o=resolve(t,"native",`${process.platform}-${process.arch}`),n=resolve(o,`openrtc-node-host${process.platform==="win32"?".exe":""}`);if(!await y(n))throw new Error(`[OpenRTC] This package has no Node host for ${process.platform}-${process.arch}. Install a supported OpenRTC package, set OPENRTC_NODE_HOST_BINARY, or use buildFromSource with sourceRoot.`);return await le(t,o,n),{command:n,args:[]}}async function X(r,e){let t=await V(r.command,[...r.args,"--protocol-info"],process.cwd(),12e4,e),o=JSON.parse(t);if(o.protocolVersion!==E||o.lifecycleOwner!=="rust-peer-session"||o.maxConfigBytes!==F||o.maxCommandBytes!==U||o.maxApplicationPayloadBytes!==C)throw new Error("[OpenRTC] Node host protocol is incompatible.");return o}var I=class{constructor(e,t,o){this.options=e;this.roomId=t;this.onEvent=o;this.child=null;this.childClosed=Promise.resolve();this.output=Buffer.alloc(0);this.stderr=Buffer.alloc(0);this.pending=new Map;this.writeQueue=Promise.resolve();this.stopped=false;this.closing=null;}async start(){let e=await J(this.options),t=await X(e,this.options.secretKey),o=new Promise((n,c)=>{let i=spawn(e.command,[...e.args],{env:z(this.options.secretKey),stdio:["pipe","pipe","pipe"]});this.child=i,this.childClosed=new Promise(l=>i.once("close",()=>l()));let a,d=setTimeout(()=>{c(this.failure("Node host startup timed out")),i.kill();},this.options.startupTimeoutMs??L),u=l=>{clearTimeout(d);let s=b$3.is(l)?l:this.failure(l.message);this.terminalFailure=a??s,c(s),this.failAll(s);};i.once("error",u),i.stdin.on("error",l=>{u(a??l),i.kill();}),i.stderr.on("data",l=>{this.stderr=Buffer.concat([this.stderr,l]).subarray(-4096);}),i.stdout.on("data",l=>{try{for(let s of this.parse(l)){if(s.type==="failure"){a=this.failure(s.error,s.serviceError),u(a);continue}if(t.testLane&&process.env.OPENRTC_NODE_HOST_LOCAL_TRACE==="1"&&s.type==="connection-state"&&console.error("[openrtc-local-node]",this.options.deviceId,{connectionId:s.snapshot.connectionId,deviceId:s.snapshot.deviceId,state:s.snapshot.state,routable:s.snapshot.routable,transportStableId:s.transportStableId,transportGeneration:s.transportGeneration,routeGeneration:s.routeGeneration}),s.type==="ready"){if(s.protocolVersion!==E||s.roomId!==this.roomId||s.deviceId!==this.options.deviceId||!isDeepStrictEqual(s.testLane,t.testLane))throw new Error("Node host returned inconsistent readiness metadata");clearTimeout(d),n();}this.dispatch(s);}}catch(s){u(s instanceof Error?s:new Error(String(s))),i.kill();}}),i.once("exit",(l,s)=>{clearTimeout(d),this.stopped=true;let p=a??this.failure(`Node host exited (${l??s??"unknown"})`);this.onEvent({type:"host-exit",error:p}),u(p);});});o.catch(()=>{});try{await this.writeLine({protocolVersion:E,apiKey:this.options.apiKey,secretKey:this.options.secretKey,serviceId:this.options.serviceId,generation:this.options.generation,shardIds:this.options.shardIds,deviceId:this.options.deviceId,roomId:this.roomId,deviceName:this.options.deviceName,stateDirectory:this.options.stateDirectory,maxPeers:this.options.maxPeers,irohRelay:this.options.irohRelay!==!1},F),await o;}catch(n){throw this.terminalFailure??n}}async request(e,t){if(!this.child||this.stopped||!this.child.stdin.writable)throw new Error("[OpenRTC] Node host is closed.");if(this.pending.size>=ne)throw new Error("[OpenRTC] Node host has too many pending requests.");let o=randomUUID(),n=new Promise((c,i)=>{let a=setTimeout(()=>{this.pending.delete(o),i(new Error(`[OpenRTC] Node host ${e} response timed out.`));},L);this.pending.set(o,{resolve:c,reject:i,timer:a});});n.catch(()=>{});try{await this.writeLine({type:e,id:o,...t},U);}catch(c){let i=this.pending.get(o);i&&(clearTimeout(i.timer),this.pending.delete(o),i.reject(this.terminalFailure??this.failure(c instanceof Error?c.message:String(c))));}return n}close(){return this.closing??(this.closing=this.stop())}async stop(){if(!this.child)return;let e=this.child;try{this.stopped||await this.request("shutdown",{});}finally{e.stdin.end();let t=setTimeout(()=>e.kill("SIGTERM"),2e3),o=setTimeout(()=>e.kill("SIGKILL"),4e3);try{await this.childClosed;}finally{clearTimeout(t),clearTimeout(o);}}}parse(e){if(this.output=Buffer.concat([this.output,e]),this.output.length>N&&!this.output.includes(10))throw new Error("Node host output line exceeded its byte limit");let t=[];for(;;){let o=this.output.indexOf(10);if(o<0)break;if(o>N)throw new Error("Node host output line exceeded its byte limit");let n=this.output.subarray(0,o).toString("utf8").trim();this.output=this.output.subarray(o+1),n&&t.push(JSON.parse(n));}return t}writeLine(e,t){let o=`${JSON.stringify(e)}
2
+ `;if(Buffer.byteLength(o,"utf8")-1>t)return Promise.reject(new Error("Node host input line exceeded its byte limit"));let n=this.writeQueue.then(()=>new Promise((c,i)=>{if(!this.child||this.stopped||!this.child.stdin.writable){i(new Error("Node host is closed"));return}this.child.stdin.write(o,a=>{a?i(a):c();});}));return this.writeQueue=n.catch(()=>{}),n}dispatch(e){if(e.type!=="response"){this.onEvent(e);return}let t=this.pending.get(e.id);t&&(clearTimeout(t.timer),this.pending.delete(e.id),e.ok?t.resolve(e.value):t.reject(this.failure(e.error||"Node host request failed",e.serviceError)));}failure(e$2,t){let o=a=>a.split(this.options.secretKey).join("[REDACTED]"),n=o(e$2),c=o(this.stderr.toString("utf8")).trim(),i=`[OpenRTC] ${n}.${c?` Host stderr: ${c}`:""}`;if(t&&typeof t=="object"&&!Array.isArray(t)){let a=t,d$1=b$1(a.code);if(d(a.code)||d$1){let u=e(a);return e$1({...u,requestId:u.requestId?o(u.requestId):void 0,code:a.code,retryable:typeof a.retryable=="boolean"?a.retryable:!!d$1,message:i})}}return new Error(i)}failAll(e){for(let t of this.pending.values())clearTimeout(t.timer),t.reject(e);this.pending.clear();}},S=class{constructor(e,t,o,n,c){this.id=e;this.peerId=t;this.host=o;this.nativeGeneration=n;this.capabilityKey=c;this.messages=new Set;this.closeListeners=new Set;this.queued=[];this.isClosed=false;}async send(e){if(this.isClosed)throw new Error("[OpenRTC] Connection is closed.");let t=he(e instanceof Uint8Array||e instanceof ArrayBuffer?e:a$3("raw","message",e,this.capabilityKey));await this.host.request("send",{connectionId:this.id,payloadBase64:t.toString("base64")});}onMessage(e){let t=e;this.messages.add(t);for(let o of this.queued.splice(0))f(t,o);return ()=>this.messages.delete(t)}onClose(e){return this.isClosed?f(e,void 0):this.closeListeners.add(e),()=>this.closeListeners.delete(e)}receive(e){if(!this.isClosed){if(this.messages.size===0){this.queued.length===ie&&this.queued.shift(),this.queued.push(e);return}for(let t of this.messages)f(t,e);}}close(){if(!this.isClosed){this.isClosed=true,this.queued.length=0;for(let e of this.closeListeners)f(e,void 0);this.messages.clear(),this.closeListeners.clear();}}accepts(e){return ue(e,this.nativeGeneration)}replaceGeneration(e){this.nativeGeneration=e;}},T=class{constructor(e,t,o){this.id=e;this.host=t;this.onServiceError=o;this.kind="room";this.listeners=new Set;this.connections=new Map;this.closed=false;}publishAssignment(e){if(this.closed)return Promise.reject(new Error("[OpenRTC] Service room is closed."));let t=(e.priorityDeviceIds??[]).map(n=>m(n,"priorityDeviceId")),o=(e.relevantEntityIds??[]).map(n=>m(n,"relevantEntityId"));return t.length>8||o.length>32||new Set(t).size!==t.length||new Set(o).size!==o.length?Promise.reject(new Error("[OpenRTC] Authority assignment identifiers are invalid.")):this.host.request("publish-assignment",{revision:v(e.revision,"revision"),subjectDeviceId:m(e.subjectDeviceId,"subjectDeviceId"),shardId:m(e.shardId,"shardId",80),priorityDeviceIds:t,relevantEntityIds:o,ttlMs:e.ttlMs===void 0?void 0:v(e.ttlMs,"ttlMs",12e4)})}onConnection(e){this.listeners.add(e);for(let t of this.connections.values())f(e,t);return ()=>this.listeners.delete(e)}project(e){if(this.closed)return;if(e.type==="host-exit"){this.closed=true;for(let d of this.connections.values())d.close();this.connections.clear(),this.listeners.clear();return}if(e.type==="service-error"){let d=e.avenue;if(!d||typeof d!="object"||Array.isArray(d))return;let u=d;if(u.kind!=="room"||u.id!==this.id||typeof e.runtimeInstanceId!="string"||e.runtimeInstanceId.trim().length===0)return;let l=a$2(e.serviceError,{kind:"room",id:this.id});l&&this.onServiceError&&f(()=>{if(!this.closed)return this.onServiceError?.(l)},void 0);return}if(e.type==="peer-message"){let d=this.connections.get(e.connectionId),u=$(e);if(d&&u&&d.accepts(u)){let l=fe(e.payloadBase64),s=b$2(l);s?s.capability===`room:${this.id}`&&s.kind==="raw"&&d.receive(s.value):d.receive(l);}return}if(e.type!=="connection-state")return;let t=e.snapshot,o=$(e);if(typeof t.connectionId!="string"||!o)return;let n=this.connections.get(t.connectionId);if(typeof t.state=="string"&&["closed","failed"].includes(t.state.toLowerCase())){n?.accepts(o)&&(n.close(),this.connections.delete(t.connectionId));return}if(n){t.routable===true&&n.replaceGeneration(o);return}let i=typeof t.remoteNodeId=="string"?t.remoteNodeId:null;if(t.routable!==true||!i)return;let a=new S(t.connectionId,i,this.host,o,`room:${this.id}`);this.connections.set(a.id,a);for(let d of this.listeners)f(d,a);}async close(){if(this.closed)return this.host.close();this.closed=true;for(let e of this.connections.values())e.close();this.connections.clear(),this.listeners.clear(),await this.host.close();}};function he(r){let e;if(r instanceof Uint8Array)e=Buffer.from(r);else if(r instanceof ArrayBuffer)e=Buffer.from(r);else if(typeof r=="string")e=Buffer.from(r,"utf8");else {let t=JSON.stringify(r);if(t===void 0)throw new TypeError("[OpenRTC] Message must be a string, bytes, or JSON value.");e=Buffer.from(t,"utf8");}if(e.length>C)throw new RangeError("[OpenRTC] Message exceeds the Node host payload limit.");return e}function fe(r){let e=Buffer.from(r,"base64");if(e.length>C)throw new Error("[OpenRTC] Node host returned an oversized application payload.");try{let t=new TextDecoder("utf-8",{fatal:!0}).decode(e);try{return JSON.parse(t)}catch{return t}}catch{return new Uint8Array(e)}}var b=class{constructor(e){this.listeners=new Set;this.roomPromise=null;this.roomId=null;this.closed=false;this.closing=null;this.options=pe(e);}onConnection(e){if(this.closed)throw new Error("[OpenRTC] ServiceNode is closed.");return this.listeners.add(e),()=>this.listeners.delete(e)}listen(e){return this.closed?Promise.reject(new Error("[OpenRTC] ServiceNode is closed.")):(e=m(e,"roomId"),this.roomId&&this.roomId!==e?Promise.reject(new Error("[OpenRTC] A Node ServiceNode owns exactly one room.")):this.roomPromise?this.roomPromise:(this.roomId=e,this.roomPromise=this.open(e),this.roomPromise))}close(){return this.closing??(this.closing=this.stop())}async stop(){this.closed=true,await(await this.roomPromise?.catch(()=>null))?.close(),this.listeners.clear();}async open(e){let t,o=new I(this.options,e,n=>t?.project(n));t=new T(e,o,this.options.onServiceError);try{return await o.start(),t.onConnection(n=>{for(let c of this.listeners)f(c,{room:t,connection:n});}),t}catch(n){throw await o.close().catch(()=>{}),this.roomPromise=null,this.roomId=null,n}}};async function me(r){let e=await J(r);return X(e)}function ke(r,e){let t=c(e,"openrtc/node"),o=new a;return i(r,{platform:"native",broadcastHostFactory:async n=>{let{NativeManagedBroadcastHost:c}=await import('./NativeManagedBroadcastHost-6A2QP3A7.js');return new c(t,n)},offlineSupport:()=>t.invoke("openrtc_offline_runtime_support"),createOfflineEnrollmentRequest:async n=>{let c=await t.invoke("start_iroh_node");return t.invoke("openrtc_create_offline_enrollment_request",{trustDomain:n.trustDomain,deviceId:n.deviceId,endpointId:c,enrollmentNonce:crypto.randomUUID(),requestedRoles:n.requestedRoles})},close:()=>o.close(),deviceKeyProvider:a$1(t),deviceIdProvider:async()=>{let n=await t.invoke("get_rtc_local_device_info");return String(n?.deviceId??"")},runtimeFactory:async n=>{let{createIpcClient:c}=await import('./ipcFactory-F75IXEIE.js');return c(n,t,o)}})}export{ke as OpenRTC,b as ServiceNode,me as inspectNodeHost};
Binary file
@@ -1 +1 @@
1
- import {h,e,g,f}from'./chunk-QL4CJCV4.js';import'./chunk-FKAQDDUM.js';import {b}from'./chunk-ZA44REGI.js';import'./chunk-PW2WEI6L.js';import {a}from'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';function D(r){let e=r.architecture??(r.advancedFanout===true?"sparse":"auto");if(r.advancedFanout===true&&e!=="sparse")throw new Error("[OpenRTC] advancedFanout conflicts with architecture; use architecture: sparse only.");return {architecture:e,delivery:r.payload??(r.advancedFanout===true?"latest-state":"reliable")}}var R=class{constructor(e){this.mode=e==="sparse"?"sparse":"direct";}create(e){return new w(e,()=>this.mode)}setArchitecture(e){e.phase==="settled"&&(this.mode=e.effective==="sparse"?"sparse":e.effective==="managed"?"managed":"direct");}},w=class{constructor(e,t){this.host=e;this.mode=t;this.stateSenders=new Map;this.sparseForwardQueue=[];this.sparseForwardRunning=false;this.sparseForwardQueueDropsPending=0;this.sparseForwardDropReport=null;this.closed=false;let i=e.client.advanced.runtime.onManagedRoomMessage;this.stopManagedMessage=typeof i=="function"?i.call(e.client.advanced.runtime,o=>{e.deliver(o.senderId,o.payload,o.channel);}):()=>{};}isSparse(){return this.mode()==="sparse"}publishState(e,t){if(this.mode()!=="managed")return false;let i=this.stateSenders.get(e);return i||(i=new a(o=>this.publishManaged(e,o)),this.stateSenders.set(e,i)),i.send(t).catch(()=>{}),true}async sendChannel(e,t){let i=this.mode();if(i==="managed")return await this.publishManaged(e,t),true;if(i!=="sparse")return false;let o=this.host.connections();if(o.length===0)return true;let a=await this.host.client.advanced.runtime.encodeSparseFanoutMessage(this.host.capabilityKey,t);return await Promise.all(o.map(n=>n.send(a))),true}assertTargetedSendAllowed(){if(this.mode()==="managed")throw new Error("[OpenRTC] Targeted messages are not available in managed fanout rooms; use authority mode for targeted request semantics.")}receive(e,t,i){return this.mode()!=="sparse"?false:(i instanceof Uint8Array&&this.receiveSparseBroadcast(e,t,i),true)}close(){if(!this.closed){this.closed=true,this.stopManagedMessage();for(let e of this.stateSenders.values())e.close();this.stateSenders.clear(),this.sparseForwardQueue.length=0;}}publishManaged(e,t){return this.host.client.advanced.runtime.publishManagedRoomMessage({messageId:crypto.randomUUID(),channel:e,priority:1,payload:t})}async receiveSparseBroadcast(e,t,i){let o;try{o=await this.host.client.advanced.runtime.acceptSparseFanoutMessage(this.host.capabilityKey,t,i);}catch{return}if(o.forward){let a=Number.isSafeInteger(o.forwardPeerLimit)&&o.forwardPeerLimit>0?o.forwardPeerLimit:0,n=Number.isSafeInteger(o.forwardQueueCapacity)&&o.forwardQueueCapacity>0?Math.min(o.forwardQueueCapacity,64):0,d=new Set(Array.isArray(o.forwardPeerIds)?o.forwardPeerIds.slice(0,a):[]),s=this.host.connections().filter(u=>u.id!==e.id).filter(u=>d.has(u.remoteNodeId)).slice(0,a);this.enqueueSparseForward(o.forward,s,n);}this.host.deliver(o.authorDeviceId,o.payload);}enqueueSparseForward(e,t,i){if(i===0||t.length===0||this.closed)return;if(this.sparseForwardQueue.length+(this.sparseForwardRunning?1:0)>=i){this.sparseForwardQueueDropsPending+=1,this.flushSparseForwardDropReport();return}this.sparseForwardQueue.push({payload:e,targets:t}),this.sparseForwardRunning||this.drainSparseForwardQueue();}async drainSparseForwardQueue(){if(!this.sparseForwardRunning){this.sparseForwardRunning=true;try{for(;!this.closed;){let e=this.sparseForwardQueue.shift();if(!e)break;await Promise.allSettled(e.targets.map(t=>t.send(e.payload)));}}finally{this.sparseForwardRunning=false,!this.closed&&this.sparseForwardQueue.length>0&&this.drainSparseForwardQueue();}}}flushSparseForwardDropReport(){if(this.sparseForwardDropReport||this.sparseForwardQueueDropsPending===0)return;let e=this.sparseForwardQueueDropsPending;this.sparseForwardQueueDropsPending=0,this.sparseForwardDropReport=this.host.client.advanced.runtime.recordSparseFanoutForwardQueueDrop(this.host.capabilityKey,e).catch(()=>{}).finally(()=>{this.sparseForwardDropReport=null,this.flushSparseForwardDropReport();});}};function F(r){return Object.freeze(r.filter(e=>!!(e.deviceId||e.nodeId)).map(e=>Object.freeze({deviceId:e.deviceId||e.nodeId,...e.nodeId?{nodeId:e.nodeId}:{},...typeof e.userId=="string"?{userId:e.userId}:{},...Number.isFinite(e.joinedAt)?{joinedAt:e.joinedAt}:{}})))}var y=class extends h{constructor(t,i,o,a,n,d="auto"){let s=new R(d);super("room",t,i,o,s);this.membership=a;this.onLeave=n;this.kind="room";this.left=false;this.memberWatches=new Map;this.members={list:async()=>{if(this.closed)return [];let t=await this.client.rooms.members(this.id);return this.closed?[]:F(t)},watch:t=>{if(this.closed)return t([]),()=>{};let i=true,o=this.client.rooms.watch(this.id,n=>{i&&!this.closed&&t(F(n));}),a=()=>{i&&(i=false,this.memberWatches.delete(a),o());};return this.memberWatches.set(a,t),a}};this.architectureListeners=new Set;this.authorityAssignmentSnapshot=null;this.authorityAssignmentListeners=new Set;this.architectureSnapshot=Q(d);let u=i.advanced.runtime.onRoomArchitectureChange;this.stopArchitecture=typeof u=="function"?u.call(i.advanced.runtime,c=>{if(!(c.epoch<this.architectureSnapshot.epoch)){this.architectureSnapshot=Object.freeze({...c}),this.setArchitecture(c);for(let h of this.architectureListeners)h(this.architectureSnapshot);}}):()=>{};let l=i.advanced.runtime.onRoomAuthorityAssignmentChange;this.stopAuthorityAssignment=typeof l=="function"?l.call(i.advanced.runtime,c=>{this.authorityAssignmentSnapshot=c?E(c):null;for(let h of this.authorityAssignmentListeners)h(M(this.authorityAssignmentSnapshot));}):()=>{};}architecture(){return {...this.architectureSnapshot}}onArchitectureChanged(t){return this.architectureListeners.add(t),t(this.architecture()),()=>this.architectureListeners.delete(t)}authorityAssignment(){return M(this.authorityAssignmentSnapshot)}onAuthorityAssignmentChanged(t){return this.authorityAssignmentListeners.add(t),t(this.authorityAssignment()),()=>this.authorityAssignmentListeners.delete(t)}async leave(){this.left||(this.left=true,await this.onLeave?.()),await this.close();}async close(){this.fenceProductAccess();let t=[...this.memberWatches];this.memberWatches.clear();for(let[i,o]of t)i(),o([]);this.stopArchitecture(),this.stopAuthorityAssignment(),this.architectureListeners.clear(),this.authorityAssignmentListeners.clear(),await super.close();}};async function j(r,e$1,t){r.assertOpen();let i=e(e$1),o=t.access??"capability",{architecture:a,delivery:n}=D(t);return r.activateOnce(`room:${i}`,JSON.stringify({access:o,membership:t.membership??"ephemeral",identity:t.identity??null,maxPeers:t.maxPeers??null,payload:n,architecture:a,advancedFanout:t.advancedFanout===true}),o==="authenticated"?t.auth??r.options.auth:void 0,()=>x(r,i,t,a,n))}async function x(r,e,t,i,o){let a=t.membership??"ephemeral",n=t.access??"capability";if(i==="sparse"&&o!=="latest-state")throw new Error("[OpenRTC] Sparse rooms require payload: latest-state.");if(a==="durable"&&n!=="authenticated")throw new Error("[OpenRTC] Durable room membership requires access: authenticated.");if(t.identity==="session"&&n!=="capability")throw new Error("[OpenRTC] Session room identity requires access: capability.");if(n==="authenticated"){let h=t.auth??r.options.auth;if(!h)throw new Error("[OpenRTC] Authenticated rooms require an auth provider.");let A=await r.deviceId(),v=await r.controlPlane(),m=await v.deviceCertificate(h,A,{kind:"room",id:e});a==="durable"&&await v.durableRoomMembership(m.source,e,"join");let f;try{f=await r.activate({kind:"room",id:e,source:m.source,principalId:m.principalId,deviceId:A,maxPeers:t.maxPeers,autoConnect:!0,durableMembership:a==="durable",advancedFanout:t.advancedFanout,architecture:i,defaultDelivery:o});}catch(O){throw a==="durable"&&await v.durableRoomMembership(m.source,e,"leave").catch(()=>{}),O}let g;return g=new y(e,f,()=>{r.channels.detach(f),r.onClosed(g);},a,a==="durable"?async()=>{await v.durableRoomMembership(m.source,e,"leave");}:void 0,i),r.trackHandle(g)}let d=await(t.identity==="session"?r.sessionPlane():r.controlPlane()),s=await d.capability("room",e,t.maxPeers,t.advancedFanout,i,o),u=String(b(s.token).principalId),l=await r.activate({kind:"room",id:e,source:s,principalId:u,deviceId:g(s),maxPeers:t.maxPeers,autoConnect:true,advancedFanout:t.advancedFanout,architecture:i,defaultDelivery:o,controlPlane:d}),c;return c=new y(e,l,()=>{r.channels.detach(l),r.onClosed(c);},"ephemeral",void 0,i),r.trackHandle(c)}function z(r,e$1){r.assertOpen();let t=e(e$1.roomId),i=e(e$1.serviceId),o=f(e$1.deviceId);if(!Number.isSafeInteger(e$1.generation)||e$1.generation<1)throw new Error("[OpenRTC] Authority service generation is invalid.");let a=[...e$1.shardIds].map(e).sort();if(a.length<1||a.length>64||new Set(a).size!==a.length)throw new Error("[OpenRTC] Authority service shards are invalid.");if(!/^[A-Za-z0-9_-]{43}$/.test(e$1.devicePublicKeyX))throw new Error("[OpenRTC] Authority service device public key is invalid.");if(!/^[A-Za-z0-9_-]{43}$/.test(e$1.assignmentPublicKeyX))throw new Error("[OpenRTC] Authority assignment public key is invalid.");if(e$1.maxPeers!==void 0&&(!Number.isSafeInteger(e$1.maxPeers)||e$1.maxPeers<1||e$1.maxPeers>50))throw new Error("[OpenRTC] Authority service maxPeers must be within 1..50.");return r.activateOnce(`room:${t}`,JSON.stringify({architecture:"authority",serviceId:i,generation:e$1.generation,shardIds:a,deviceId:o,maxPeers:e$1.maxPeers??null,irohRelay:e$1.irohRelay,devicePublicKeyX:e$1.devicePublicKeyX,assignmentPublicKeyX:e$1.assignmentPublicKeyX,deviceSignerId:r.authorityCallableId(e$1.deviceSign),grantProviderId:r.authorityCallableId(e$1.grantProvider)}),void 0,async()=>{let n={type:"capability",token:"",avenue:{kind:"room",id:t},expiresAtMs:Number.MAX_SAFE_INTEGER,irohRelay:e$1.irohRelay,managedTurn:false},d=await r.activate({kind:"room",id:t,source:n,principalId:i,deviceId:o,maxPeers:e$1.maxPeers,autoConnect:true,architecture:"authority",defaultDelivery:"reliable",authority:{serviceId:i,generation:e$1.generation,shardIds:a,deviceId:o,irohRelay:e$1.irohRelay,devicePublicKeyX:e$1.devicePublicKeyX,assignmentPublicKeyX:e$1.assignmentPublicKeyX,deviceSign:e$1.deviceSign,grantProvider:e$1.grantProvider}}),s;return s=new y(t,d,()=>{r.channels.detach(d),r.onClosed(s);},"ephemeral",void 0,"authority"),r.trackHandle(s)})}function E(r){return Object.freeze({...r,priorityDeviceIds:Object.freeze([...r.priorityDeviceIds]),relevantEntityIds:Object.freeze([...r.relevantEntityIds])})}function M(r){return r?{...r,priorityDeviceIds:[...r.priorityDeviceIds],relevantEntityIds:[...r.relevantEntityIds]}:null}function Q(r){return {requested:r,effective:r==="sparse"?"sparse":"mesh",epoch:0,phase:r==="mesh"||r==="sparse"?"settled":"preparing",reason:r==="auto"?"size":"manual"}}export{y as RoomHandle,j as joinRoom,z as openAuthorityRoom,D as resolveRoomJoinOptions};
1
+ import {h,e,g,f}from'./chunk-5LNRJE6L.js';import'./chunk-FKAQDDUM.js';import'./chunk-RLPWFHOY.js';import {a}from'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import {b}from'./chunk-ZA44REGI.js';import'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';function D(r){let e=r.architecture??(r.advancedFanout===true?"sparse":"auto");if(r.advancedFanout===true&&e!=="sparse")throw new Error("[OpenRTC] advancedFanout conflicts with architecture; use architecture: sparse only.");return {architecture:e,delivery:r.payload??(r.advancedFanout===true?"latest-state":"reliable")}}var R=class{constructor(e){this.mode=e==="sparse"?"sparse":"direct";}create(e){return new w(e,()=>this.mode)}setArchitecture(e){e.phase==="settled"&&(this.mode=e.effective==="sparse"?"sparse":e.effective==="managed"?"managed":"direct");}},w=class{constructor(e,t){this.host=e;this.mode=t;this.stateSenders=new Map;this.sparseForwardQueue=[];this.sparseForwardRunning=false;this.sparseForwardQueueDropsPending=0;this.sparseForwardDropReport=null;this.closed=false;let i=e.client.advanced.runtime.onManagedRoomMessage;this.stopManagedMessage=typeof i=="function"?i.call(e.client.advanced.runtime,o=>{e.deliver(o.senderId,o.payload,o.channel);}):()=>{};}isSparse(){return this.mode()==="sparse"}publishState(e,t){if(this.mode()!=="managed")return false;let i=this.stateSenders.get(e);return i||(i=new a(o=>this.publishManaged(e,o)),this.stateSenders.set(e,i)),i.send(t).catch(()=>{}),true}async sendChannel(e,t){let i=this.mode();if(i==="managed")return await this.publishManaged(e,t),true;if(i!=="sparse")return false;let o=this.host.connections();if(o.length===0)return true;let a=await this.host.client.advanced.runtime.encodeSparseFanoutMessage(this.host.capabilityKey,t);return await Promise.all(o.map(n=>n.send(a))),true}assertTargetedSendAllowed(){if(this.mode()==="managed")throw new Error("[OpenRTC] Targeted messages are not available in managed fanout rooms; use authority mode for targeted request semantics.")}receive(e,t,i){return this.mode()!=="sparse"?false:(i instanceof Uint8Array&&this.receiveSparseBroadcast(e,t,i),true)}close(){if(!this.closed){this.closed=true,this.stopManagedMessage();for(let e of this.stateSenders.values())e.close();this.stateSenders.clear(),this.sparseForwardQueue.length=0;}}publishManaged(e,t){return this.host.client.advanced.runtime.publishManagedRoomMessage({messageId:crypto.randomUUID(),channel:e,priority:1,payload:t})}async receiveSparseBroadcast(e,t,i){let o;try{o=await this.host.client.advanced.runtime.acceptSparseFanoutMessage(this.host.capabilityKey,t,i);}catch{return}if(o.forward){let a=Number.isSafeInteger(o.forwardPeerLimit)&&o.forwardPeerLimit>0?o.forwardPeerLimit:0,n=Number.isSafeInteger(o.forwardQueueCapacity)&&o.forwardQueueCapacity>0?Math.min(o.forwardQueueCapacity,64):0,d=new Set(Array.isArray(o.forwardPeerIds)?o.forwardPeerIds.slice(0,a):[]),s=this.host.connections().filter(u=>u.id!==e.id).filter(u=>d.has(u.remoteNodeId)).slice(0,a);this.enqueueSparseForward(o.forward,s,n);}this.host.deliver(o.authorDeviceId,o.payload);}enqueueSparseForward(e,t,i){if(i===0||t.length===0||this.closed)return;if(this.sparseForwardQueue.length+(this.sparseForwardRunning?1:0)>=i){this.sparseForwardQueueDropsPending+=1,this.flushSparseForwardDropReport();return}this.sparseForwardQueue.push({payload:e,targets:t}),this.sparseForwardRunning||this.drainSparseForwardQueue();}async drainSparseForwardQueue(){if(!this.sparseForwardRunning){this.sparseForwardRunning=true;try{for(;!this.closed;){let e=this.sparseForwardQueue.shift();if(!e)break;await Promise.allSettled(e.targets.map(t=>t.send(e.payload)));}}finally{this.sparseForwardRunning=false,!this.closed&&this.sparseForwardQueue.length>0&&this.drainSparseForwardQueue();}}}flushSparseForwardDropReport(){if(this.sparseForwardDropReport||this.sparseForwardQueueDropsPending===0)return;let e=this.sparseForwardQueueDropsPending;this.sparseForwardQueueDropsPending=0,this.sparseForwardDropReport=this.host.client.advanced.runtime.recordSparseFanoutForwardQueueDrop(this.host.capabilityKey,e).catch(()=>{}).finally(()=>{this.sparseForwardDropReport=null,this.flushSparseForwardDropReport();});}};function F(r){return Object.freeze(r.filter(e=>!!(e.deviceId||e.nodeId)).map(e=>Object.freeze({deviceId:e.deviceId||e.nodeId,...e.nodeId?{nodeId:e.nodeId}:{},...typeof e.userId=="string"?{userId:e.userId}:{},...Number.isFinite(e.joinedAt)?{joinedAt:e.joinedAt}:{}})))}var y=class extends h{constructor(t,i,o,a,n,d="auto"){let s=new R(d);super("room",t,i,o,s);this.membership=a;this.onLeave=n;this.kind="room";this.left=false;this.memberWatches=new Map;this.members={list:async()=>{if(this.closed)return [];let t=await this.client.rooms.members(this.id);return this.closed?[]:F(t)},watch:t=>{if(this.closed)return t([]),()=>{};let i=true,o=this.client.rooms.watch(this.id,n=>{i&&!this.closed&&t(F(n));}),a=()=>{i&&(i=false,this.memberWatches.delete(a),o());};return this.memberWatches.set(a,t),a}};this.architectureListeners=new Set;this.authorityAssignmentSnapshot=null;this.authorityAssignmentListeners=new Set;this.architectureSnapshot=Q(d);let u=i.advanced.runtime.onRoomArchitectureChange;this.stopArchitecture=typeof u=="function"?u.call(i.advanced.runtime,c=>{if(!(c.epoch<this.architectureSnapshot.epoch)){this.architectureSnapshot=Object.freeze({...c}),this.setArchitecture(c);for(let h of this.architectureListeners)h(this.architectureSnapshot);}}):()=>{};let l=i.advanced.runtime.onRoomAuthorityAssignmentChange;this.stopAuthorityAssignment=typeof l=="function"?l.call(i.advanced.runtime,c=>{this.authorityAssignmentSnapshot=c?E(c):null;for(let h of this.authorityAssignmentListeners)h(M(this.authorityAssignmentSnapshot));}):()=>{};}architecture(){return {...this.architectureSnapshot}}onArchitectureChanged(t){return this.architectureListeners.add(t),t(this.architecture()),()=>this.architectureListeners.delete(t)}authorityAssignment(){return M(this.authorityAssignmentSnapshot)}onAuthorityAssignmentChanged(t){return this.authorityAssignmentListeners.add(t),t(this.authorityAssignment()),()=>this.authorityAssignmentListeners.delete(t)}async leave(){this.left||(this.left=true,await this.onLeave?.()),await this.close();}async close(){this.fenceProductAccess();let t=[...this.memberWatches];this.memberWatches.clear();for(let[i,o]of t)i(),o([]);this.stopArchitecture(),this.stopAuthorityAssignment(),this.architectureListeners.clear(),this.authorityAssignmentListeners.clear(),await super.close();}};async function j(r,e$1,t){r.assertOpen();let i=e(e$1),o=t.access??"capability",{architecture:a,delivery:n}=D(t);return r.activateOnce(`room:${i}`,JSON.stringify({access:o,membership:t.membership??"ephemeral",identity:t.identity??null,maxPeers:t.maxPeers??null,payload:n,architecture:a,advancedFanout:t.advancedFanout===true}),o==="authenticated"?t.auth??r.options.auth:void 0,()=>x(r,i,t,a,n))}async function x(r,e,t,i,o){let a=t.membership??"ephemeral",n=t.access??"capability";if(i==="sparse"&&o!=="latest-state")throw new Error("[OpenRTC] Sparse rooms require payload: latest-state.");if(a==="durable"&&n!=="authenticated")throw new Error("[OpenRTC] Durable room membership requires access: authenticated.");if(t.identity==="session"&&n!=="capability")throw new Error("[OpenRTC] Session room identity requires access: capability.");if(n==="authenticated"){let h=t.auth??r.options.auth;if(!h)throw new Error("[OpenRTC] Authenticated rooms require an auth provider.");let A=await r.deviceId(),v=await r.controlPlane(),m=await v.deviceCertificate(h,A,{kind:"room",id:e});a==="durable"&&await v.durableRoomMembership(m.source,e,"join");let f;try{f=await r.activate({kind:"room",id:e,source:m.source,principalId:m.principalId,deviceId:A,maxPeers:t.maxPeers,autoConnect:!0,durableMembership:a==="durable",advancedFanout:t.advancedFanout,architecture:i,defaultDelivery:o});}catch(O){throw a==="durable"&&await v.durableRoomMembership(m.source,e,"leave").catch(()=>{}),O}let g;return g=new y(e,f,()=>{r.channels.detach(f),r.onClosed(g);},a,a==="durable"?async()=>{await v.durableRoomMembership(m.source,e,"leave");}:void 0,i),r.trackHandle(g)}let d=await(t.identity==="session"?r.sessionPlane():r.controlPlane()),s=await d.capability("room",e,t.maxPeers,t.advancedFanout,i,o),u=String(b(s.token).principalId),l=await r.activate({kind:"room",id:e,source:s,principalId:u,deviceId:g(s),maxPeers:t.maxPeers,autoConnect:true,advancedFanout:t.advancedFanout,architecture:i,defaultDelivery:o,controlPlane:d}),c;return c=new y(e,l,()=>{r.channels.detach(l),r.onClosed(c);},"ephemeral",void 0,i),r.trackHandle(c)}function z(r,e$1){r.assertOpen();let t=e(e$1.roomId),i=e(e$1.serviceId),o=f(e$1.deviceId);if(!Number.isSafeInteger(e$1.generation)||e$1.generation<1)throw new Error("[OpenRTC] Authority service generation is invalid.");let a=[...e$1.shardIds].map(e).sort();if(a.length<1||a.length>64||new Set(a).size!==a.length)throw new Error("[OpenRTC] Authority service shards are invalid.");if(!/^[A-Za-z0-9_-]{43}$/.test(e$1.devicePublicKeyX))throw new Error("[OpenRTC] Authority service device public key is invalid.");if(!/^[A-Za-z0-9_-]{43}$/.test(e$1.assignmentPublicKeyX))throw new Error("[OpenRTC] Authority assignment public key is invalid.");if(e$1.maxPeers!==void 0&&(!Number.isSafeInteger(e$1.maxPeers)||e$1.maxPeers<1||e$1.maxPeers>50))throw new Error("[OpenRTC] Authority service maxPeers must be within 1..50.");return r.activateOnce(`room:${t}`,JSON.stringify({architecture:"authority",serviceId:i,generation:e$1.generation,shardIds:a,deviceId:o,maxPeers:e$1.maxPeers??null,irohRelay:e$1.irohRelay,devicePublicKeyX:e$1.devicePublicKeyX,assignmentPublicKeyX:e$1.assignmentPublicKeyX,deviceSignerId:r.authorityCallableId(e$1.deviceSign),grantProviderId:r.authorityCallableId(e$1.grantProvider)}),void 0,async()=>{let n={type:"capability",token:"",avenue:{kind:"room",id:t},expiresAtMs:Number.MAX_SAFE_INTEGER,irohRelay:e$1.irohRelay,managedTurn:false},d=await r.activate({kind:"room",id:t,source:n,principalId:i,deviceId:o,maxPeers:e$1.maxPeers,autoConnect:true,architecture:"authority",defaultDelivery:"reliable",authority:{serviceId:i,generation:e$1.generation,shardIds:a,deviceId:o,irohRelay:e$1.irohRelay,devicePublicKeyX:e$1.devicePublicKeyX,assignmentPublicKeyX:e$1.assignmentPublicKeyX,deviceSign:e$1.deviceSign,grantProvider:e$1.grantProvider}}),s;return s=new y(t,d,()=>{r.channels.detach(d),r.onClosed(s);},"ephemeral",void 0,"authority"),r.trackHandle(s)})}function E(r){return Object.freeze({...r,priorityDeviceIds:Object.freeze([...r.priorityDeviceIds]),relevantEntityIds:Object.freeze([...r.relevantEntityIds])})}function M(r){return r?{...r,priorityDeviceIds:[...r.priorityDeviceIds],relevantEntityIds:[...r.relevantEntityIds]}:null}function Q(r){return {requested:r,effective:r==="sparse"?"sparse":"mesh",epoch:0,phase:r==="mesh"||r==="sparse"?"settled":"preparing",reason:r==="auto"?"size":"manual"}}export{y as RoomHandle,j as joinRoom,z as openAuthorityRoom,D as resolveRoomJoinOptions};
@@ -1 +1 @@
1
- import {b}from'../chunk-HL3TV2QA.js';import'../chunk-AYHD4X2R.js';import {a}from'../chunk-TFOFTLTV.js';import'../chunk-UCNK7KB6.js';import'../chunk-L4HWDDXL.js';import'../chunk-OT7IPLZE.js';import'../chunk-OWKAJPOI.js';import'../chunk-TPF643LU.js';import'../chunk-L2ZZXECX.js';import'../chunk-CCCYE3XN.js';import'../chunk-JPBW67B3.js';import'../chunk-L7N4T2PX.js';import'../chunk-72MN7BNQ.js';import'../chunk-2GX6GB6L.js';var n=class extends a{constructor(e){super(new b(e));}setWasmClient(e){this.unwrap().setWasmClient(e);}};export{n as WasmRuntimeAdapter};
1
+ import {b}from'../chunk-5LO6PLWZ.js';import'../chunk-AYHD4X2R.js';import {a}from'../chunk-CQHLD52E.js';import'../chunk-LCJQ7RSR.js';import'../chunk-FPJAUAEU.js';import'../chunk-L4HWDDXL.js';import'../chunk-FNCEVW7G.js';import'../chunk-LB27VQRL.js';import'../chunk-OWKAJPOI.js';import'../chunk-TPF643LU.js';import'../chunk-L2ZZXECX.js';import'../chunk-CCCYE3XN.js';import'../chunk-JPBW67B3.js';import'../chunk-ZA44REGI.js';import'../chunk-L7N4T2PX.js';import'../chunk-72MN7BNQ.js';import'../chunk-2GX6GB6L.js';var n=class extends a{constructor(e){super(new b(e));}setWasmClient(e){this.unwrap().setWasmClient(e);}};export{n as WasmRuntimeAdapter};
@@ -1 +1 @@
1
- import {a as a$2}from'../chunk-XTMFYAIJ.js';import {t}from'../chunk-K32BROMJ.js';import'../chunk-IXQ4KWGP.js';import'../chunk-TFOFTLTV.js';import'../chunk-UCNK7KB6.js';import {a as a$1}from'../chunk-L4HWDDXL.js';import'../chunk-TYZS5LXQ.js';import'../chunk-OT7IPLZE.js';import'../chunk-OWKAJPOI.js';import {a}from'../chunk-XXZEDZUU.js';import'../chunk-TPF643LU.js';import'../chunk-72NEEJQG.js';import'../chunk-L2ZZXECX.js';import'../chunk-IUU6JCLK.js';import'../chunk-CCCYE3XN.js';import'../chunk-JPBW67B3.js';import'../chunk-L7N4T2PX.js';import'../chunk-72MN7BNQ.js';import'../chunk-2GX6GB6L.js';async function l(e){let t=a$1(e),{WasmBridge:o}=await import('../WasmBridge-L76OAD5U.js');return a$2(t,new o(t))}function y(e,t$1,o=new a){let m=a$1(e);return a$2(m,new t({...m,bridge:t$1,projectionBroker:o}))}export{y as createIpcClient,l as createWasmClient};
1
+ import {a as a$2}from'../chunk-VARKDQGM.js';import {t}from'../chunk-SADNIMUO.js';import'../chunk-IXQ4KWGP.js';import'../chunk-CQHLD52E.js';import'../chunk-LCJQ7RSR.js';import'../chunk-FPJAUAEU.js';import {a as a$1}from'../chunk-L4HWDDXL.js';import'../chunk-2AAZFBRZ.js';import'../chunk-FNCEVW7G.js';import'../chunk-LB27VQRL.js';import'../chunk-OWKAJPOI.js';import {a}from'../chunk-XXZEDZUU.js';import'../chunk-TPF643LU.js';import'../chunk-72NEEJQG.js';import'../chunk-L2ZZXECX.js';import'../chunk-IUU6JCLK.js';import'../chunk-CCCYE3XN.js';import'../chunk-JPBW67B3.js';import'../chunk-ZA44REGI.js';import'../chunk-L7N4T2PX.js';import'../chunk-72MN7BNQ.js';import'../chunk-2GX6GB6L.js';async function l(e){let t=a$1(e),{WasmBridge:o}=await import('../WasmBridge-CJNESUGJ.js');return a$2(t,new o(t))}function y(e,t$1,o=new a){let m=a$1(e);return a$2(m,new t({...m,bridge:t$1,projectionBroker:o}))}export{y as createIpcClient,l as createWasmClient};
@@ -1,7 +1,7 @@
1
1
  import { a as PeerReconciliationStats } from '../assembly-DGrOqsLW.js';
2
2
  export { D as ConnectionActor, d as ConnectionActorError, e as ConnectionActorErrorKind, f as ConnectionActorKey, g as ConnectionActorOptions, h as ConnectionActorState, i as ConnectionActors, j as ConnectionClose, k as ConnectionDial, l as LogicalChannel, P as PolicySnapshot, m as PreferredTransport, n as RUNTIME_POLICY, R as RuntimeClient, o as connectionActorKey, p as connectionActorKeyString, q as getRuntimePolicy } from '../assembly-DGrOqsLW.js';
3
3
  import { h as Client$1 } from '../coreClient-ByXs38IP.js';
4
- import { c as Avenue } from '../types-YGlXXpQA.js';
4
+ import { c as Avenue } from '../types-Cruu-MsF.js';
5
5
  import { aI as SignalingOptions, Z as ISignalingBackend, _ as RuntimeIdentity, $ as RoomMember, a3 as SignalingEnvelope, a6 as SignalingSession, a0 as Device, a5 as DesiredPeerProjection, ak as BackendConnectionState, n as PeerSessionSnapshot, aF as AppLimits, N as GrantScope, m as Connection, aJ as JoinRoomOptions, aK as ChannelMetadata, az as CryptoStreams, aL as RoomCreationMode, X as ClientOptions, ay as PayloadCrypto, U as DiscoveryMode, aM as ProtocolCapabilityMap, aN as ScanningLoopOptions, aO as ScanningLoopHandle, aP as RuntimeBootstrapOptions, aQ as RuntimeBootstrapResult, aR as ApplicationPayloadReadinessOptions, aS as ManagedApplicationRouteOptions, aT as PeerState, aU as PeerScope, aV as PeerHealth, aW as ChannelDescriptor, aX as JoinRequest, ai as NativeConnectParams, aj as NativeConnectResult, aG as ConnectionTarget, H as RawConnection } from '../Connection-BGVBMbWg.js';
6
6
  export { aY as AutoConnectPolicy, aq as BrowserProtocolStore, C as ChannelDescriptor, aZ as ChannelFraming, x as ConnectionEvent, v as ConnectionState, a_ as ConnectionStatus, z as DeviceConnectOptions, a$ as DevicePresence, G as DeviceProfile, D as DeviceStatus, I as IncomingStream, at as IrohDocEntry, as as IrohMutationReceipt, J as JoinRoomOptions, L as LocalDeviceInfo, M as ManagedOptions, y as ManagedSession, ar as NamespaceDescriptor, b0 as PayloadRouteOptions, l as PeerConnectOptions, b1 as PeerLifecycleStatus, o as PeerReadiness, b2 as PeerSessionSnapshot, r as PeerStreamOptions, ag as PortableMediaChunk, ah as PortableMediaControl, ae as PortableMediaPublicationStart, ad as PortableMediaPublish, af as PortableMediaSample, aH as PresenceLoopOptions, b3 as PresencePolicy, w as ReadinessOptions, b4 as RuntimeAuthContext, aD as RuntimeAuthIdentity, Q as RuntimeClientOptions, t as RuntimeDevice, p as RuntimePeerHealth, b5 as RuntimePeerScope, k as RuntimePeerState, K as RuntimeRoomMember, aE as RuntimeSession, s as ScopedChannelOptions, u as ScopedLogicalChannel, b6 as SessionKind, b7 as SessionPlatform, aa as TicketMeshPeerReadiness } from '../Connection-BGVBMbWg.js';
7
7
  import { R as RuntimeCapabilities } from '../capabilities-DsKud7Sw.js';
@@ -1 +1 @@
1
- export{a as isDeviceActive,c as isDeviceConnectable,b as isDeviceRoutable}from'../chunk-CK6WQV7J.js';export{h as ConnectionActor,e as ConnectionActorError,i as ConnectionActors,a as ConnectionController,k as DEFAULT_MAX_FRAME_BYTES,t as IpcRuntimeAdapter,s as RuntimeClient,d as clog,q as concatRuntimeBytes,f as connectionActorKey,g as connectionActorKeyString,p as createJsonDecoder,l as createU32Decoder,n as decodeJsonPayload,o as encodeJsonFrame,m as encodeJsonPayload,j as encodeU32Frame,c as grantCorrelation,r as readRuntimeU32BE,b as renderCorrelation}from'../chunk-K32BROMJ.js';import'../chunk-IXQ4KWGP.js';import'../chunk-TFOFTLTV.js';export{u as BROWSER_CAPABILITIES,v as NATIVE_CAPABILITIES,s as RUNTIME_POLICY,x as browserCapabilities,z as capabilityProfile,w as cloneCapabilities,t as getRuntimePolicy,l as logTeardownTrace,h as openRtcDebug,g as openRtcDebugEnabled,i as openRtcDebugInfo,j as openRtcDebugLog,y as statusCapabilities}from'../chunk-UCNK7KB6.js';import'../chunk-L4HWDDXL.js';import'../chunk-TYZS5LXQ.js';import'../chunk-OT7IPLZE.js';import'../chunk-OWKAJPOI.js';import'../chunk-TPF643LU.js';export{a as classifyIpcFailure,b as isIpcUnavailable}from'../chunk-72NEEJQG.js';import'../chunk-L2ZZXECX.js';export{c as runtimeFromCapability}from'../chunk-QL4CJCV4.js';import'../chunk-FKAQDDUM.js';import'../chunk-ZA44REGI.js';import'../chunk-PW2WEI6L.js';import'../chunk-IUU6JCLK.js';import'../chunk-CCCYE3XN.js';import'../chunk-JPBW67B3.js';import'../chunk-L7N4T2PX.js';import'../chunk-72MN7BNQ.js';import'../chunk-2GX6GB6L.js';
1
+ export{a as isDeviceActive,c as isDeviceConnectable,b as isDeviceRoutable}from'../chunk-CK6WQV7J.js';export{h as ConnectionActor,e as ConnectionActorError,i as ConnectionActors,a as ConnectionController,k as DEFAULT_MAX_FRAME_BYTES,t as IpcRuntimeAdapter,s as RuntimeClient,d as clog,q as concatRuntimeBytes,f as connectionActorKey,g as connectionActorKeyString,p as createJsonDecoder,l as createU32Decoder,n as decodeJsonPayload,o as encodeJsonFrame,m as encodeJsonPayload,j as encodeU32Frame,c as grantCorrelation,r as readRuntimeU32BE,b as renderCorrelation}from'../chunk-SADNIMUO.js';import'../chunk-IXQ4KWGP.js';import'../chunk-CQHLD52E.js';export{u as BROWSER_CAPABILITIES,v as NATIVE_CAPABILITIES,s as RUNTIME_POLICY,x as browserCapabilities,z as capabilityProfile,w as cloneCapabilities,t as getRuntimePolicy,l as logTeardownTrace,h as openRtcDebug,g as openRtcDebugEnabled,i as openRtcDebugInfo,j as openRtcDebugLog,y as statusCapabilities}from'../chunk-LCJQ7RSR.js';import'../chunk-FPJAUAEU.js';import'../chunk-L4HWDDXL.js';import'../chunk-2AAZFBRZ.js';import'../chunk-FNCEVW7G.js';import'../chunk-LB27VQRL.js';import'../chunk-OWKAJPOI.js';import'../chunk-TPF643LU.js';export{a as classifyIpcFailure,b as isIpcUnavailable}from'../chunk-72NEEJQG.js';import'../chunk-L2ZZXECX.js';export{c as runtimeFromCapability}from'../chunk-5LNRJE6L.js';import'../chunk-FKAQDDUM.js';import'../chunk-RLPWFHOY.js';import'../chunk-IUU6JCLK.js';import'../chunk-CCCYE3XN.js';import'../chunk-JPBW67B3.js';import'../chunk-ZA44REGI.js';import'../chunk-L7N4T2PX.js';import'../chunk-72MN7BNQ.js';import'../chunk-2GX6GB6L.js';
@@ -1,5 +1,5 @@
1
1
  export { AuthorityAssignmentInput, AuthorityInterestAssignment, AuthorityServiceGrant, AuthorityServiceGrantRequest, Ed25519Signer } from './service-node.js';
2
- import './types-YGlXXpQA.js';
2
+ import './types-Cruu-MsF.js';
3
3
  import './coreClient-ByXs38IP.js';
4
4
  import './assembly-DGrOqsLW.js';
5
5
  import './Connection-BGVBMbWg.js';
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Ed25519Signer, AuthorityServiceGrantRequest, AuthorityServiceGrant, AuthorityAssignmentInput, AuthorityInterestAssignment, DelegatedAuthorityGrantRequest } from './service-node.js';
2
- import './types-YGlXXpQA.js';
2
+ import './types-Cruu-MsF.js';
3
3
  import './coreClient-ByXs38IP.js';
4
4
  import './assembly-DGrOqsLW.js';
5
5
  import './Connection-BGVBMbWg.js';
package/dist/server.js CHANGED
@@ -1,2 +1,2 @@
1
- import {a}from'./chunk-AYQSDKSK.js';import'./chunk-QL4CJCV4.js';import'./chunk-FKAQDDUM.js';import'./chunk-ZA44REGI.js';import'./chunk-PW2WEI6L.js';import'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';function y(n){let e=new URL(n??"https://api.openrtc.app"),t=e.protocol==="http:"&&["127.0.0.1","localhost","::1"].includes(e.hostname.toLowerCase());if(e.protocol!=="https:"&&!t||e.username||e.password||e.search||e.hash)throw new TypeError("[OpenRTC] authority control-plane endpoint is invalid.");return e.toString().replace(/\/$/,"")}function h(){if(typeof document<"u"||typeof window<"u")throw new Error("[OpenRTC] openrtc/server is unavailable in browsers; use openrtc/service-node with a delegated grant.")}var c=class{constructor(e){h();let t=e.secretKey?.trim()??"";if(!/^sk_(?:live|test)_[A-Za-z0-9_-]+$/.test(t))throw new TypeError("[OpenRTC] secretKey is invalid.");let i=e.fetch??globalThis.fetch;if(typeof i!="function")throw new TypeError("[OpenRTC] a Fetch-compatible implementation is required.");let u=y(e.endpoint);this.authority=new a({apiKey:e.apiKey,serviceId:e.serviceId,generation:e.generation,shardIds:e.shardIds,deviceId:e.deviceId,deviceSigner:e.deviceSigner,assignmentSigner:e.assignmentSigner,grantIssuer:async s=>{let r=await i(`${u}/v2/developer/authority/grants`,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json","x-openrtc-idempotency-key":s.idempotencyKey},body:JSON.stringify(s.body)});if(!r.ok){let o=await r.json().catch(()=>null),d=typeof o?.error=="string"?o.error.slice(0,256):`HTTP ${r.status}`;throw new Error(`[OpenRTC] authority service grant failed: ${d}`)}return r.json()}});}requestGrant(e){return this.authority.requestGrant(e)}signAssignment(e){return this.authority.signAssignment(e)}devicePublicKey(){return this.authority.devicePublicKey()}signDeviceBytes(e){return this.authority.signDeviceBytes(e)}grantIssuer(){return async e=>{let t=e.body;return this.requestGrant({roomId:String(t.avenue?.id??""),runtimeInstanceId:String(t.runtimeInstanceId??""),ticketFingerprint:String(t.ticketFingerprint??""),maxPeers:typeof t.maxPeers=="number"?t.maxPeers:void 0,refreshGrant:typeof t.refreshGrant=="string"?t.refreshGrant:void 0,features:typeof t.features=="object"&&t.features?t.features:void 0})}}};
1
+ import {a}from'./chunk-LVLU4YQY.js';import'./chunk-5LNRJE6L.js';import'./chunk-FKAQDDUM.js';import'./chunk-RLPWFHOY.js';import'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import'./chunk-ZA44REGI.js';import'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';function y(n){let e=new URL(n??"https://api.openrtc.app"),t=e.protocol==="http:"&&["127.0.0.1","localhost","::1"].includes(e.hostname.toLowerCase());if(e.protocol!=="https:"&&!t||e.username||e.password||e.search||e.hash)throw new TypeError("[OpenRTC] authority control-plane endpoint is invalid.");return e.toString().replace(/\/$/,"")}function h(){if(typeof document<"u"||typeof window<"u")throw new Error("[OpenRTC] openrtc/server is unavailable in browsers; use openrtc/service-node with a delegated grant.")}var c=class{constructor(e){h();let t=e.secretKey?.trim()??"";if(!/^sk_(?:live|test)_[A-Za-z0-9_-]+$/.test(t))throw new TypeError("[OpenRTC] secretKey is invalid.");let i=e.fetch??globalThis.fetch;if(typeof i!="function")throw new TypeError("[OpenRTC] a Fetch-compatible implementation is required.");let u=y(e.endpoint);this.authority=new a({apiKey:e.apiKey,serviceId:e.serviceId,generation:e.generation,shardIds:e.shardIds,deviceId:e.deviceId,deviceSigner:e.deviceSigner,assignmentSigner:e.assignmentSigner,grantIssuer:async s=>{let r=await i(`${u}/v2/developer/authority/grants`,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json","x-openrtc-idempotency-key":s.idempotencyKey},body:JSON.stringify(s.body)});if(!r.ok){let o=await r.json().catch(()=>null),d=typeof o?.error=="string"?o.error.slice(0,256):`HTTP ${r.status}`;throw new Error(`[OpenRTC] authority service grant failed: ${d}`)}return r.json()}});}requestGrant(e){return this.authority.requestGrant(e)}signAssignment(e){return this.authority.signAssignment(e)}devicePublicKey(){return this.authority.devicePublicKey()}signDeviceBytes(e){return this.authority.signDeviceBytes(e)}grantIssuer(){return async e=>{let t=e.body;return this.requestGrant({roomId:String(t.avenue?.id??""),runtimeInstanceId:String(t.runtimeInstanceId??""),ticketFingerprint:String(t.ticketFingerprint??""),maxPeers:typeof t.maxPeers=="number"?t.maxPeers:void 0,refreshGrant:typeof t.refreshGrant=="string"?t.refreshGrant:void 0,features:typeof t.features=="object"&&t.features?t.features:void 0})}}};
2
2
  export{c as AuthorityServiceControlPlane};
@@ -1,4 +1,4 @@
1
- import { C as Client, X as Room, r as Connection } from './types-YGlXXpQA.js';
1
+ import { C as Client, a0 as Room, r as Connection } from './types-Cruu-MsF.js';
2
2
  import './coreClient-ByXs38IP.js';
3
3
  import './assembly-DGrOqsLW.js';
4
4
  import './Connection-BGVBMbWg.js';
@@ -1 +1 @@
1
- export{a as DelegatedAuthorityService,b as ServiceNode}from'./chunk-AYQSDKSK.js';import'./chunk-QL4CJCV4.js';import'./chunk-FKAQDDUM.js';import'./chunk-ZA44REGI.js';import'./chunk-PW2WEI6L.js';import'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';
1
+ export{a as DelegatedAuthorityService,b as ServiceNode}from'./chunk-LVLU4YQY.js';import'./chunk-5LNRJE6L.js';import'./chunk-FKAQDDUM.js';import'./chunk-RLPWFHOY.js';import'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import'./chunk-ZA44REGI.js';import'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';
@@ -1,4 +1,4 @@
1
- import { O as Options, C as Client } from '../types-YGlXXpQA.js';
1
+ import { O as Options, C as Client } from '../types-Cruu-MsF.js';
2
2
  import { E as Endpoints } from '../protocol-BSBjMb7p.js';
3
3
  import { P as PlutoIpcBridge } from '../ipc-DgzKqHH3.js';
4
4
  import '../coreClient-ByXs38IP.js';
@@ -1 +1 @@
1
- import {a}from'../chunk-XXZEDZUU.js';import'../chunk-TPF643LU.js';import {a as a$1}from'../chunk-NS32P65Z.js';import'../chunk-GMPEZXPD.js';import {i}from'../chunk-QL4CJCV4.js';import'../chunk-FKAQDDUM.js';import'../chunk-ZA44REGI.js';import'../chunk-PW2WEI6L.js';import'../chunk-IUU6JCLK.js';import'../chunk-CCCYE3XN.js';import'../chunk-JPBW67B3.js';import'../chunk-L7N4T2PX.js';import'../chunk-72MN7BNQ.js';import'../chunk-2GX6GB6L.js';function v(c,p,e){let o=new a;return i(c,{endpoints:p,testingAllowInsecureLoopback:true,platform:"native",close:()=>o.close(),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:a}=await import('../ipcFactory-4LCCR23Q.js');return a(t,e,o)}})}export{v as OpenRTC};
1
+ import {a}from'../chunk-XXZEDZUU.js';import'../chunk-TPF643LU.js';import {a as a$1}from'../chunk-NS32P65Z.js';import'../chunk-GMPEZXPD.js';import {i}from'../chunk-5LNRJE6L.js';import'../chunk-FKAQDDUM.js';import'../chunk-RLPWFHOY.js';import'../chunk-IUU6JCLK.js';import'../chunk-CCCYE3XN.js';import'../chunk-JPBW67B3.js';import'../chunk-ZA44REGI.js';import'../chunk-L7N4T2PX.js';import'../chunk-72MN7BNQ.js';import'../chunk-2GX6GB6L.js';function v(c,p,e){let o=new a;return i(c,{endpoints:p,testingAllowInsecureLoopback:true,platform:"native",close:()=>o.close(),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:a}=await import('../ipcFactory-F75IXEIE.js');return a(t,e,o)}})}export{v as OpenRTC};
package/dist/testing.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { R as RoomArchitectureMode, an as CoordinationGatewayGrantRequest, ao as CoordinationGatewayGrant } from './Connection-BGVBMbWg.js';
2
- import { a as AttestationProvider, b as AuthProvider, B as BotVerificationProvider, e as BroadcastGrant, d as BroadcastCreateOptions, f as BroadcastInvite, g as BroadcastInviteOptions, D as Delivery, t as DeviceProfile, O as Options, C as Client } from './types-YGlXXpQA.js';
2
+ import { a as AttestationProvider, b as AuthProvider, B as BotVerificationProvider, e as BroadcastGrant, d as BroadcastCreateOptions, f as BroadcastInvite, g as BroadcastInviteOptions, D as Delivery, t as DeviceProfile, O as Options, C as Client } from './types-Cruu-MsF.js';
3
3
  import { E as Endpoints } from './protocol-BSBjMb7p.js';
4
4
  import './coreClient-ByXs38IP.js';
5
5
  import './assembly-DGrOqsLW.js';
package/dist/testing.js CHANGED
@@ -1 +1 @@
1
- import {a}from'./chunk-2Q75GXGE.js';import {a as a$1}from'./chunk-IAYQJZQQ.js';import {a as a$2,d,c}from'./chunk-L2ZZXECX.js';import'./chunk-GMPEZXPD.js';import {i}from'./chunk-QL4CJCV4.js';import'./chunk-FKAQDDUM.js';import'./chunk-ZA44REGI.js';import'./chunk-PW2WEI6L.js';import'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';function v(i,o,e){let n=s=>{let t=new URL(s);return t.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(t.hostname)&&Number(t.port)>0&&t.pathname==="/"&&!t.username&&!t.password&&!t.search&&!t.hash};if(i.apiKey!=="pk_test_0000000000000000000000000000000000000000"||!n(o.controlPlane)||!n(o.gateway)||!/^[A-Za-z0-9_-]{1,64}$/.test(e.keyNamespace))throw new Error("Local broadcast testing requires the disposable loopback service lane")}function b(i){let o=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(Math.ceil(i.length/4)*4,"=");return Uint8Array.from(atob(o),e=>e.charCodeAt(0))}function A(i,o,e){return new a(i,o,a$1(e))}function R(i$1,o,e={}){if(e.localBroadcast&&v(i$1,o,e.localBroadcast),e.initialTicketLifetimeMs!==void 0){let t=(p,c)=>{let a=new URL(p);return a.protocol===c&&["127.0.0.1","[::1]"].includes(a.hostname)&&Number(a.port)>0&&a.pathname==="/"&&!a.username&&!a.password&&!a.search&&!a.hash};if(e.initialTicketLifetimeMs!==9e4||i$1.apiKey!=="pk_test_0000000000000000000000000000000000000000"||!t(o.controlPlane,"http:")||!t(o.gateway,"http:")||!e.irohTestRelayUrl||!t(e.irohTestRelayUrl,"https:"))throw new Error("Short initial tickets require the disposable local service lane")}let n=e.localBroadcast,s=n?a$1(n.keyNamespace):void 0;return i(i$1,{endpoints:o,testingAllowInsecureLoopback:true,platform:"web",...s?{deviceKeyProvider:s}:{},...n&&s?{broadcastHostFactory:async t=>{let[{BrowserManagedBroadcastHost:p},{loadBrowserWasmRuntimeModule:c}]=await Promise.all([import('./BrowserManagedBroadcastHost-6VGHQQMF.js'),import('./WasmBridge-L76OAD5U.js')]),a=c().then(async r=>(await r.initWasm(),r.start(),new r.WasmClient(t.apiKey))),y=await s.getOrCreate(`app_${t.apiKey.slice(-16)}`);return new p({resolve:async(r,l)=>({token:r,...await n.resolve(r,l),signBindingChallenge:async m=>b(await y.sign(m))}),loadWasm:()=>a})}}:{},...e.deviceId?{deviceIdProvider:async()=>e.deviceId}:{},...e.irohTestRelayUrl?{irohTestRelayUrl:e.irohTestRelayUrl}:{},runtimeFactory:async t=>{let{createWasmClient:p}=await import('./runtime/factories.js'),c$1=await p(t);if(e.initialTicketLifetimeMs!==void 0){let a=c$1.runtime,y=a.getTicketWithToken.bind(a);a.getTicketWithToken=async(r,l=0)=>{if(a.getTicketWithToken=y,!r.startsWith("v2:room:"))throw new Error("Short initial ticket requires room scope");let{irohTicket:m,tokenSuffix:u}=a$2(await y(r,l)),d$1=u&&d(m,u);if(!d$1||!d$1.t||d$1.s!==r||d$1.m!==l)throw new Error("Invalid initial service ticket");let f=Date.now()+9e4;return await a.registerToken({token:d$1.t,scope:r,maxConnections:l,expiresAtMs:f}),c(m,d$1.t,r,l,f)};}return c$1}})}export{R as OpenRTC,A as controlPlane};
1
+ import {a}from'./chunk-2Q75GXGE.js';import {a as a$1}from'./chunk-IAYQJZQQ.js';import {a as a$2,d,c}from'./chunk-L2ZZXECX.js';import'./chunk-GMPEZXPD.js';import {i}from'./chunk-5LNRJE6L.js';import'./chunk-FKAQDDUM.js';import'./chunk-RLPWFHOY.js';import'./chunk-IUU6JCLK.js';import'./chunk-CCCYE3XN.js';import'./chunk-JPBW67B3.js';import'./chunk-ZA44REGI.js';import'./chunk-L7N4T2PX.js';import'./chunk-72MN7BNQ.js';import'./chunk-2GX6GB6L.js';function v(i,o,e){let n=s=>{let t=new URL(s);return t.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(t.hostname)&&Number(t.port)>0&&t.pathname==="/"&&!t.username&&!t.password&&!t.search&&!t.hash};if(i.apiKey!=="pk_test_0000000000000000000000000000000000000000"||!n(o.controlPlane)||!n(o.gateway)||!/^[A-Za-z0-9_-]{1,64}$/.test(e.keyNamespace))throw new Error("Local broadcast testing requires the disposable loopback service lane")}function b(i){let o=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(Math.ceil(i.length/4)*4,"=");return Uint8Array.from(atob(o),e=>e.charCodeAt(0))}function A(i,o,e){return new a(i,o,a$1(e))}function R(i$1,o,e={}){if(e.localBroadcast&&v(i$1,o,e.localBroadcast),e.initialTicketLifetimeMs!==void 0){let t=(p,c)=>{let a=new URL(p);return a.protocol===c&&["127.0.0.1","[::1]"].includes(a.hostname)&&Number(a.port)>0&&a.pathname==="/"&&!a.username&&!a.password&&!a.search&&!a.hash};if(e.initialTicketLifetimeMs!==9e4||i$1.apiKey!=="pk_test_0000000000000000000000000000000000000000"||!t(o.controlPlane,"http:")||!t(o.gateway,"http:")||!e.irohTestRelayUrl||!t(e.irohTestRelayUrl,"https:"))throw new Error("Short initial tickets require the disposable local service lane")}let n=e.localBroadcast,s=n?a$1(n.keyNamespace):void 0;return i(i$1,{endpoints:o,testingAllowInsecureLoopback:true,platform:"web",...s?{deviceKeyProvider:s}:{},...n&&s?{broadcastHostFactory:async t=>{let[{BrowserManagedBroadcastHost:p},{loadBrowserWasmRuntimeModule:c}]=await Promise.all([import('./BrowserManagedBroadcastHost-6VGHQQMF.js'),import('./WasmBridge-CJNESUGJ.js')]),a=c().then(async r=>(await r.initWasm(),r.start(),new r.WasmClient(t.apiKey))),y=await s.getOrCreate(`app_${t.apiKey.slice(-16)}`);return new p({resolve:async(r,l)=>({token:r,...await n.resolve(r,l),signBindingChallenge:async m=>b(await y.sign(m))}),loadWasm:()=>a})}}:{},...e.deviceId?{deviceIdProvider:async()=>e.deviceId}:{},...e.irohTestRelayUrl?{irohTestRelayUrl:e.irohTestRelayUrl}:{},runtimeFactory:async t=>{let{createWasmClient:p}=await import('./runtime/factories.js'),c$1=await p(t);if(e.initialTicketLifetimeMs!==void 0){let a=c$1.runtime,y=a.getTicketWithToken.bind(a);a.getTicketWithToken=async(r,l=0)=>{if(a.getTicketWithToken=y,!r.startsWith("v2:room:"))throw new Error("Short initial ticket requires room scope");let{irohTicket:m,tokenSuffix:u}=a$2(await y(r,l)),d$1=u&&d(m,u);if(!d$1||!d$1.t||d$1.s!==r||d$1.m!==l)throw new Error("Invalid initial service ticket");let f=Date.now()+9e4;return await a.registerToken({token:d$1.t,scope:r,maxConnections:l,expiresAtMs:f}),c(m,d$1.t,r,l,f)};}return c$1}})}export{R as OpenRTC,A as controlPlane};
@@ -1 +1 @@
1
- export{g as KEY_ALGORITHM,f as PUBLIC_KEY_BYTES,c as createCryptoStreams,h as createKeyAgreement,b as createSharedCrypto,i as deriveCryptoKey,j as encodeKeyAgreement,a as isEncryptedPayload,e as preferredProtocols}from'../chunk-TYZS5LXQ.js';export{k as TRANSPORT_LABELS,m as isBaseIroh,n as isDirectIroh,o as isWebRtc,l as normalizeTransport}from'../chunk-OT7IPLZE.js';export{b as ROUTE_DESCRIPTORS,e as getRouteDescriptor,f as listRouteDescriptors}from'../chunk-OWKAJPOI.js';
1
+ export{g as KEY_ALGORITHM,f as PUBLIC_KEY_BYTES,c as createCryptoStreams,h as createKeyAgreement,b as createSharedCrypto,i as deriveCryptoKey,j as encodeKeyAgreement,a as isEncryptedPayload,e as preferredProtocols}from'../chunk-2AAZFBRZ.js';export{a as TRANSPORT_LABELS,c as isBaseIroh,d as isDirectIroh,e as isWebRtc,b as normalizeTransport}from'../chunk-FNCEVW7G.js';import'../chunk-LB27VQRL.js';export{b as ROUTE_DESCRIPTORS,e as getRouteDescriptor,f as listRouteDescriptors}from'../chunk-OWKAJPOI.js';
@@ -137,6 +137,44 @@ interface Options {
137
137
  };
138
138
  transports?: Transports;
139
139
  }
140
+ /** Explicit hosted-only root. App credentials supply all authority; no v2 API
141
+ * key, durable device enrollment or peer runtime is created. */
142
+ interface LiveOnlyOptions extends Omit<Options, 'apiKey'> {
143
+ profile: 'live';
144
+ apiKey?: never;
145
+ }
146
+ /** Credentials signed by your app backend. Never distribute its private key. */
147
+ interface LiveCoordinationCredentials {
148
+ certificate: string;
149
+ session: string;
150
+ }
151
+ interface LiveCoordinationOptions {
152
+ credentials(input: {
153
+ forceRefresh: boolean;
154
+ signal: AbortSignal;
155
+ }): Promise<LiveCoordinationCredentials>;
156
+ }
157
+ interface LiveCoordinationMessage {
158
+ channel: string;
159
+ from: string;
160
+ data: string;
161
+ }
162
+ /** Ephemeral hosted delivery, separate from Iroh peers, rooms and streams.
163
+ * A publication receipt means accepted by the service, not applied by a peer.
164
+ * Socket loss closes this handle. Publications are never replayed. */
165
+ interface LiveCoordinationSession {
166
+ readonly closed: boolean;
167
+ subscribe(channel: string): Promise<void>;
168
+ unsubscribe(channel: string): Promise<void>;
169
+ publish(channel: string, data: string): Promise<{
170
+ units: number;
171
+ }>;
172
+ /** Refresh unchanged app/subject/channel scope on the current socket. */
173
+ renew(): Promise<void>;
174
+ onMessage(listener: (message: Readonly<LiveCoordinationMessage>) => void): () => void;
175
+ onClose(listener: () => void): () => void;
176
+ close(): Promise<void>;
177
+ }
140
178
  type AccessMode = 'capability' | 'authenticated';
141
179
  type Delivery = 'reliable' | 'latest-state';
142
180
  interface PeerStreamOptions {
@@ -575,6 +613,10 @@ interface BroadcastInviteOptions {
575
613
  reservedEgressBytes: number;
576
614
  }
577
615
  interface Client {
616
+ readonly live: {
617
+ /** One hosted session per root, shared across its subscriptions. */
618
+ open(options: LiveCoordinationOptions): Promise<LiveCoordinationSession>;
619
+ };
578
620
  readonly offline: Offline;
579
621
  readonly devices: {
580
622
  /**
@@ -642,4 +684,4 @@ interface Client {
642
684
  close(): Promise<void>;
643
685
  }
644
686
 
645
- export type { Space as $, AccessMode as A, BotVerificationProvider as B, Client as C, Delivery as D, EnrolledDevice as E, MediaReceiverStats as F, MediaSender as G, MediaSenderStats as H, IncomingPeerBidirectionalStream as I, MediaStats as J, MediaTrackEvent as K, MediaTrackOptions as L, MediaConnection as M, Offline as N, Options as O, OfflineAssurance as P, OfflineEnrollmentRequest as Q, OfflineRuntimeSupport as R, PeerBidirectionalStream as S, PeerDatagramDuplexStream as T, PeerDatagramStats as U, PeerStreamOptions as V, PeerStreamTransport as W, Room as X, RoomMember as Y, RoomMembers as Z, RoomOptions as _, AttestationProvider as a, SpaceOptions as a0, State as a1, Ticket as a2, TicketOptions as a3, Transports as a4, AuthProvider as b, Avenue as c, BroadcastCreateOptions as d, BroadcastGrant as e, BroadcastInvite as f, BroadcastInviteOptions as g, BroadcastMedia as h, BroadcastPublisher as i, BroadcastRole as j, BroadcastSession as k, BroadcastSource as l, BroadcastState as m, BroadcastStats as n, BroadcastTrackEvent as o, Channel as p, Channels as q, Connection as r, DeviceOptions as s, DeviceProfile as t, Devices as u, IncomingPeerUnidirectionalStream as v, MediaIncomingDemuxStats as w, MediaKind as x, MediaLatencySummary as y, MediaReceiver as z };
687
+ export type { PeerStreamTransport as $, AccessMode as A, BotVerificationProvider as B, Client as C, Delivery as D, EnrolledDevice as E, MediaIncomingDemuxStats as F, MediaKind as G, MediaLatencySummary as H, IncomingPeerBidirectionalStream as I, MediaReceiver as J, MediaReceiverStats as K, LiveCoordinationCredentials as L, MediaConnection as M, MediaSender as N, Options as O, MediaSenderStats as P, MediaStats as Q, MediaTrackEvent as R, MediaTrackOptions as S, Offline as T, OfflineAssurance as U, OfflineEnrollmentRequest as V, OfflineRuntimeSupport as W, PeerBidirectionalStream as X, PeerDatagramDuplexStream as Y, PeerDatagramStats as Z, PeerStreamOptions as _, AttestationProvider as a, Room as a0, RoomMember as a1, RoomMembers as a2, RoomOptions as a3, Space as a4, SpaceOptions as a5, State as a6, Ticket as a7, TicketOptions as a8, Transports as a9, AuthProvider as b, Avenue as c, BroadcastCreateOptions as d, BroadcastGrant as e, BroadcastInvite as f, BroadcastInviteOptions as g, BroadcastMedia as h, BroadcastPublisher as i, BroadcastRole as j, BroadcastSession as k, BroadcastSource as l, BroadcastState as m, BroadcastStats as n, BroadcastTrackEvent as o, Channel as p, Channels as q, Connection as r, DeviceOptions as s, DeviceProfile as t, Devices as u, IncomingPeerUnidirectionalStream as v, LiveCoordinationMessage as w, LiveCoordinationOptions as x, LiveCoordinationSession as y, LiveOnlyOptions as z };
@@ -4,9 +4,9 @@
4
4
  "platform": "darwin",
5
5
  "arch": "arm64",
6
6
  "rustTarget": "aarch64-apple-darwin",
7
- "sourceCommit": "72eb56494d4f4bb838f96305ee3bb91cacdb0869",
8
- "sourceDigest": "2b538be6ce100d0352707694a415475967bc771a5ffe64884aa877afbf3c01bc",
9
- "binarySha256": "8a973c57e1a60dee22b16bfccec266094dbbc48f44d5c39f6dbbe25b9ad759fd",
7
+ "sourceCommit": "a42eb60b973b88d09047fa9db8bb9d9f1ff29e80",
8
+ "sourceDigest": "2a289da0f6e7006211566a8ad9a6e794803785c599a323df04944972bc7e3517",
9
+ "binarySha256": "257acbe1b74c8801ebbb9301d31e2099f5b871ebbc11273c26a563aa3a617b32",
10
10
  "protocol": {
11
11
  "lifecycleOwner": "rust-peer-session",
12
12
  "maxApplicationPayloadBytes": 65536,
@@ -16,5 +16,5 @@
16
16
  },
17
17
  "signingKeySha256": "0391c617f3df12611b419e129cace36fa792e73da03271649cbed9e9f9f155ef",
18
18
  "signatureAlgorithm": "ed25519",
19
- "signature": "ri3bSI0Xm3XasvwplJwSDDKf1g8CSeJGAmbS7jYvcRoA/fse2n2fk+Pk3n+bWvUFMys345EdWdI2Jqzw0RpcBQ=="
19
+ "signature": "RcxuYiXYql3LBp2xciQr6I5HOrR3rii573zUi+uaiWBGaoALX+IvUEOEXSGE2bdBiTvur8Itqq4b7JKns299Bw=="
20
20
  }
Binary file