openrtc 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DelegatingRuntimeAdapter-BkLR3TNN.d.ts → DelegatingRuntimeAdapter-DE4LTGAJ.d.ts} +3 -3
- package/dist/{ITransport-yaruAmx3.d.ts → ITransport-CjxCQ6q7.d.ts} +3 -4
- package/dist/{IpcRuntimeAdapter-DDKeQ6UC.d.ts → IpcRuntimeAdapter-CE0va9Tr.d.ts} +2 -2
- package/dist/WasmBridge-75F6GKHG.js +1 -0
- package/dist/{assembly-BTzwQuwI.d.ts → assembly-Bmi65-tK.d.ts} +3 -3
- package/dist/{capabilities-BwzPe51I.d.ts → capabilities-BPuynml5.d.ts} +1 -1
- package/dist/{chunk-SUWCBTBQ.js → chunk-2L6ULC32.js} +1 -1
- package/dist/{chunk-LN4ALFT6.js → chunk-2SUSPEC4.js} +1 -1
- package/dist/{chunk-FKEKINIM.js → chunk-7BJKDBLP.js} +1 -1
- package/dist/chunk-HEAJ7ZUR.js +1 -0
- package/dist/{chunk-GND6UW37.js → chunk-KRJECX7X.js} +1 -1
- package/dist/chunk-Q6KXVTSH.js +2 -0
- package/dist/{chunk-F4BJ72HN.js → chunk-R35AWMNY.js} +1 -1
- package/dist/chunk-UILOGUOU.js +1 -0
- package/dist/chunk-WA434EWD.js +2 -0
- package/dist/chunk-XAL4T6TB.js +3 -0
- package/dist/{chunk-OUFHVLDQ.js → chunk-Z2IS6NH2.js} +1 -1
- package/dist/{controlPlane-JJFURVOX.js → controlPlane-KVFZ7BR5.js} +1 -1
- package/dist/coreClient.d.ts +4 -4
- package/dist/coreClient.js +1 -1
- package/dist/{deviceEnrollment-Z2EHP2EX.js → deviceEnrollment-VACC64CQ.js} +2 -2
- package/dist/index.d.ts +6 -6
- package/dist/index.js +1 -1
- package/dist/ipcFactory-32R47AVK.js +1 -0
- package/dist/openrtc-4EZPCHWM.js +2 -0
- package/dist/openrtc_bg.wasm +0 -0
- package/dist/runtime/WasmRuntimeAdapter.d.ts +4 -4
- package/dist/runtime/WasmRuntimeAdapter.js +1 -1
- package/dist/runtime/device-status.d.ts +2 -2
- package/dist/runtime/factories.d.ts +6 -6
- package/dist/runtime/factories.js +1 -1
- package/dist/runtime/index.d.ts +10 -10
- package/dist/runtime/index.js +1 -1
- package/dist/testing.d.ts +10 -5
- package/dist/testing.js +1 -1
- package/dist/transport/index.d.ts +2 -2
- package/dist/transport/index.js +1 -1
- package/dist/{types-C4TIUgOJ.d.ts → types--jQzenZR.d.ts} +3 -2
- package/dist/{types-D67HlF0p.d.ts → types-DDhMQkK8.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/WasmBridge-DVQ2YPRB.js +0 -1
- package/dist/chunk-2IRNZN3N.js +0 -1
- package/dist/chunk-DI5VSZ2T.js +0 -2
- package/dist/chunk-NRXEG5GQ.js +0 -1
- package/dist/chunk-NXM5ZGHD.js +0 -2
- package/dist/chunk-UGZJJQPM.js +0 -3
- package/dist/ipcFactory-DQFK65VE.js +0 -1
- package/dist/openrtc-INQDCF23.js +0 -2
package/dist/coreClient.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {n}from'./chunk-
|
|
1
|
+
import {n}from'./chunk-WA434EWD.js';import'./chunk-HEAJ7ZUR.js';import'./chunk-2SUSPEC4.js';function I(o){let s=n({...o});if("auth"in o&&!o.authMode){let n=o.auth;s.authMode=n==="none"?"anonymous":n;}if("identity"in o){let n=o.identity,r=n==="temporary"?"ephemeral":n;!o.deviceIdPersistence&&!o.nodeIdPersistence&&(s.deviceIdPersistence=r),!o.endpointIdPersistence&&!o.nodeIdPersistence&&(s.endpointIdPersistence=r);}return "namespace"in o&&!o.storagePrefix&&(s.storagePrefix=o.namespace),"privacy"in o&&o.strictMode===void 0&&(s.strictMode=!!o.privacy),s}function D(o,s){let n=o.runtime,r=Object.create(n),d=async e=>{if(typeof e!="string")return e;let i=(await n.listDevices()).find(c=>c.deviceId===e);if(!i)throw new Error(`OpenRTC device '${e}' is not currently discoverable.`);return i},u=async e=>({...e,localDeviceId:e?.localDeviceId??await n.getLocalDeviceId()??""}),g=async e=>{let{device:t,scope:i,...c}=e,a=c.deviceId??(typeof t=="string"?t:t?.deviceId)??null,l=c.ticket??(typeof t=="string"?void 0:t?.ticket);a&&!l&&(l=(await d(a).catch(()=>null))?.ticket);let m={...c,scope:i??"session"};return a&&(m.deviceId=a),l&&(m.ticket=l),m},v={list:()=>n.listDevices(),startSession:(e={})=>n.startManagedSession({...e,platform:e.platform??s}),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 u(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)},P={watch:e=>n.watchPeerStates(e),watchLifecycle:e=>n.watchPeerLifecycle(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()},C={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 g(e)),connectScoped:e=>n.connectScopedChannel(e)},h={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)},S={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={status:()=>n.getRuntimeStatus(),policy:()=>n.getRuntimePolicy(),capabilities:()=>n.capabilities(),capabilityProfile:()=>n.getCapabilityProfile(),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(r,{devices:{get:()=>v,enumerable:true},peers:{get:()=>P,enumerable:true},channels:{get:()=>C,enumerable:true},rooms:{get:()=>h,enumerable:true},tickets:{get:()=>S,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}}),r}export{I as resolveOptions,D as wrapAssembly};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {d,a}from'./chunk-AJQVMVYW.js';function v(e){return e.status===403&&e.reason==="device-enrollment-revoked"}async function
|
|
2
|
-
export{
|
|
1
|
+
import {d,a}from'./chunk-AJQVMVYW.js';function v(e){return e.status===403&&e.reason==="device-enrollment-revoked"}async function y(e){let r=e.identity,a$1=async(o=false,t=e.recoverRevokedEnrollment)=>{let n=await e.key.proof((d,l)=>["openrtc:v2:device-enroll",e.appTag,r.principalId,e.deviceId,d,l].join(":")),i=e.attestation?{kind:e.attestation.kind,...await e.attestation.getEvidence({challenge:`openrtc:v2:attestation:${e.appTag}:${r.principalId}:${e.deviceId}:${n.nonce}`,apiKey:e.apiKey})}:void 0;return e.post("/v2/devices/enroll",{identitySession:r.identitySession,deviceId:e.deviceId,deviceProof:n,...e.profile?.name||e.profile?.platform?{deviceProfile:{...e.profile.name?{name:e.profile.name}:{},...e.profile.platform?{platform:e.profile.platform}:{}}}:{},...t?{recoverRevokedEnrollment:true}:{},...o?{recoverDeviceKey:true}:{},...i?{attestation:i}:{}})};try{return {identity:r,enrollment:await a$1()}}catch(o){let t=o;if(!(t instanceof Error))throw o;if(v(t)){if(r.deviceRecoveryAuthorized===false)throw d(a.AUTH_DEVICE_REENROLLMENT_REQUIRED,"This device was removed. Sign in again to authorize re-enrollment.",{retryable:true,plane:"auth",cause:o});return {identity:r,enrollment:await a$1(false,true)}}if(t.status!==412||t.reason!=="device-key-recovery-required")throw o;let n=await e.auth.getAssertion({audience:"https://api.openrtc.app/v2/assertions/exchange",forceRefresh:true,deviceId:e.deviceId,recoveryReason:"device-key-rotation"});if(!n)throw new Error("The OpenRTC auth provider returned no assertion.");let i=await e.post("/v2/assertions/exchange",{assertion:n,...e.auth.providerId?{providerId:e.auth.providerId}:{}});if(e.recordAssertionExchange(),i.principalId!==r.principalId)throw new Error("The authenticated principal changed during device-key recovery.");return r=i,{identity:r,enrollment:await a$1(true)}}}
|
|
2
|
+
export{y as enrollDevice};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { P as PlutoIpcBridge } from './ipc-CPnNwv6f.js';
|
|
2
|
-
import { O as Options, C as Client } from './types
|
|
3
|
-
export { A as AttestationProvider, a as AuthProvider, b as Avenue, c as Channel, d as Connection, D as DeviceOptions, e as DeviceProfile, f as Devices, E as EnrolledDevice, R as Room, g as RoomOptions, S as Space, h as SpaceOptions, i as State, T as Ticket, j as TicketOptions, k as Transports, U as UsageUpdate, l as UsageWarning } from './types
|
|
2
|
+
import { O as Options, C as Client } from './types--jQzenZR.js';
|
|
3
|
+
export { A as AttestationProvider, a as AuthProvider, b as Avenue, c as Channel, d as Connection, D as DeviceOptions, e as DeviceProfile, f as Devices, E as EnrolledDevice, R as Room, g as RoomOptions, S as Space, h as SpaceOptions, i as State, T as Ticket, j as TicketOptions, k as Transports, U as UsageUpdate, l as UsageWarning } from './types--jQzenZR.js';
|
|
4
4
|
import './coreClient.js';
|
|
5
|
-
import './assembly-
|
|
6
|
-
import './types-
|
|
7
|
-
import './ITransport-
|
|
8
|
-
import './capabilities-
|
|
5
|
+
import './assembly-Bmi65-tK.js';
|
|
6
|
+
import './types-DDhMQkK8.js';
|
|
7
|
+
import './ITransport-CjxCQ6q7.js';
|
|
8
|
+
import './capabilities-BPuynml5.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Create a lazy OpenRTC 2.0 browser client. Construction validates only local
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-BOS554IK.js';import'./chunk-4MLJXEVV.js';import {b}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-BOS554IK.js';import'./chunk-4MLJXEVV.js';import {b}from'./chunk-UILOGUOU.js';import'./chunk-ZA44REGI.js';import {d}from'./chunk-HUG5AX7R.js';import'./chunk-DUY34MGT.js';export{a as ERROR_CODES,b as RTCError,e as classifyError,d as createError,c as projectError}from'./chunk-AJQVMVYW.js';import'./chunk-HEAJ7ZUR.js';function n(r){return b(r,{platform:"web",runtimeFactory:async e=>{let{createWasmClient:t}=await import('./runtime/factories.js');return t(e)}})}n.native=function(r,e=d()){return b(r,{platform:"native",deviceKeyProvider:a(e),deviceIdProvider:async()=>{let t=await e.invoke("get_rtc_local_device_info");return String(t?.deviceId??"")},runtimeFactory:async t=>{let{createIpcClient:a}=await import('./ipcFactory-32R47AVK.js');return a(t,e)}})};export{n as OpenRTC};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-KRJECX7X.js';import {t}from'./chunk-XAL4T6TB.js';import'./chunk-HUG5AX7R.js';import'./chunk-DUY34MGT.js';import'./chunk-R35AWMNY.js';import'./chunk-Z2IS6NH2.js';import'./chunk-AJQVMVYW.js';import {a}from'./chunk-WA434EWD.js';import'./chunk-HEAJ7ZUR.js';import'./chunk-7BJKDBLP.js';import'./chunk-2L6ULC32.js';import'./chunk-2SUSPEC4.js';function c(i,r){let t$1=a(i);return a$1(t$1,new t({...t$1,bridge:r}))}export{c as createIpcClient};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var q=class b{static __wrap(t){let e=Object.create(b.prototype);return e.__wbg_ptr=t,$.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,$.unregister(this),t}free(){let t=this.__destroy_into_raw();n.__wbg_bistream_free(t,0);}get applicationCryptoWrapped(){return n.bistream_applicationCryptoWrapped(this.__wbg_ptr)!==0}get endpoint_id(){let t,e;try{let o=n.__wbindgen_add_to_stack_pointer(-16);n.bistream_endpoint_id(o,this.__wbg_ptr);var _=x().getInt32(o+0,!0),r=x().getInt32(o+4,!0);return t=_,e=r,I(_,r)}finally{n.__wbindgen_add_to_stack_pointer(16),n.__wbindgen_export4(t,e,1);}}finishSend(){let t=n.bistream_finishSend(this.__wbg_ptr);return p(t)}get recv(){let t=n.bistream_recv(this.__wbg_ptr);return p(t)}get send(){let t=n.bistream_send(this.__wbg_ptr);return p(t)}};Symbol.dispose&&(q.prototype[Symbol.dispose]=q.prototype.free);var L=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Rt.unregister(this),t}free(){let t=this.__destroy_into_raw();n.__wbg_intounderlyingbytesource_free(t,0);}get autoAllocateChunkSize(){return n.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr)>>>0}cancel(){let t=this.__destroy_into_raw();n.intounderlyingbytesource_cancel(t);}pull(t){let e=n.intounderlyingbytesource_pull(this.__wbg_ptr,g(t));return p(e)}start(t){n.intounderlyingbytesource_start(this.__wbg_ptr,g(t));}get type(){let t=n.intounderlyingbytesource_type(this.__wbg_ptr);return mt[t]}};Symbol.dispose&&(L.prototype[Symbol.dispose]=L.prototype.free);var N=class b{static __wrap(t){let e=Object.create(b.prototype);return e.__wbg_ptr=t,K.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,K.unregister(this),t}free(){let t=this.__destroy_into_raw();n.__wbg_intounderlyingsink_free(t,0);}abort(t){let e=this.__destroy_into_raw(),_=n.intounderlyingsink_abort(e,g(t));return p(_)}close(){let t=this.__destroy_into_raw(),e=n.intounderlyingsink_close(t);return p(e)}write(t){let e=n.intounderlyingsink_write(this.__wbg_ptr,g(t));return p(e)}};Symbol.dispose&&(N.prototype[Symbol.dispose]=N.prototype.free);var O=class b{static __wrap(t){let e=Object.create(b.prototype);return e.__wbg_ptr=t,J.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,J.unregister(this),t}free(){let t=this.__destroy_into_raw();n.__wbg_intounderlyingsource_free(t,0);}cancel(){let t=this.__destroy_into_raw();n.intounderlyingsource_cancel(t);}pull(t){let e=n.intounderlyingsource_pull(this.__wbg_ptr,g(t));return p(e)}};Symbol.dispose&&(O.prototype[Symbol.dispose]=O.prototype.free);var B=class b{static __wrap(t){let e=Object.create(b.prototype);return e.__wbg_ptr=t,Y.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Y.unregister(this),t}free(){let t=this.__destroy_into_raw();n.__wbg_peerunistream_free(t,0);}get applicationCryptoWrapped(){return n.peerunistream_applicationCryptoWrapped(this.__wbg_ptr)!==0}finishSend(){let t=n.peerunistream_finishSend(this.__wbg_ptr);return p(t)}get writable(){let t=n.peerunistream_writable(this.__wbg_ptr);return p(t)}};Symbol.dispose&&(B.prototype[Symbol.dispose]=B.prototype.free);var U=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Q.unregister(this),t}free(){let t=this.__destroy_into_raw();n.__wbg_wasmclient_free(t,0);}__acknowledgePersistentIrohOutbox(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient___acknowledgePersistentIrohOutbox(this.__wbg_ptr,e,_);return p(r)}__advancePreferredIrohCarrier(t,e,_){let r=c(t,n.__wbindgen_export,n.__wbindgen_export2),o=i,a=c(e,n.__wbindgen_export,n.__wbindgen_export2),w=i,d=c(_,n.__wbindgen_export,n.__wbindgen_export2),l=i,f=n.wasmclient___advancePreferredIrohCarrier(this.__wbg_ptr,r,o,a,w,d,l);return p(f)}__attachIrohMoqCarrier(t,e,_,r){let o=c(t,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=c(e,n.__wbindgen_export,n.__wbindgen_export2),d=i,l=c(r,n.__wbindgen_export,n.__wbindgen_export2),f=i,m=n.wasmclient___attachIrohMoqCarrier(this.__wbg_ptr,o,a,w,d,g(_),l,f);return p(m)}__attachIrohWebRtcCarrier(t,e,_,r){let o=c(t,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=c(e,n.__wbindgen_export,n.__wbindgen_export2),d=i,l=c(r,n.__wbindgen_export,n.__wbindgen_export2),f=i,m=n.wasmclient___attachIrohWebRtcCarrier(this.__wbg_ptr,o,a,w,d,g(_),l,f);return p(m)}__beginIrohMoqCarrier(t,e,_){let r=c(t,n.__wbindgen_export,n.__wbindgen_export2),o=i,a=c(e,n.__wbindgen_export,n.__wbindgen_export2),w=i,d=n.wasmclient___beginIrohMoqCarrier(this.__wbg_ptr,r,o,a,w,_);return p(d)}__beginIrohWebRtcCarrier(t,e,_){let r=c(t,n.__wbindgen_export,n.__wbindgen_export2),o=i,a=c(e,n.__wbindgen_export,n.__wbindgen_export2),w=i,d=n.wasmclient___beginIrohWebRtcCarrier(this.__wbg_ptr,r,o,a,w,_);return p(d)}__beginPreferredIrohCarrier(t,e,_,r,o,a){let w=c(t,n.__wbindgen_export,n.__wbindgen_export2),d=i,l=c(e,n.__wbindgen_export,n.__wbindgen_export2),f=i,m=n.wasmclient___beginPreferredIrohCarrier(this.__wbg_ptr,w,d,l,f,_,r,o,a);return p(m)}__configureIrohMoqCarrier(t,e){var _=u(e)?0:c(e,n.__wbindgen_export,n.__wbindgen_export2),r=i;let o=n.wasmclient___configureIrohMoqCarrier(this.__wbg_ptr,t,_,r);return p(o)}__configureIrohRoutePolicy(t,e,_){var r=u(e)?0:c(e,n.__wbindgen_export,n.__wbindgen_export2),o=i;let a=n.wasmclient___configureIrohRoutePolicy(this.__wbg_ptr,t,r,o,g(_));return p(a)}__configureIrohWebRtcCarrier(t,e){let _=n.wasmclient___configureIrohWebRtcCarrier(this.__wbg_ptr,t,e);return p(_)}__createPersistentIrohNamespace(t,e){let _=n.wasmclient___createPersistentIrohNamespace(this.__wbg_ptr,t,e);return p(_)}__deletePersistentIrohPrefix(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=k(e,n.__wbindgen_export),a=i,w=n.wasmclient___deletePersistentIrohPrefix(this.__wbg_ptr,_,r,o,a);return p(w)}__flushPersistentIrohProtocols(){let t=n.wasmclient___flushPersistentIrohProtocols(this.__wbg_ptr);return p(t)}__handleIrohCarrierControl(t,e,_){let r=c(t,n.__wbindgen_export,n.__wbindgen_export2),o=i,a=c(e,n.__wbindgen_export,n.__wbindgen_export2),w=i,d=n.wasmclient___handleIrohCarrierControl(this.__wbg_ptr,r,o,a,w,g(_));return p(d)}__hydratePersistentIrohBlob(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient___hydratePersistentIrohBlob(this.__wbg_ptr,e,_);return p(r)}__importPersistentIrohAuthor(t){let e=k(t,n.__wbindgen_export),_=i,r=n.wasmclient___importPersistentIrohAuthor(this.__wbg_ptr,e,_);return p(r)}__importPersistentIrohNamespace(t,e,_,r){let o=c(t,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=k(e,n.__wbindgen_export),d=i,l=n.wasmclient___importPersistentIrohNamespace(this.__wbg_ptr,o,a,w,d,_,r);return p(l)}__importPersistentIrohTicket(t,e,_){let r=c(t,n.__wbindgen_export,n.__wbindgen_export2),o=i,a=n.wasmclient___importPersistentIrohTicket(this.__wbg_ptr,r,o,e,_);return p(a)}__initPersistentIrohProtocols(t){let e=n.wasmclient___initPersistentIrohProtocols(this.__wbg_ptr,g(t));return p(e)}__irohMoqCarrierFailed(t,e,_){let r=c(t,n.__wbindgen_export,n.__wbindgen_export2),o=i,a=c(e,n.__wbindgen_export,n.__wbindgen_export2),w=i,d=c(_,n.__wbindgen_export,n.__wbindgen_export2),l=i,f=n.wasmclient___irohMoqCarrierFailed(this.__wbg_ptr,r,o,a,w,d,l);return p(f)}__irohMoqCarrierPrepared(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=c(e,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=n.wasmclient___irohMoqCarrierPrepared(this.__wbg_ptr,_,r,o,a);return p(w)}__irohWebRtcCarrierFailed(t,e,_){let r=c(t,n.__wbindgen_export,n.__wbindgen_export2),o=i,a=c(e,n.__wbindgen_export,n.__wbindgen_export2),w=i,d=c(_,n.__wbindgen_export,n.__wbindgen_export2),l=i,f=n.wasmclient___irohWebRtcCarrierFailed(this.__wbg_ptr,r,o,a,w,d,l);return p(f)}__irohWebRtcCarrierPrepared(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=c(e,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=n.wasmclient___irohWebRtcCarrierPrepared(this.__wbg_ptr,_,r,o,a);return p(w)}__putPersistentIrohBytes(t,e,_){let r=c(t,n.__wbindgen_export,n.__wbindgen_export2),o=i,a=k(e,n.__wbindgen_export),w=i,d=k(_,n.__wbindgen_export),l=i,f=n.wasmclient___putPersistentIrohBytes(this.__wbg_ptr,r,o,a,w,d,l);return p(f)}__queryPersistentIrohNamespace(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=k(e,n.__wbindgen_export),a=i,w=n.wasmclient___queryPersistentIrohNamespace(this.__wbg_ptr,_,r,o,a);return p(w)}__removePersistentIrohNamespace(t,e,_){let r=c(t,n.__wbindgen_export,n.__wbindgen_export2),o=i,a=n.wasmclient___removePersistentIrohNamespace(this.__wbg_ptr,r,o,e,_);return p(a)}__retireIrohMoqCarrier(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i;var o=u(e)?0:c(e,n.__wbindgen_export,n.__wbindgen_export2),a=i;let w=n.wasmclient___retireIrohMoqCarrier(this.__wbg_ptr,_,r,o,a);return p(w)}__retireIrohWebRtcCarrier(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i;var o=u(e)?0:c(e,n.__wbindgen_export,n.__wbindgen_export2),a=i;let w=n.wasmclient___retireIrohWebRtcCarrier(this.__wbg_ptr,_,r,o,a);return p(w)}__setIrohCarrierActionHandler(t){n.wasmclient___setIrohCarrierActionHandler(this.__wbg_ptr,u(t)?0:g(t));}__setPersistentIrohHash(t,e,_,r){let o=c(t,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=k(e,n.__wbindgen_export),d=i,l=c(_,n.__wbindgen_export,n.__wbindgen_export2),f=i,m=n.wasmclient___setPersistentIrohHash(this.__wbg_ptr,o,a,w,d,l,f,r);return p(m)}__sharePersistentIrohNamespace(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=n.wasmclient___sharePersistentIrohNamespace(this.__wbg_ptr,_,r,e);return p(o)}__shutdownPersistentIrohProtocols(){let t=n.wasmclient___shutdownPersistentIrohProtocols(this.__wbg_ptr);return p(t)}add_peer_scope(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=c(e,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=n.wasmclient_add_peer_scope(this.__wbg_ptr,_,r,o,a);return p(w)}bind_connection_device_id(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=c(e,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=n.wasmclient_bind_connection_device_id(this.__wbg_ptr,_,r,o,a);return p(w)}bind_node_device_id(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=c(e,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=n.wasmclient_bind_node_device_id(this.__wbg_ptr,_,r,o,a);return p(w)}clearConnectionApplicationCryptoKey(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i;n.wasmclient_clearConnectionApplicationCryptoKey(this.__wbg_ptr,e,_);}clearIdentityCredential(){n.wasmclient_clearIdentityCredential(this.__wbg_ptr);}clear_session_tokens(){n.wasmclient_clear_session_tokens(this.__wbg_ptr);}confirm_reciprocal_admission(t,e,_,r,o,a){let w=c(t,n.__wbindgen_export,n.__wbindgen_export2),d=i,l=c(_,n.__wbindgen_export,n.__wbindgen_export2),f=i,m=c(r,n.__wbindgen_export,n.__wbindgen_export2),y=i;var v=u(a)?0:c(a,n.__wbindgen_export,n.__wbindgen_export2),R=i;let S=n.wasmclient_confirm_reciprocal_admission(this.__wbg_ptr,w,d,e,l,f,m,y,o,v,R);return p(S)}connect(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_connect(this.__wbg_ptr,e,_);return p(r)}connect_device(t,e){var _=u(t)?0:c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i;let o=c(e,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=n.wasmclient_connect_device(this.__wbg_ptr,_,r,o,a);return p(w)}connection_state(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_connection_state(this.__wbg_ptr,e,_);return p(r)}connection_states(){let t=n.wasmclient_connection_states(this.__wbg_ptr);return p(t)}create_room(t,e,_,r,o,a){let w=c(t,n.__wbindgen_export,n.__wbindgen_export2),d=i,l=c(e,n.__wbindgen_export,n.__wbindgen_export2),f=i,m=c(_,n.__wbindgen_export,n.__wbindgen_export2),y=i,v=c(r,n.__wbindgen_export,n.__wbindgen_export2),R=i,S=c(o,n.__wbindgen_export,n.__wbindgen_export2),E=i,V=n.wasmclient_create_room(this.__wbg_ptr,w,d,l,f,m,y,v,R,S,E,u(a)?Number.MAX_SAFE_INTEGER:a>>>0);return p(V)}create_session(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_create_session(this.__wbg_ptr,e,_);return p(r)}delete_device(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=c(e,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=n.wasmclient_delete_device(this.__wbg_ptr,_,r,o,a);return p(w)}devices_with_status(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_devices_with_status(this.__wbg_ptr,e,_);return p(r)}disconnect(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_disconnect(this.__wbg_ptr,e,_);return p(r)}disconnect_device(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i;var o=u(e)?0:c(e,n.__wbindgen_export,n.__wbindgen_export2),a=i;let w=n.wasmclient_disconnect_device(this.__wbg_ptr,_,r,o,a);return p(w)}disconnect_transient(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_disconnect_transient(this.__wbg_ptr,e,_);return p(r)}endpoint_id_from_ticket(t){let e,_;try{let f=n.__wbindgen_add_to_stack_pointer(-16),m=c(t,n.__wbindgen_export,n.__wbindgen_export2),y=i;n.wasmclient_endpoint_id_from_ticket(f,this.__wbg_ptr,m,y);var r=x().getInt32(f+0,!0),o=x().getInt32(f+4,!0),a=x().getInt32(f+8,!0),w=x().getInt32(f+12,!0),d=r,l=o;if(w)throw d=0,l=0,p(a);return e=d,_=l,I(d,l)}finally{n.__wbindgen_add_to_stack_pointer(16),n.__wbindgen_export4(e,_,1);}}endpoint_ticket(){let t=n.wasmclient_endpoint_ticket(this.__wbg_ptr);return p(t)}endpoint_ticket_with_token(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=n.wasmclient_endpoint_ticket_with_token(this.__wbg_ptr,_,r,e);return p(o)}force_reconnect_snapshot(){n.wasmclient_force_reconnect_snapshot(this.__wbg_ptr);}get_members(t,e,_){let r=c(t,n.__wbindgen_export,n.__wbindgen_export2),o=i,a=c(e,n.__wbindgen_export,n.__wbindgen_export2),w=i,d=c(_,n.__wbindgen_export,n.__wbindgen_export2),l=i,f=n.wasmclient_get_members(this.__wbg_ptr,r,o,a,w,d,l);return p(f)}incoming_streams(){let t=n.wasmclient_incoming_streams(this.__wbg_ptr);return p(t)}initIrohWithTestRelay(t,e){var _=u(t)?0:k(t,n.__wbindgen_export),r=i,o=u(e)?0:c(e,n.__wbindgen_export,n.__wbindgen_export2),a=i;let w=n.wasmclient_initIrohWithTestRelay(this.__wbg_ptr,_,r,o,a);return p(w)}init_iroh(t){var e=u(t)?0:k(t,n.__wbindgen_export),_=i;let r=n.wasmclient_init_iroh(this.__wbg_ptr,e,_);return p(r)}iroh_path_kind(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_iroh_path_kind(this.__wbg_ptr,e,_);return p(r)}iroh_secret_key(){let t=n.wasmclient_iroh_secret_key(this.__wbg_ptr);return p(t)}iroh_transport_rtt_ms(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_iroh_transport_rtt_ms(this.__wbg_ptr,e,_);return p(r)}is_auto_connect_excluded(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i;return n.wasmclient_is_auto_connect_excluded(this.__wbg_ptr,e,_)!==0}is_connected(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_is_connected(this.__wbg_ptr,e,_);return p(r)}is_current_transport_stable_id(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=n.wasmclient_is_current_transport_stable_id(this.__wbg_ptr,_,r,e);return p(o)}is_remote_admitted(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_is_remote_admitted(this.__wbg_ptr,e,_);return p(r)}join_room(t,e,_,r,o){let a=c(t,n.__wbindgen_export,n.__wbindgen_export2),w=i,d=c(e,n.__wbindgen_export,n.__wbindgen_export2),l=i,f=c(_,n.__wbindgen_export,n.__wbindgen_export2),m=i,y=c(r,n.__wbindgen_export,n.__wbindgen_export2),v=i,R=c(o,n.__wbindgen_export,n.__wbindgen_export2),S=i,E=n.wasmclient_join_room(this.__wbg_ptr,a,w,d,l,f,m,y,v,R,S);return p(E)}leave_room(t,e,_){let r=c(t,n.__wbindgen_export,n.__wbindgen_export2),o=i,a=c(e,n.__wbindgen_export,n.__wbindgen_export2),w=i,d=c(_,n.__wbindgen_export,n.__wbindgen_export2),l=i,f=n.wasmclient_leave_room(this.__wbg_ptr,r,o,a,w,d,l);return p(f)}list_managed_connections(){let t=n.wasmclient_list_managed_connections(this.__wbg_ptr);return p(t)}constructor(t){try{let o=n.__wbindgen_add_to_stack_pointer(-16),a=c(t,n.__wbindgen_export,n.__wbindgen_export2),w=i;n.wasmclient_new(o,a,w);var e=x().getInt32(o+0,!0),_=x().getInt32(o+4,!0),r=x().getInt32(o+8,!0);if(r)throw p(_);return this.__wbg_ptr=e,Q.register(this,this.__wbg_ptr,this),this}finally{n.__wbindgen_add_to_stack_pointer(16);}}node_addr(){let t=n.wasmclient_node_addr(this.__wbg_ptr);return p(t)}open_bi(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_open_bi(this.__wbg_ptr,e,_);return p(r)}open_native_main_control_bi(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_open_native_main_control_bi(this.__wbg_ptr,e,_);return p(r)}open_peer_bi(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=n.wasmclient_open_peer_bi(this.__wbg_ptr,_,r,u(e)?Number.MAX_SAFE_INTEGER:e>>>0);return p(o)}open_peer_bi_explicit_file_sender(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=n.wasmclient_open_peer_bi_explicit_file_sender(this.__wbg_ptr,_,r,u(e)?Number.MAX_SAFE_INTEGER:e>>>0);return p(o)}open_peer_bi_transport_only(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=n.wasmclient_open_peer_bi_transport_only(this.__wbg_ptr,_,r,u(e)?Number.MAX_SAFE_INTEGER:e>>>0);return p(o)}open_peer_native_bi(t,e,_){let r=c(t,n.__wbindgen_export,n.__wbindgen_export2),o=i,a=c(e,n.__wbindgen_export,n.__wbindgen_export2),w=i,d=n.wasmclient_open_peer_native_bi(this.__wbg_ptr,r,o,a,w,u(_)?Number.MAX_SAFE_INTEGER:_>>>0);return p(d)}open_peer_uni(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=n.wasmclient_open_peer_uni(this.__wbg_ptr,_,r,u(e)?Number.MAX_SAFE_INTEGER:e>>>0);return p(o)}open_uni(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_open_uni(this.__wbg_ptr,e,_);return p(r)}peer_scopes(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_peer_scopes(this.__wbg_ptr,e,_);return p(r)}peer_session(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_peer_session(this.__wbg_ptr,e,_);return p(r)}peer_sessions(){let t=n.wasmclient_peer_sessions(this.__wbg_ptr);return p(t)}peer_snapshot(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_peer_snapshot(this.__wbg_ptr,e,_);return p(r)}prepare_reciprocal_admission(t,e,_,r,o,a,w,d){let l=c(t,n.__wbindgen_export,n.__wbindgen_export2),f=i,m=c(_,n.__wbindgen_export,n.__wbindgen_export2),y=i,v=c(r,n.__wbindgen_export,n.__wbindgen_export2),R=i,S=c(o,n.__wbindgen_export,n.__wbindgen_export2),E=i,V=c(a,n.__wbindgen_export,n.__wbindgen_export2),_t=i,rt=c(w,n.__wbindgen_export,n.__wbindgen_export2),ot=i,it=c(d,n.__wbindgen_export,n.__wbindgen_export2),st=i,ct=n.wasmclient_prepare_reciprocal_admission(this.__wbg_ptr,l,f,e,m,y,v,R,S,E,V,_t,rt,ot,it,st);return p(ct)}present_session_token(t,e,_,r){let o=c(t,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=c(e,n.__wbindgen_export,n.__wbindgen_export2),d=i;var l=u(_)?0:c(_,n.__wbindgen_export,n.__wbindgen_export2),f=i,m=u(r)?0:c(r,n.__wbindgen_export,n.__wbindgen_export2),y=i;let v=n.wasmclient_present_session_token(this.__wbg_ptr,o,a,w,d,l,f,m,y);return p(v)}rankRoutes(t,e){try{let a=n.__wbindgen_add_to_stack_pointer(-16),w=tt(t,n.__wbindgen_export),d=i,l=tt(e,n.__wbindgen_export),f=i;n.wasmclient_rankRoutes(a,this.__wbg_ptr,w,d,l,f);var _=x().getInt32(a+0,!0),r=x().getInt32(a+4,!0),o=At(_,r).slice();return n.__wbindgen_export4(_,r*4,4),o}finally{n.__wbindgen_add_to_stack_pointer(16);}}register_session_token(t,e,_){let r=c(t,n.__wbindgen_export,n.__wbindgen_export2),o=i,a=c(e,n.__wbindgen_export,n.__wbindgen_export2),w=i;n.wasmclient_register_session_token(this.__wbg_ptr,r,o,a,w,_);}register_token_until(t,e,_,r){let o=c(t,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=c(e,n.__wbindgen_export,n.__wbindgen_export2),d=i;n.wasmclient_register_token_until(this.__wbg_ptr,o,a,w,d,_,r);}reject_connection_admission(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=c(e,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=n.wasmclient_reject_connection_admission(this.__wbg_ptr,_,r,o,a);return p(w)}release_peer_scope(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i;var o=u(e)?0:c(e,n.__wbindgen_export,n.__wbindgen_export2),a=i;let w=n.wasmclient_release_peer_scope(this.__wbg_ptr,_,r,o,a);return p(w)}report_managed_connection_settled(t,e,_,r,o,a){let w=c(t,n.__wbindgen_export,n.__wbindgen_export2),d=i;var l=u(_)?0:c(_,n.__wbindgen_export,n.__wbindgen_export2),f=i;let m=n.wasmclient_report_managed_connection_settled(this.__wbg_ptr,w,d,e,l,f,!u(r),u(r)?BigInt(0):r,!u(o),u(o)?BigInt(0):o,!u(a),u(a)?BigInt(0):a);return p(m)}report_transport_status(t,e,_,r,o,a){let w=c(t,n.__wbindgen_export,n.__wbindgen_export2),d=i,l=c(e,n.__wbindgen_export,n.__wbindgen_export2),f=i;var m=u(_)?0:c(_,n.__wbindgen_export,n.__wbindgen_export2),y=i;let v=n.wasmclient_report_transport_status(this.__wbg_ptr,w,d,l,f,m,y,!u(r),u(r)?BigInt(0):r,!u(o),u(o)?BigInt(0):o,!u(a),u(a)?BigInt(0):a);return p(v)}resolve_peer_connection_records(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_resolve_peer_connection_records(this.__wbg_ptr,e,_);return p(r)}revoke_session_token(t){try{let o=n.__wbindgen_add_to_stack_pointer(-16),a=c(t,n.__wbindgen_export,n.__wbindgen_export2),w=i;n.wasmclient_revoke_session_token(o,this.__wbg_ptr,a,w);var e=x().getInt32(o+0,!0),_=x().getInt32(o+4,!0),r=x().getInt32(o+8,!0);if(r)throw p(_);return p(e)}finally{n.__wbindgen_add_to_stack_pointer(16);}}revoke_tokens_by_scope(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_revoke_tokens_by_scope(this.__wbg_ptr,e,_);return p(r)}runtime_policy(){try{let r=n.__wbindgen_add_to_stack_pointer(-16);n.wasmclient_runtime_policy(r,this.__wbg_ptr);var t=x().getInt32(r+0,!0),e=x().getInt32(r+4,!0),_=x().getInt32(r+8,!0);if(_)throw p(e);return p(t)}finally{n.__wbindgen_add_to_stack_pointer(16);}}same_peer(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=c(e,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=n.wasmclient_same_peer(this.__wbg_ptr,_,r,o,a);return p(w)}search_devices(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_search_devices(this.__wbg_ptr,e,_);return p(r)}send_message(t,e,_,r){let o=c(t,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=c(e,n.__wbindgen_export,n.__wbindgen_export2),d=i;var l=u(_)?0:c(_,n.__wbindgen_export,n.__wbindgen_export2),f=i,m=u(r)?0:c(r,n.__wbindgen_export,n.__wbindgen_export2),y=i;let v=n.wasmclient_send_message(this.__wbg_ptr,o,a,w,d,l,f,m,y);return p(v)}send_native_main_control_frame(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=k(e,n.__wbindgen_export),a=i,w=n.wasmclient_send_native_main_control_frame(this.__wbg_ptr,_,r,o,a);return p(w)}send_peer(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=k(e,n.__wbindgen_export),a=i,w=n.wasmclient_send_peer(this.__wbg_ptr,_,r,o,a);return p(w)}send_peer_application_frame(t,e,_){let r=c(t,n.__wbindgen_export,n.__wbindgen_export2),o=i,a=k(e,n.__wbindgen_export),w=i,d=n.wasmclient_send_peer_application_frame(this.__wbg_ptr,r,o,a,w,u(_)?Number.MAX_SAFE_INTEGER:_>>>0);return p(d)}setConnectionApplicationCryptoKey(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=k(e,n.__wbindgen_export),a=i,w=n.wasmclient_setConnectionApplicationCryptoKey(this.__wbg_ptr,_,r,o,a);return p(w)}setConnectionApplicationCryptoRequired(t){try{let r=n.__wbindgen_add_to_stack_pointer(-16),o=c(t,n.__wbindgen_export,n.__wbindgen_export2),a=i;n.wasmclient_setConnectionApplicationCryptoRequired(r,this.__wbg_ptr,o,a);var e=x().getInt32(r+0,!0),_=x().getInt32(r+4,!0);if(_)throw p(e)}finally{n.__wbindgen_add_to_stack_pointer(16);}}setIdentityCredential(t){var e=u(t)?0:c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i;n.wasmclient_setIdentityCredential(this.__wbg_ptr,e,_);}setRelay(t){let e=n.wasmclient_setRelay(this.__wbg_ptr,t);return p(e)}set_auto_connect_excluded(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=n.wasmclient_set_auto_connect_excluded(this.__wbg_ptr,_,r,e);return p(o)}set_offline(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmclient_set_offline(this.__wbg_ptr,e,_);return p(r)}start_auto_connect(t,e){try{let o=n.__wbindgen_add_to_stack_pointer(-16),a=c(t,n.__wbindgen_export,n.__wbindgen_export2),w=i,d=c(e,n.__wbindgen_export,n.__wbindgen_export2),l=i;n.wasmclient_start_auto_connect(o,this.__wbg_ptr,a,w,d,l);var _=x().getInt32(o+0,!0),r=x().getInt32(o+4,!0);if(r)throw p(_)}finally{n.__wbindgen_add_to_stack_pointer(16);}}start_presence_loop(t,e,_,r){let o=c(t,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=c(e,n.__wbindgen_export,n.__wbindgen_export2),d=i,l=c(_,n.__wbindgen_export,n.__wbindgen_export2),f=i;var m=u(r)?0:c(r,n.__wbindgen_export,n.__wbindgen_export2),y=i;n.wasmclient_start_presence_loop(this.__wbg_ptr,o,a,w,d,l,f,m,y);}stop_auth_scoped_activity(){n.wasmclient_stop_auth_scoped_activity(this.__wbg_ptr);}stop_auto_connect(){n.wasmclient_stop_auto_connect(this.__wbg_ptr);}stop_presence_loop(){n.wasmclient_stop_presence_loop(this.__wbg_ptr);}submit_browser_desired_peers(t,e){try{let a=n.__wbindgen_add_to_stack_pointer(-16),w=c(e,n.__wbindgen_export,n.__wbindgen_export2),d=i;n.wasmclient_submit_browser_desired_peers(a,this.__wbg_ptr,t,w,d);var _=x().getInt32(a+0,!0),r=x().getInt32(a+4,!0),o=x().getInt32(a+8,!0);if(o)throw p(r);return _!==0}finally{n.__wbindgen_add_to_stack_pointer(16);}}update_device(t,e,_,r,o){let a=c(t,n.__wbindgen_export,n.__wbindgen_export2),w=i,d=c(e,n.__wbindgen_export,n.__wbindgen_export2),l=i;var f=u(_)?0:c(_,n.__wbindgen_export,n.__wbindgen_export2),m=i,y=u(o)?0:c(o,n.__wbindgen_export,n.__wbindgen_export2),v=i;let R=n.wasmclient_update_device(this.__wbg_ptr,a,w,d,l,f,m,u(r)?0:g(r),y,v);return p(R)}update_presence(t,e,_,r,o){let a=c(t,n.__wbindgen_export,n.__wbindgen_export2),w=i,d=c(e,n.__wbindgen_export,n.__wbindgen_export2),l=i,f=c(_,n.__wbindgen_export,n.__wbindgen_export2),m=i;var y=u(r)?0:c(r,n.__wbindgen_export,n.__wbindgen_export2),v=i;let R=n.wasmclient_update_presence(this.__wbg_ptr,a,w,d,l,f,m,y,v,!u(o),u(o)?BigInt(0):o);return p(R)}update_session(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=c(e,n.__wbindgen_export,n.__wbindgen_export2),a=i,w=n.wasmclient_update_session(this.__wbg_ptr,_,r,o,a);return p(w)}validate_connection_token(t,e,_){let r=c(t,n.__wbindgen_export,n.__wbindgen_export2),o=i,a=c(e,n.__wbindgen_export,n.__wbindgen_export2),w=i;var d=u(_)?0:c(_,n.__wbindgen_export,n.__wbindgen_export2),l=i;let f=n.wasmclient_validate_connection_token(this.__wbg_ptr,r,o,a,w,d,l);return p(f)}validate_session_token(t){let e,_;try{let f=n.__wbindgen_add_to_stack_pointer(-16),m=c(t,n.__wbindgen_export,n.__wbindgen_export2),y=i;n.wasmclient_validate_session_token(f,this.__wbg_ptr,m,y);var r=x().getInt32(f+0,!0),o=x().getInt32(f+4,!0),a=x().getInt32(f+8,!0),w=x().getInt32(f+12,!0),d=r,l=o;if(w)throw d=0,l=0,p(a);return e=d,_=l,I(d,l)}finally{n.__wbindgen_add_to_stack_pointer(16),n.__wbindgen_export4(e,_,1);}}wait_for_peer(t,e){let _=c(t,n.__wbindgen_export,n.__wbindgen_export2),r=i,o=n.wasmclient_wait_for_peer(this.__wbg_ptr,_,r,u(e)?Number.MAX_SAFE_INTEGER:e>>>0);return p(o)}wake_browser_auto_connect(){return n.wasmclient_wake_browser_auto_connect(this.__wbg_ptr)!==0}};Symbol.dispose&&(U.prototype[Symbol.dispose]=U.prototype.free);var D=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Z.unregister(this),t}free(){let t=this.__destroy_into_raw();n.__wbg_wasmconnection_free(t,0);}create_data_channel(t){let e=c(t,n.__wbindgen_export,n.__wbindgen_export2),_=i,r=n.wasmconnection_create_data_channel(this.__wbg_ptr,e,_);return p(r)}constructor(){try{let r=n.__wbindgen_add_to_stack_pointer(-16);n.wasmconnection_new(r);var t=x().getInt32(r+0,!0),e=x().getInt32(r+4,!0),_=x().getInt32(r+8,!0);if(_)throw p(e);return this.__wbg_ptr=t,Z.register(this,this.__wbg_ptr,this),this}finally{n.__wbindgen_add_to_stack_pointer(16);}}};Symbol.dispose&&(D.prototype[Symbol.dispose]=D.prototype.free);function Wt(){n.start();}function et(){return {__proto__:null,"./openrtc_bg.js":{__proto__:null,__wbg_Error_9dc85fe1bc224456:function(t,e){let _=Error(I(t,e));return g(_)},__wbg_Number_4779d427bae39753:function(t){return Number(s(t))},__wbg_String_8564e559799eccda:function(t,e){let _=String(s(e)),r=c(_,n.__wbindgen_export,n.__wbindgen_export2),o=i;x().setInt32(t+4,o,true),x().setInt32(t+0,r,true);},__wbg___wbindgen_bigint_get_as_i64_8ea6736501f396b6:function(t,e){let _=s(e),r=typeof _=="bigint"?_:void 0;x().setBigInt64(t+8,u(r)?BigInt(0):r,true),x().setInt32(t+0,!u(r),true);},__wbg___wbindgen_boolean_get_b131b2f36d6b2f55:function(t){let e=s(t),_=typeof e=="boolean"?e:void 0;return u(_)?16777215:_?1:0},__wbg___wbindgen_debug_string_56c147eb1a51f0c4:function(t,e){let _=H(s(e)),r=c(_,n.__wbindgen_export,n.__wbindgen_export2),o=i;x().setInt32(t+4,o,true),x().setInt32(t+0,r,true);},__wbg___wbindgen_in_ce8569b2fc6f5088:function(t,e){return s(t)in s(e)},__wbg___wbindgen_is_bigint_df272c65456269c2:function(t){return typeof s(t)=="bigint"},__wbg___wbindgen_is_function_147961669f068cd4:function(t){return typeof s(t)=="function"},__wbg___wbindgen_is_null_ced4761460071341:function(t){return s(t)===null},__wbg___wbindgen_is_object_3a2c414391dbf751:function(t){let e=s(t);return typeof e=="object"&&e!==null},__wbg___wbindgen_is_string_6541b0f6ecd4e8e5:function(t){return typeof s(t)=="string"},__wbg___wbindgen_is_undefined_4410e3c20a99fa97:function(t){return s(t)===void 0},__wbg___wbindgen_jsval_eq_174c93ec61bab0c5:function(t,e){return s(t)===s(e)},__wbg___wbindgen_jsval_loose_eq_e07e3b1f5db6da6c:function(t,e){return s(t)==s(e)},__wbg___wbindgen_number_get_588ed6b97f0d7e14:function(t,e){let _=s(e),r=typeof _=="number"?_:void 0;x().setFloat64(t+8,u(r)?0:r,true),x().setInt32(t+0,!u(r),true);},__wbg___wbindgen_string_get_fa2687d531ed17a5:function(t,e){let _=s(e),r=typeof _=="string"?_:void 0;var o=u(r)?0:c(r,n.__wbindgen_export,n.__wbindgen_export2),a=i;x().setInt32(t+4,a,true),x().setInt32(t+0,o,true);},__wbg___wbindgen_throw_bbadd78c1bac3a77:function(t,e){throw new Error(I(t,e))},__wbg__wbg_cb_unref_c2301a3c9b78104b:function(t){s(t)._wbg_cb_unref();},__wbg_abort_56c00f462c9261d9:function(t,e){s(t).abort(s(e));},__wbg_abort_f2416f4a9852003e:function(t){s(t).abort();},__wbg_addEventListener_b635263c509aa7de:function(){return h(function(t,e,_,r){s(t).addEventListener(I(e,_),s(r));},arguments)},__wbg_append_c5a0c94a6a73b22e:function(){return h(function(t,e,_,r,o){s(t).append(I(e,_),I(r,o));},arguments)},__wbg_apply_5d99f956e2dda74d:function(){return h(function(t,e,_){let r=s(t).apply(s(e),s(_));return g(r)},arguments)},__wbg_arrayBuffer_cc7704fa158b907a:function(){return h(function(t){let e=s(t).arrayBuffer();return g(e)},arguments)},__wbg_bistream_new:function(t){let e=q.__wrap(t);return g(e)},__wbg_body_442a47f02322d7b0:function(t){let e=s(t).body;return u(e)?0:g(e)},__wbg_buffer_8524b3453cde4918:function(t){let e=s(t).buffer;return g(e)},__wbg_bufferedAmount_c1581bbb06f4f36c:function(t){return s(t).bufferedAmount},__wbg_byobRequest_cc72d210de793e64:function(t){let e=s(t).byobRequest;return u(e)?0:g(e)},__wbg_byteLength_96807b1d9ab24a4c:function(t){return s(t).byteLength},__wbg_byteOffset_a9c7002428843c41:function(t){return s(t).byteOffset},__wbg_call_91f00ddc43e01490:function(){return h(function(t,e){let _=s(t).call(s(e));return g(_)},arguments)},__wbg_call_ec09a4cf93377d3a:function(){return h(function(t,e,_){let r=s(t).call(s(e),s(_));return g(r)},arguments)},__wbg_cancel_f3a197b26dc88b39:function(t){let e=s(t).cancel();return g(e)},__wbg_catch_66060324c27be6f7:function(t,e){let _=s(t).catch(s(e));return g(_)},__wbg_clearTimeout_113b1cde814ec762:function(t){let e=clearTimeout(p(t));return g(e)},__wbg_clearTimeout_333bba87532ab9d3:function(t){let e=clearTimeout(p(t));return g(e)},__wbg_clearTimeout_47a40e3be01ed7a3:function(){return h(function(t,e){s(t).clearTimeout(p(e));},arguments)},__wbg_close_296263cfe1bb2999:function(){return h(function(t){s(t).close();},arguments)},__wbg_close_388d99468213b286:function(){return h(function(t){s(t).close();},arguments)},__wbg_close_4857e22d08b71356:function(){return h(function(t){s(t).close();},arguments)},__wbg_close_f3365df7ba1b74d3:function(t){s(t).close();},__wbg_code_1cda2855fcd9b009:function(t){return s(t).code},__wbg_code_70beb7b22374d55e:function(t){return s(t).code},__wbg_createDataChannel_122bd3d8aacee49b:function(t,e,_){let r=s(t).createDataChannel(I(e,_));return g(r)},__wbg_crypto_38df2bab126b63dc:function(t){let e=s(t).crypto;return g(e)},__wbg_data_8a04443c1e5a8cd3:function(t){let e=s(t).data;return g(e)},__wbg_dispatchEvent_cc62a6a43d28b01c:function(){return h(function(t,e){return s(t).dispatchEvent(s(e))},arguments)},__wbg_done_6a8439e544ec6206:function(t){return s(t).done},__wbg_enqueue_bbeb09ba0b140f76:function(){return h(function(t,e){s(t).enqueue(s(e));},arguments)},__wbg_entries_4e00eefd3fd54cf1:function(t){let e=s(t).entries();return g(e)},__wbg_entries_5a6a7e7e0df09fe5:function(t){let e=Object.entries(s(t));return g(e)},__wbg_error_6651fee1c71e5da9:function(t){console.error(s(t));},__wbg_error_9a99766f65a03031:function(t,e){console.error(s(t),s(e));},__wbg_error_a6fa202b58aa1cd3:function(t,e){let _,r;try{_=t,r=e,console.error(I(t,e));}finally{n.__wbindgen_export4(_,r,1);}},__wbg_fetch_074561c3e313c86f:function(t){let e=fetch(s(t));return g(e)},__wbg_fetch_22858a12fcf93152:function(t,e){let _=s(t).fetch(s(e));return g(_)},__wbg_from_8a57180716c586ee:function(t){let e=Array.from(s(t));return g(e)},__wbg_getRandomValues_76dfc69825c9c552:function(){return h(function(t,e){globalThis.crypto.getRandomValues(A(t,e));},arguments)},__wbg_getRandomValues_c44a50d8cfdaebeb:function(){return h(function(t,e){s(t).getRandomValues(s(e));},arguments)},__wbg_getReader_9facd4f899beac89:function(){return h(function(t){let e=s(t).getReader();return g(e)},arguments)},__wbg_get_44e98e27bda25b5b:function(){return h(function(t,e){let _=Reflect.get(s(t),s(e));return g(_)},arguments)},__wbg_get_4b90d6d8c5deb5d5:function(t,e){let _=s(t)[e>>>0];return g(_)},__wbg_get_52a8a619f7b88df6:function(){return h(function(t,e){let _=Reflect.get(s(t),s(e));return g(_)},arguments)},__wbg_get_done_c21b9933fc9a9e9c:function(t){let e=s(t).done;return u(e)?16777215:e?1:0},__wbg_get_unchecked_46e778e3cec74b5e:function(t,e){let _=s(t)[e>>>0];return g(_)},__wbg_get_value_ad568c7d3db9073f:function(t){let e=s(t).value;return g(e)},__wbg_get_with_ref_key_6412cf3094599694:function(t,e){let _=s(t)[s(e)];return g(_)},__wbg_has_14676d88c1340d2c:function(){return h(function(t,e){return Reflect.has(s(t),s(e))},arguments)},__wbg_headers_5b19cf40627ae54d:function(t){let e=s(t).headers;return g(e)},__wbg_info_a2b5f8a5dae8b26c:function(t){console.info(s(t));},__wbg_instanceof_ArrayBuffer_a581da923203f29f:function(t){let e;try{e=s(t)instanceof ArrayBuffer;}catch{e=false;}return e},__wbg_instanceof_Blob_5c4e145be35f9b1e:function(t){let e;try{e=s(t)instanceof Blob;}catch{e=false;}return e},__wbg_instanceof_Map_7f94c740225003e2:function(t){let e;try{e=s(t)instanceof Map;}catch{e=false;}return e},__wbg_instanceof_Promise_aa24ea31000d4ee6:function(t){let e;try{e=s(t)instanceof Promise;}catch{e=false;}return e},__wbg_instanceof_Response_36a65a969abaa7c6:function(t){let e;try{e=s(t)instanceof Response;}catch{e=false;}return e},__wbg_instanceof_Uint8Array_b6fe1ac89eba107e:function(t){let e;try{e=s(t)instanceof Uint8Array;}catch{e=false;}return e},__wbg_instanceof_Window_9e0fe7d3d1ff4342:function(t){let e;try{e=s(t)instanceof Window;}catch{e=false;}return e},__wbg_isArray_139f48e3c057ede8:function(t){return Array.isArray(s(t))},__wbg_isSafeInteger_c22ccb4af2201fe9:function(t){return Number.isSafeInteger(s(t))},__wbg_iterator_9b36cebf3be7b7cd:function(){return g(Symbol.iterator)},__wbg_length_68a9d5278d084f4f:function(t){return s(t).length},__wbg_length_fb04d16d7bdf6d4c:function(t){return s(t).length},__wbg_log_6614a4effdb4e983:function(t){console.log(s(t));},__wbg_maxRetransmits_dfa0382c31f8e2ca:function(t){let e=s(t).maxRetransmits;return u(e)?16777215:e},__wbg_message_12958526424a887b:function(t,e){let _=s(e).message,r=c(_,n.__wbindgen_export,n.__wbindgen_export2),o=i;x().setInt32(t+4,o,true),x().setInt32(t+0,r,true);},__wbg_msCrypto_bd5a034af96bcba6:function(t){let e=s(t).msCrypto;return g(e)},__wbg_new_0b303268aa395a38:function(){let t=new Array;return g(t)},__wbg_new_189262ff31890c23:function(){return h(function(){let t=new Headers;return g(t)},arguments)},__wbg_new_20b778a4c5c691c3:function(){let t=new Object;return g(t)},__wbg_new_227d7c05414eb861:function(){let t=new Error;return g(t)},__wbg_new_24739629d416f982:function(){return h(function(){let t=new AbortController;return g(t)},arguments)},__wbg_new_5fae30e6b23db8df:function(t,e){let _=new Error(I(t,e));return g(_)},__wbg_new_883c0db065f06efd:function(){return g(new Map)},__wbg_new_a3e5112401a82338:function(){return h(function(t,e){let _=new WebSocket(I(t,e));return g(_)},arguments)},__wbg_new_b06772b280cc6e52:function(t){let e=new Uint8Array(s(t));return g(e)},__wbg_new_from_slice_bb2d1778c0b87eb1:function(t,e){let _=new Uint8Array(A(t,e));return g(_)},__wbg_new_typed_90c3f6c29ba36d19:function(t,e){try{var _={a:t,b:e},r=(a,w)=>{let d=_.a;_.a=0;try{return xt(d,_.b,a,w)}finally{_.a=d;}};let o=new Promise(r);return g(o)}finally{_.a=0;}},__wbg_new_with_byte_offset_and_length_9e1e664fe1a5d385:function(t,e,_){let r=new Uint8Array(s(t),e>>>0,_>>>0);return g(r)},__wbg_new_with_configuration_3a96aa953ca17197:function(){return h(function(t){let e=new RTCPeerConnection(s(t));return g(e)},arguments)},__wbg_new_with_event_init_dict_bd850674488710b1:function(){return h(function(t,e,_){let r=new CustomEvent(I(t,e),s(_));return g(r)},arguments)},__wbg_new_with_into_underlying_sink_2596343f9b6c8e58:function(t){let e=new WritableStream(N.__wrap(t));return g(e)},__wbg_new_with_into_underlying_source_fd904252f385f59c:function(t,e){let _=new ReadableStream(O.__wrap(t),p(e));return g(_)},__wbg_new_with_length_4b57a7a5dc67221c:function(t){let e=new Uint8Array(t>>>0);return g(e)},__wbg_new_with_str_and_init_df876572184fe639:function(){return h(function(t,e,_){let r=new Request(I(t,e),s(_));return g(r)},arguments)},__wbg_new_with_str_sequence_505a4829cc247e79:function(){return h(function(t,e,_){let r=new WebSocket(I(t,e),s(_));return g(r)},arguments)},__wbg_next_8cb028b6ba50743f:function(){return h(function(t){let e=s(t).next();return g(e)},arguments)},__wbg_next_cfd0b146c9538df8:function(t){let e=s(t).next;return g(e)},__wbg_node_84ea875411254db1:function(t){let e=s(t).node;return g(e)},__wbg_now_bce4dc999095ea77:function(){return Date.now()},__wbg_now_e7c6795a7f81e10f:function(t){return s(t).now()},__wbg_parse_a5c06e19bc1187fd:function(t,e){return Date.parse(I(t,e))},__wbg_peerunistream_new:function(t){let e=B.__wrap(t);return g(e)},__wbg_performance_3fcf6e32a7e1ed0a:function(t){let e=s(t).performance;return g(e)},__wbg_process_44c7a14e11e9f69e:function(t){let e=s(t).process;return g(e)},__wbg_protocol_28aaef5ea42981d6:function(t,e){let _=s(e).protocol,r=c(_,n.__wbindgen_export,n.__wbindgen_export2),o=i;x().setInt32(t+4,o,true),x().setInt32(t+0,r,true);},__wbg_prototypesetcall_956c7493c68e29b4:function(t,e,_){Uint8Array.prototype.set.call(A(t,e),s(_));},__wbg_push_ceb8ef046afb2041:function(t,e){return s(t).push(s(e))},__wbg_queueMicrotask_4698f900840e3286:function(t){queueMicrotask(s(t));},__wbg_queueMicrotask_477a5533c7100338:function(t){let e=s(t).queueMicrotask;return g(e)},__wbg_randomFillSync_6c25eac9869eb53c:function(){return h(function(t,e){s(t).randomFillSync(p(e));},arguments)},__wbg_read_8426c146431f2905:function(t){let e=s(t).read();return g(e)},__wbg_readyState_25243ad6ce649774:function(t){return s(t).readyState},__wbg_reason_4ec455bac79b33ce:function(t,e){let _=s(e).reason,r=c(_,n.__wbindgen_export,n.__wbindgen_export2),o=i;x().setInt32(t+4,o,true),x().setInt32(t+0,r,true);},__wbg_releaseLock_188846ef719acb10:function(t){s(t).releaseLock();},__wbg_removeEventListener_016c1d24523b4730:function(){return h(function(t,e,_,r){s(t).removeEventListener(I(e,_),s(r));},arguments)},__wbg_require_b4edbdcf3e2a1ef0:function(){return h(function(){let t=module.require;return g(t)},arguments)},__wbg_resolve_0183de2e8c6b1d54:function(t){let e=Promise.resolve(s(t));return g(e)},__wbg_respond_3cdb4cf32683fd79:function(){return h(function(t,e){s(t).respond(e>>>0);},arguments)},__wbg_send_77521d09456dd693:function(){return h(function(t,e,_){s(t).send(A(e,_));},arguments)},__wbg_send_99d049cae69c53cc:function(){return h(function(t,e,_){s(t).send(A(e,_));},arguments)},__wbg_send_bac9d3dc4f21ef28:function(){return h(function(t,e,_){s(t).send(I(e,_));},arguments)},__wbg_setTimeout_3a808dd861dd3c12:function(t,e){let _=setTimeout(s(t),e);return g(_)},__wbg_setTimeout_6613a51400c1bf9f:function(){return h(function(t,e,_){let r=s(t).setTimeout(p(e),_);return g(r)},arguments)},__wbg_setTimeout_ef24d2fc3ad97385:function(){return h(function(t,e){let _=setTimeout(s(t),e);return g(_)},arguments)},__wbg_set_5f806304fb633ab3:function(t,e,_){let r=s(t).set(s(e),s(_));return g(r)},__wbg_set_6be42768c690e380:function(t,e,_){s(t)[p(e)]=p(_);},__wbg_set_86698c227e5b9dad:function(t,e,_){s(t).set(A(e,_));},__wbg_set_a6ba3ac0e634b822:function(){return h(function(t,e,_){return Reflect.set(s(t),s(e),s(_))},arguments)},__wbg_set_binaryType_07905e4563fcd9b2:function(t,e){s(t).binaryType=kt[e];},__wbg_set_binaryType_8c2dd2cf1cfc2e28:function(t,e){s(t).binaryType=ht[e];},__wbg_set_body_d1153b16a2b95ca1:function(t,e){s(t).body=s(e);},__wbg_set_bufferedAmountLowThreshold_8969a2db2c745257:function(t,e){s(t).bufferedAmountLowThreshold=e>>>0;},__wbg_set_cache_5a01a8b5e6ca6cf2:function(t,e){s(t).cache=yt[e];},__wbg_set_credentials_e9120ed88b1fc0b8:function(t,e){s(t).credentials=It[e];},__wbg_set_da33c120a6584674:function(t,e,_){s(t)[e>>>0]=p(_);},__wbg_set_detail_c7af5edea934390b:function(t,e){s(t).detail=s(e);},__wbg_set_handle_event_6147c38b782c7b42:function(t,e){s(t).handleEvent=s(e);},__wbg_set_headers_877ed41890d28af2:function(t,e){s(t).headers=s(e);},__wbg_set_high_water_mark_77da20c49668427d:function(t,e){s(t).highWaterMark=e;},__wbg_set_method_b4ede299b2064f37:function(t,e,_){s(t).method=I(e,_);},__wbg_set_mode_d6c2e1991aa963c6:function(t,e){s(t).mode=vt[e];},__wbg_set_onbufferedamountlow_b695487bdd219f98:function(t,e){s(t).onbufferedamountlow=s(e);},__wbg_set_onclose_9cb5c3372e16c192:function(t,e){s(t).onclose=s(e);},__wbg_set_onclose_f8bec1cbeb64aa93:function(t,e){s(t).onclose=s(e);},__wbg_set_onerror_190fe67e911ebf28:function(t,e){s(t).onerror=s(e);},__wbg_set_onmessage_4d57c4ddab951294:function(t,e){s(t).onmessage=s(e);},__wbg_set_onmessage_96337495f0bfb796:function(t,e){s(t).onmessage=s(e);},__wbg_set_onopen_3e2bf6b11d434c2d:function(t,e){s(t).onopen=s(e);},__wbg_set_signal_9022b5aa06a6ce5b:function(t,e){s(t).signal=s(e);},__wbg_signal_41dd1a8913cd0b7d:function(t){let e=s(t).signal;return g(e)},__wbg_stack_3b0d974bbf31e44f:function(t,e){let _=s(e).stack,r=c(_,n.__wbindgen_export,n.__wbindgen_export2),o=i;x().setInt32(t+4,o,true),x().setInt32(t+0,r,true);},__wbg_static_accessor_GLOBAL_60a4124bab7dcc9a:function(){let t=typeof global>"u"?null:global;return u(t)?0:g(t)},__wbg_static_accessor_GLOBAL_THIS_95ca6460658b5d13:function(){let t=typeof globalThis>"u"?null:globalThis;return u(t)?0:g(t)},__wbg_static_accessor_SELF_4c95f759a91e9aae:function(){let t=typeof self>"u"?null:self;return u(t)?0:g(t)},__wbg_static_accessor_WINDOW_44b435597f9e9ee7:function(){let t=typeof window>"u"?null:window;return u(t)?0:g(t)},__wbg_status_9e6505cfa3e73a7c:function(t){return s(t).status},__wbg_subarray_42216645a367cd7a:function(t,e,_){let r=s(t).subarray(e>>>0,_>>>0);return g(r)},__wbg_then_254bab9b266a77a5:function(t,e,_){let r=s(t).then(s(e),s(_));return g(r)},__wbg_then_3ea18602c6a5123b:function(t,e){let _=s(t).then(s(e));return g(_)},__wbg_url_72c67c175685a054:function(t,e){let _=s(e).url,r=c(_,n.__wbindgen_export,n.__wbindgen_export2),o=i;x().setInt32(t+4,o,true),x().setInt32(t+0,r,true);},__wbg_url_d0b8042af0d1bbba:function(t,e){let _=s(e).url,r=c(_,n.__wbindgen_export,n.__wbindgen_export2),o=i;x().setInt32(t+4,o,true),x().setInt32(t+0,r,true);},__wbg_value_3d3defe09fb1ffca:function(t){let e=s(t).value;return g(e)},__wbg_versions_276b2795b1c6a219:function(t){let e=s(t).versions;return g(e)},__wbg_view_15fa5865c6b336e3:function(t){let e=s(t).view;return u(e)?0:g(e)},__wbg_warn_633bacc13ba7e6c3:function(t){console.warn(s(t));},__wbg_wasClean_f17429d064911939:function(t){return s(t).wasClean},__wbindgen_cast_0000000000000001:function(t,e){let _=F(t,e,gt);return g(_)},__wbindgen_cast_0000000000000002:function(t,e){let _=F(t,e,ft);return g(_)},__wbindgen_cast_0000000000000003:function(t,e){let _=F(t,e,dt);return g(_)},__wbindgen_cast_0000000000000004:function(t,e){let _=F(t,e,ut);return g(_)},__wbindgen_cast_0000000000000005:function(t,e){let _=F(t,e,lt);return g(_)},__wbindgen_cast_0000000000000006:function(t,e){let _=F(t,e,bt);return g(_)},__wbindgen_cast_0000000000000007:function(t,e){let _=F(t,e,at);return g(_)},__wbindgen_cast_0000000000000008:function(t,e){let _=Ft(t,e,pt);return g(_)},__wbindgen_cast_0000000000000009:function(t,e){let _=F(t,e,wt);return g(_)},__wbindgen_cast_000000000000000a:function(t){return g(t)},__wbindgen_cast_000000000000000b:function(t){return g(t)},__wbindgen_cast_000000000000000c:function(t,e){let _=A(t,e);return g(_)},__wbindgen_cast_000000000000000d:function(t,e){let _=I(t,e);return g(_)},__wbindgen_cast_000000000000000e:function(t){let e=BigInt.asUintN(64,t);return g(e)},__wbindgen_cast_000000000000000f:function(t,e){var _=A(t,e).slice();return n.__wbindgen_export4(t,e*1,1),g(_)},__wbindgen_object_clone_ref:function(t){let e=s(t);return g(e)},__wbindgen_object_drop_ref:function(t){p(t);}}}}function bt(b,t){n.__wasm_bindgen_func_elem_21377(b,t);}function at(b,t){n.__wasm_bindgen_func_elem_22509(b,t);}function pt(b,t){n.__wasm_bindgen_func_elem_22573(b,t);}function wt(b,t){n.__wasm_bindgen_func_elem_30578(b,t);}function gt(b,t,e){n.__wasm_bindgen_func_elem_21580(b,t,g(e));}function dt(b,t,e){n.__wasm_bindgen_func_elem_18950(b,t,g(e));}function ut(b,t,e){n.__wasm_bindgen_func_elem_4004(b,t,g(e));}function lt(b,t,e){n.__wasm_bindgen_func_elem_23242(b,t,g(e));}function ft(b,t,e){try{let o=n.__wbindgen_add_to_stack_pointer(-16);n.__wasm_bindgen_func_elem_30728(o,b,t,g(e));var _=x().getInt32(o+0,!0),r=x().getInt32(o+4,!0);if(r)throw p(_)}finally{n.__wbindgen_add_to_stack_pointer(16);}}function xt(b,t,e,_){n.__wasm_bindgen_func_elem_30730(b,t,g(e),g(_));}var ht=["blob","arraybuffer"],mt=["bytes"],yt=["default","no-store","reload","no-cache","force-cache","only-if-cached"],It=["omit","same-origin","include"],vt=["same-origin","no-cors","cors","navigate"],kt=["arraybuffer","blob"],$=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>n.__wbg_bistream_free(b,1)),Rt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>n.__wbg_intounderlyingbytesource_free(b,1)),K=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>n.__wbg_intounderlyingsink_free(b,1)),J=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>n.__wbg_intounderlyingsource_free(b,1)),Y=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>n.__wbg_peerunistream_free(b,1)),Q=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>n.__wbg_wasmclient_free(b,1)),Z=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>n.__wbg_wasmconnection_free(b,1));function g(b){W===C.length&&C.push(C.length+1);let t=W;return W=C[t],C[t]=b,t}var G=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(b=>n.__wbindgen_export5(b.a,b.b));function H(b){let t=typeof b;if(t=="number"||t=="boolean"||b==null)return `${b}`;if(t=="string")return `"${b}"`;if(t=="symbol"){let r=b.description;return r==null?"Symbol":`Symbol(${r})`}if(t=="function"){let r=b.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(b)){let r=b.length,o="[";r>0&&(o+=H(b[0]));for(let a=1;a<r;a++)o+=", "+H(b[a]);return o+="]",o}let e=/\[object ([^\]]+)\]/.exec(toString.call(b)),_;if(e&&e.length>1)_=e[1];else return toString.call(b);if(_=="Object")try{return "Object("+JSON.stringify(b)+")"}catch{return "Object"}return b instanceof Error?`${b.name}: ${b.message}
|
|
2
|
+
${b.stack}`:_}function Ct(b){b<1028||(C[b]=W,W=b);}function At(b,t){b=b>>>0;let e=x(),_=[];for(let r=b;r<b+4*t;r+=4)_.push(p(e.getUint32(r,true)));return _}function A(b,t){return b=b>>>0,T().subarray(b/1,b/1+t)}var P=null;function x(){return (P===null||P.buffer.detached===true||P.buffer.detached===void 0&&P.buffer!==n.memory.buffer)&&(P=new DataView(n.memory.buffer)),P}function I(b,t){return Pt(b>>>0,t)}var M=null;function T(){return (M===null||M.byteLength===0)&&(M=new Uint8Array(n.memory.buffer)),M}function s(b){return C[b]}function h(b,t){try{return b.apply(this,t)}catch(e){n.__wbindgen_export3(g(e));}}var C=new Array(1024).fill(void 0);C.push(void 0,null,true,false);var W=C.length;function u(b){return b==null}function Ft(b,t,e){let _={a:b,b:t,cnt:1},r=(...o)=>{_.cnt++;try{return e(_.a,_.b,...o)}finally{r._wbg_cb_unref();}};return r._wbg_cb_unref=()=>{--_.cnt===0&&(n.__wbindgen_export5(_.a,_.b),_.a=0,G.unregister(_));},G.register(r,_,_),r}function F(b,t,e){let _={a:b,b:t,cnt:1},r=(...o)=>{_.cnt++;let a=_.a;_.a=0;try{return e(a,_.b,...o)}finally{_.a=a,r._wbg_cb_unref();}};return r._wbg_cb_unref=()=>{--_.cnt===0&&(n.__wbindgen_export5(_.a,_.b),_.a=0,G.unregister(_));},G.register(r,_,_),r}function k(b,t){let e=t(b.length*1,1)>>>0;return T().set(b,e/1),i=b.length,e}function tt(b,t){let e=t(b.length*4,4)>>>0,_=x();for(let r=0;r<b.length;r++)_.setUint32(e+4*r,g(b[r]),true);return i=b.length,e}function c(b,t,e){if(e===void 0){let w=j.encode(b),d=t(w.length,1)>>>0;return T().subarray(d,d+w.length).set(w),i=w.length,d}let _=b.length,r=t(_,1)>>>0,o=T(),a=0;for(;a<_;a++){let w=b.charCodeAt(a);if(w>127)break;o[r+a]=w;}if(a!==_){a!==0&&(b=b.slice(a)),r=e(r,_,_=a+b.length*3,1)>>>0;let w=T().subarray(r+a,r+_),d=j.encodeInto(b,w);a+=d.written,r=e(r,_,a,1)>>>0;}return i=a,r}function p(b){let t=s(b);return Ct(b),t}var z=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});z.decode();var St=2146435072,X=0;function Pt(b,t){return X+=t,X>=St&&(z=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),z.decode(),X=t),z.decode(T().subarray(b,b+t))}var j=new TextEncoder;"encodeInto"in j||(j.encodeInto=function(b,t){let e=j.encode(b);return t.set(e),{read:b.length,written:e.length}});var i=0,n;function nt(b,t){return n=b.exports,P=null,M=null,n.__wbindgen_start(),n}async function Mt(b,t){if(typeof Response=="function"&&b instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(b,t)}catch(r){if(b.ok&&e(b.type)&&b.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let _=await b.arrayBuffer();return await WebAssembly.instantiate(_,t)}else {let _=await WebAssembly.instantiate(b,t);return _ instanceof WebAssembly.Instance?{instance:_,module:b}:_}function e(_){switch(_){case "basic":case "cors":case "default":return true}return false}}function jt(b){if(n!==void 0)return n;b!==void 0&&(Object.getPrototypeOf(b)===Object.prototype?{module:b}=b:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=et();b instanceof WebAssembly.Module||(b=new WebAssembly.Module(b));let e=new WebAssembly.Instance(b,t);return nt(e)}async function qt(b){if(n!==void 0)return n;b!==void 0&&(Object.getPrototypeOf(b)===Object.prototype?{module_or_path:b}=b:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),b===void 0&&(b=new URL("openrtc_bg.wasm",import.meta.url));let t=et();(typeof b=="string"||typeof Request=="function"&&b instanceof Request||typeof URL=="function"&&b instanceof URL)&&(b=fetch(b));let{instance:e,module:_}=await Mt(await b,t);return nt(e)}export{q as BiStream,L as IntoUnderlyingByteSource,N as IntoUnderlyingSink,O as IntoUnderlyingSource,B as PeerUniStream,U as WasmClient,D as WasmConnection,qt as default,jt as initSync,Wt as start};
|
package/dist/openrtc_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { D as DelegatingRuntimeAdapter, a as WasmBridgeOptions } from '../DelegatingRuntimeAdapter-
|
|
2
|
-
import '../ITransport-
|
|
3
|
-
import '../types-
|
|
4
|
-
import '../capabilities-
|
|
1
|
+
import { D as DelegatingRuntimeAdapter, a as WasmBridgeOptions } from '../DelegatingRuntimeAdapter-DE4LTGAJ.js';
|
|
2
|
+
import '../ITransport-CjxCQ6q7.js';
|
|
3
|
+
import '../types-DDhMQkK8.js';
|
|
4
|
+
import '../capabilities-BPuynml5.js';
|
|
5
5
|
|
|
6
6
|
declare class WasmRuntimeAdapter extends DelegatingRuntimeAdapter {
|
|
7
7
|
constructor(options: WasmBridgeOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'../chunk-
|
|
1
|
+
import {a}from'../chunk-R35AWMNY.js';import {z}from'../chunk-Z2IS6NH2.js';import'../chunk-AJQVMVYW.js';import'../chunk-WA434EWD.js';import'../chunk-HEAJ7ZUR.js';import'../chunk-2L6ULC32.js';import'../chunk-2SUSPEC4.js';var n=class extends a{constructor(e){super(new z(e));}setWasmClient(e){this.unwrap().setWasmClient(e);}};export{n as WasmRuntimeAdapter};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as RuntimeDevice, D as DeviceStatus } from '../types-
|
|
2
|
-
import '../ITransport-
|
|
1
|
+
import { e as RuntimeDevice, D as DeviceStatus } from '../types-DDhMQkK8.js';
|
|
2
|
+
import '../ITransport-CjxCQ6q7.js';
|
|
3
3
|
|
|
4
4
|
interface DeviceActiveOptions {
|
|
5
5
|
now?: number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as RuntimeFactoryOptions, b as PlutoRuntimeAssembly } from '../assembly-
|
|
2
|
-
import { I as IpcRuntimeAdapter } from '../IpcRuntimeAdapter-
|
|
3
|
-
import { W as WasmBridge } from '../DelegatingRuntimeAdapter-
|
|
1
|
+
import { c as RuntimeFactoryOptions, b as PlutoRuntimeAssembly } from '../assembly-Bmi65-tK.js';
|
|
2
|
+
import { I as IpcRuntimeAdapter } from '../IpcRuntimeAdapter-CE0va9Tr.js';
|
|
3
|
+
import { W as WasmBridge } from '../DelegatingRuntimeAdapter-DE4LTGAJ.js';
|
|
4
4
|
import { P as PlutoIpcBridge } from '../ipc-CPnNwv6f.js';
|
|
5
|
-
import '../types-
|
|
6
|
-
import '../ITransport-
|
|
7
|
-
import '../capabilities-
|
|
5
|
+
import '../types-DDhMQkK8.js';
|
|
6
|
+
import '../ITransport-CjxCQ6q7.js';
|
|
7
|
+
import '../capabilities-BPuynml5.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @deprecated Legacy assembly helper. Use `OpenRTC()` for app code.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$2}from'../chunk-
|
|
1
|
+
import {a as a$2}from'../chunk-KRJECX7X.js';import {t,a as a$3}from'../chunk-XAL4T6TB.js';import'../chunk-HUG5AX7R.js';import'../chunk-DUY34MGT.js';import'../chunk-R35AWMNY.js';import'../chunk-Z2IS6NH2.js';import'../chunk-AJQVMVYW.js';import {a as a$1}from'../chunk-WA434EWD.js';import'../chunk-HEAJ7ZUR.js';import'../chunk-7BJKDBLP.js';import'../chunk-2L6ULC32.js';import'../chunk-2SUSPEC4.js';var n=false;function a(){n||(n=true,a$3(async()=>{let t=await import('../openrtc-4EZPCHWM.js');return {initWasm:t.default,WasmClient:t.WasmClient,start:t.start}}));}async function d(t){a();let e=a$1(t),{WasmBridge:i}=await import('../WasmBridge-75F6GKHG.js');return a$2(e,new i(e))}function y(t$1,e){let i=a$1(t$1);return a$2(i,new t({...i,bridge:e}))}export{y as createIpcClient,d as createWasmClient};
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { a as PeerReconciliationStats } from '../assembly-
|
|
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-
|
|
1
|
+
import { a as PeerReconciliationStats } from '../assembly-Bmi65-tK.js';
|
|
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-Bmi65-tK.js';
|
|
3
3
|
import { Client as Client$1 } from '../coreClient.js';
|
|
4
|
-
import { b as Avenue } from '../types
|
|
4
|
+
import { b as Avenue } from '../types--jQzenZR.js';
|
|
5
5
|
import * as Draft14 from '@moq/net';
|
|
6
|
-
import { a7 as SignalingOptions, I as ISignalingBackend, m as RuntimeIdentity, l as RoomMember, n as SignalingEnvelope, u as SignalingSession, D as Device, r as DesiredPeerProjection, w as BackendConnectionState, a6 as AppLimits, G as GrantScope, Y as JoinRoomOptions, W as ChannelMetadata, a2 as CryptoStreams, a8 as RoomCreationMode, h as ClientOptions, z as PayloadCrypto, k as DiscoveryMode, a1 as ProtocolCapabilityMap, a9 as ScanningLoopOptions, aa as ScanningLoopHandle, ab as RuntimeBootstrapOptions, ac as RuntimeBootstrapResult, F as ApplicationPayloadReadinessOptions, ad as ManagedApplicationRouteOptions, Q as PeerState, T as PeerScope, U as PeerHealth, V as ChannelDescriptor, ae as JoinRequest, N as NativeConnectParams, t as NativeConnectResult } from '../ITransport-
|
|
7
|
-
import { a as Connection, t as ConnectionTarget, m as RawConnection } from '../types-
|
|
8
|
-
export { v as AutoConnectPolicy, B as BrowserProtocolStore, C as ChannelDescriptor, w as ChannelFraming, i as ConnectionEvent, g as ConnectionState, x as ConnectionStatus, k as DeviceConnectOptions, y as DevicePresence, l as DeviceProfile, D as DeviceStatus, I as IncomingStream, q as IrohDocEntry, p as IrohMutationReceipt, J as JoinRoomOptions, L as LocalDeviceInfo, M as ManagedOptions, j as ManagedSession, N as NamespaceDescriptor, z as PayloadRouteOptions, P as PeerConnectOptions, E as PeerLifecycleStatus, b as PeerReadiness, F as PeerSessionSnapshot, d as PeerStreamOptions, u as PresenceLoopOptions, G as PresencePolicy, h as ReadinessOptions, H as RuntimeAuthContext, r as RuntimeAuthIdentity, o as RuntimeClientOptions, e as RuntimeDevice, c as RuntimePeerHealth, K as RuntimePeerScope, R as RuntimePeerState, n as RuntimeRoomMember, s as RuntimeSession, S as ScopedChannelOptions, f as ScopedLogicalChannel, O as SessionKind, Q as SessionPlatform } from '../types-
|
|
9
|
-
import { R as RuntimeCapabilities } from '../capabilities-
|
|
10
|
-
export { B as BROWSER_CAPABILITIES, a as CapabilityHost, C as CapabilityProfile, N as NATIVE_CAPABILITIES, b as NativeRuntimeStatus, c as RuntimeAdapterKind, T as TransportStatus, d as browserCapabilities, e as capabilityProfile, f as cloneCapabilities, s as statusCapabilities } from '../capabilities-
|
|
6
|
+
import { a7 as SignalingOptions, I as ISignalingBackend, m as RuntimeIdentity, l as RoomMember, n as SignalingEnvelope, u as SignalingSession, D as Device, r as DesiredPeerProjection, w as BackendConnectionState, a6 as AppLimits, G as GrantScope, Y as JoinRoomOptions, W as ChannelMetadata, a2 as CryptoStreams, a8 as RoomCreationMode, h as ClientOptions, z as PayloadCrypto, k as DiscoveryMode, a1 as ProtocolCapabilityMap, a9 as ScanningLoopOptions, aa as ScanningLoopHandle, ab as RuntimeBootstrapOptions, ac as RuntimeBootstrapResult, F as ApplicationPayloadReadinessOptions, ad as ManagedApplicationRouteOptions, Q as PeerState, T as PeerScope, U as PeerHealth, V as ChannelDescriptor, ae as JoinRequest, N as NativeConnectParams, t as NativeConnectResult } from '../ITransport-CjxCQ6q7.js';
|
|
7
|
+
import { a as Connection, t as ConnectionTarget, m as RawConnection } from '../types-DDhMQkK8.js';
|
|
8
|
+
export { v as AutoConnectPolicy, B as BrowserProtocolStore, C as ChannelDescriptor, w as ChannelFraming, i as ConnectionEvent, g as ConnectionState, x as ConnectionStatus, k as DeviceConnectOptions, y as DevicePresence, l as DeviceProfile, D as DeviceStatus, I as IncomingStream, q as IrohDocEntry, p as IrohMutationReceipt, J as JoinRoomOptions, L as LocalDeviceInfo, M as ManagedOptions, j as ManagedSession, N as NamespaceDescriptor, z as PayloadRouteOptions, P as PeerConnectOptions, E as PeerLifecycleStatus, b as PeerReadiness, F as PeerSessionSnapshot, d as PeerStreamOptions, u as PresenceLoopOptions, G as PresencePolicy, h as ReadinessOptions, H as RuntimeAuthContext, r as RuntimeAuthIdentity, o as RuntimeClientOptions, e as RuntimeDevice, c as RuntimePeerHealth, K as RuntimePeerScope, R as RuntimePeerState, n as RuntimeRoomMember, s as RuntimeSession, S as ScopedChannelOptions, f as ScopedLogicalChannel, O as SessionKind, Q as SessionPlatform } from '../types-DDhMQkK8.js';
|
|
9
|
+
import { R as RuntimeCapabilities } from '../capabilities-BPuynml5.js';
|
|
10
|
+
export { B as BROWSER_CAPABILITIES, a as CapabilityHost, C as CapabilityProfile, N as NATIVE_CAPABILITIES, b as NativeRuntimeStatus, c as RuntimeAdapterKind, T as TransportStatus, d as browserCapabilities, e as capabilityProfile, f as cloneCapabilities, s as statusCapabilities } from '../capabilities-BPuynml5.js';
|
|
11
11
|
export { DeviceActiveOptions, isDeviceActive, isDeviceConnectable, isDeviceRoutable } from './device-status.js';
|
|
12
|
-
export { a as IpcAdapterOptions, I as IpcRuntimeAdapter } from '../IpcRuntimeAdapter-
|
|
12
|
+
export { a as IpcAdapterOptions, I as IpcRuntimeAdapter } from '../IpcRuntimeAdapter-CE0va9Tr.js';
|
|
13
13
|
export { P as NativeBridge, N as NativeIpcFailureKind, P as PlutoIpcBridge, a as PlutoIpcUnlisten, c as classifyIpcFailure, i as isIpcUnavailable } from '../ipc-CPnNwv6f.js';
|
|
14
|
-
import '../DelegatingRuntimeAdapter-
|
|
14
|
+
import '../DelegatingRuntimeAdapter-DE4LTGAJ.js';
|
|
15
15
|
|
|
16
16
|
declare class Signaling {
|
|
17
17
|
private readonly appTag;
|
package/dist/runtime/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as runtimeFromCapability}from'../chunk-
|
|
1
|
+
export{a as runtimeFromCapability}from'../chunk-UILOGUOU.js';import'../chunk-ZA44REGI.js';export{a as isDeviceActive,c as isDeviceConnectable,b as isDeviceRoutable}from'../chunk-CK6WQV7J.js';export{i as ConnectionActor,f as ConnectionActorError,j as ConnectionActors,b as ConnectionController,t as IpcRuntimeAdapter,s as RuntimeClient,e as clog,q as concatRuntimeBytes,g as connectionActorKey,h as connectionActorKeyString,p as createJsonDecoder,l as createU32Decoder,n as decodeJsonPayload,o as encodeJsonFrame,m as encodeJsonPayload,k as encodeU32Frame,d as grantCorrelation,r as readRuntimeU32BE,c as renderCorrelation}from'../chunk-XAL4T6TB.js';export{a as classifyIpcFailure,b as isIpcUnavailable}from'../chunk-HUG5AX7R.js';import'../chunk-DUY34MGT.js';import'../chunk-R35AWMNY.js';export{s as BROWSER_CAPABILITIES,t as NATIVE_CAPABILITIES,q as RUNTIME_POLICY,v as browserCapabilities,x as capabilityProfile,u as cloneCapabilities,r as getRuntimePolicy,i as logTeardownTrace,w as statusCapabilities}from'../chunk-Z2IS6NH2.js';import'../chunk-AJQVMVYW.js';import'../chunk-WA434EWD.js';import'../chunk-HEAJ7ZUR.js';import'../chunk-7BJKDBLP.js';export{b as openRtcDebug,a as openRtcDebugEnabled,c as openRtcDebugInfo,d as openRtcDebugLog}from'../chunk-2L6ULC32.js';import'../chunk-2SUSPEC4.js';
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { i as CoordinationGatewayGrantRequest, j as CoordinationGatewayGrant } from './ITransport-
|
|
2
|
-
import { A as AttestationProvider, a as AuthProvider, B as BotVerificationProvider, e as DeviceProfile, O as Options, C as Client } from './types
|
|
1
|
+
import { i as CoordinationGatewayGrantRequest, j as CoordinationGatewayGrant } from './ITransport-CjxCQ6q7.js';
|
|
2
|
+
import { A as AttestationProvider, a as AuthProvider, B as BotVerificationProvider, e as DeviceProfile, O as Options, C as Client } from './types--jQzenZR.js';
|
|
3
3
|
import { P as PlutoIpcBridge } from './ipc-CPnNwv6f.js';
|
|
4
4
|
import './coreClient.js';
|
|
5
|
-
import './assembly-
|
|
6
|
-
import './types-
|
|
7
|
-
import './capabilities-
|
|
5
|
+
import './assembly-Bmi65-tK.js';
|
|
6
|
+
import './types-DDhMQkK8.js';
|
|
7
|
+
import './capabilities-BPuynml5.js';
|
|
8
8
|
|
|
9
9
|
interface DeviceProof {
|
|
10
10
|
publicKeyJwk: JsonWebKey;
|
|
@@ -40,6 +40,7 @@ interface CredentialSource {
|
|
|
40
40
|
token: string;
|
|
41
41
|
avenue: CoordinationGatewayGrantRequest['avenue'];
|
|
42
42
|
expiresAtMs: number;
|
|
43
|
+
relay: boolean;
|
|
43
44
|
renew?: () => Promise<CredentialSource>;
|
|
44
45
|
/**
|
|
45
46
|
* Re-establishes an authenticated device certificate only after the
|
|
@@ -59,6 +60,7 @@ interface CachedDeviceCertificate {
|
|
|
59
60
|
interface AuthenticatedDeviceCertificate extends CachedDeviceCertificate {
|
|
60
61
|
principalId: string;
|
|
61
62
|
enrolled: boolean;
|
|
63
|
+
relay: boolean;
|
|
62
64
|
}
|
|
63
65
|
interface ControlPlaneEvents {
|
|
64
66
|
beforeLogicalOperation?: (operation: string) => void;
|
|
@@ -119,6 +121,9 @@ declare class ControlPlane {
|
|
|
119
121
|
expiresAtMs: number;
|
|
120
122
|
}) => Promise<void> | void;
|
|
121
123
|
}): (request: CoordinationGatewayGrantRequest) => Promise<CoordinationGatewayGrant>;
|
|
124
|
+
turnProvider(source: () => CredentialSource): () => Promise<{
|
|
125
|
+
iceServers?: RTCIceServer[];
|
|
126
|
+
} | null>;
|
|
122
127
|
}
|
|
123
128
|
|
|
124
129
|
/** Focused control-plane factory for live harnesses that do not need a transport runtime. */
|
package/dist/testing.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-Q6KXVTSH.js';import {a as a$1}from'./chunk-BOS554IK.js';import {c}from'./chunk-4MLJXEVV.js';import {b}from'./chunk-UILOGUOU.js';import'./chunk-ZA44REGI.js';import'./chunk-DUY34MGT.js';import'./chunk-HEAJ7ZUR.js';function d(o){let r=e=>`${e}:${o}`;return {getOrCreate:e=>c.getOrCreate(r(e)),delete:async e=>{await c.delete?.(r(e));},readSecureRecord:(e,t)=>c.readSecureRecord?.(r(e),t)??Promise.resolve(null),writeSecureRecord:(e,t,n)=>c.writeSecureRecord?.(r(e),t,n)??Promise.resolve(),deleteSecureRecord:(e,t)=>c.deleteSecureRecord?.(r(e),t)??Promise.resolve()}}function y(o,r,e){return new a(o,r,d(e))}function s(o,r,e={}){return b(o,{endpoints:r,testingAllowInsecureLoopback:true,platform:"web",...e.deviceId?{deviceIdProvider:async()=>e.deviceId}:{},...e.irohTestRelayUrl?{irohTestRelayUrl:e.irohTestRelayUrl}:{},runtimeFactory:async t=>{let{createWasmClient:n}=await import('./runtime/factories.js');return n(t)}})}s.native=function(o,r,e){return b(o,{endpoints:r,testingAllowInsecureLoopback:true,platform:"native",deviceKeyProvider:a$1(e),deviceIdProvider:async()=>{let t=await e.invoke("get_rtc_local_device_info");return String(t?.deviceId??"")},runtimeFactory:async t=>{let{createIpcClient:n}=await import('./ipcFactory-32R47AVK.js');return n(t,e)}})};export{s as OpenRTC,y as controlPlane};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as ProtocolName, $ as RouteDescriptor, K as ITransport, a0 as ProtocolCapability, a1 as ProtocolCapabilityMap, z as PayloadCrypto, a2 as CryptoStreams } from '../ITransport-
|
|
2
|
-
export { a3 as CryptoBiStream, a4 as RouteFamily, a5 as RouteKind } from '../ITransport-
|
|
1
|
+
import { c as ProtocolName, $ as RouteDescriptor, K as ITransport, a0 as ProtocolCapability, a1 as ProtocolCapabilityMap, z as PayloadCrypto, a2 as CryptoStreams } from '../ITransport-CjxCQ6q7.js';
|
|
2
|
+
export { a3 as CryptoBiStream, a4 as RouteFamily, a5 as RouteKind } from '../ITransport-CjxCQ6q7.js';
|
|
3
3
|
|
|
4
4
|
declare const TRANSPORT_LABELS: readonly ProtocolName[];
|
|
5
5
|
declare function normalizeTransport(value: unknown): ProtocolName | undefined;
|
package/dist/transport/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{e as KEY_ALGORITHM,d as PUBLIC_KEY_BYTES,f as createKeyAgreement,g as deriveCryptoKey,i as encodeKeyAgreement,c as preferredProtocols}from'../chunk-
|
|
1
|
+
export{e as KEY_ALGORITHM,d as PUBLIC_KEY_BYTES,f as createKeyAgreement,g as deriveCryptoKey,i as encodeKeyAgreement,c as preferredProtocols}from'../chunk-7BJKDBLP.js';export{o as TRANSPORT_LABELS,z as createCryptoStreams,y as createSharedCrypto,q as isBaseIroh,r as isDirectIroh,x as isEncryptedPayload,w as isIndependent,s as isOptionalTransport,t as isWebRtc,p as normalizeTransport}from'../chunk-2L6ULC32.js';export{a as ROUTE_DESCRIPTORS,e as getRouteDescriptor,f as listRouteDescriptors}from'../chunk-2SUSPEC4.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PeerNamespace, ChannelNamespace, DiagnosticsNamespace, DeviceNamespace } from './coreClient.js';
|
|
2
|
-
import { C as ChannelDescriptor } from './types-
|
|
3
|
-
import { P as PlutoIrohConfiguration, a as PlutoRTCConfiguration, b as PlutoMoQConfiguration, R as RouteOptimization, c as ProtocolName } from './ITransport-
|
|
2
|
+
import { C as ChannelDescriptor } from './types-DDhMQkK8.js';
|
|
3
|
+
import { P as PlutoIrohConfiguration, a as PlutoRTCConfiguration, b as PlutoMoQConfiguration, R as RouteOptimization, c as ProtocolName } from './ITransport-CjxCQ6q7.js';
|
|
4
4
|
|
|
5
5
|
interface AuthProvider {
|
|
6
6
|
/** Registered provider ID from the developer app capability manifest. */
|
|
@@ -105,6 +105,7 @@ interface UsageWarning extends UsageUpdate {
|
|
|
105
105
|
interface Transports {
|
|
106
106
|
iroh?: boolean | PlutoIrohConfiguration;
|
|
107
107
|
webrtc?: boolean | PlutoRTCConfiguration;
|
|
108
|
+
/** Allow managed relay fallback. Defaults to true; set false for direct-only P2P. */
|
|
108
109
|
relay?: boolean;
|
|
109
110
|
moq?: boolean | PlutoMoQConfiguration;
|
|
110
111
|
ble?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { y as ConnectionOptions, z as PayloadCrypto, F as ApplicationPayloadReadinessOptions, H as ApplicationPayloadRouteOptions, c as ProtocolName, J as ApplicationPayloadSendOptions, K as ITransport, O as LatencySnapshot, Q as PeerState, T as PeerScope, U as PeerHealth, V as ChannelDescriptor$1, W as ChannelMetadata, D as Device, w as BackendConnectionState, L as LocalDeviceInfo$1, o as DeviceStatusSnapshot, X as ManagedDeviceConnectOptions, h as ClientOptions, u as SignalingSession, m as RuntimeIdentity, Y as JoinRoomOptions$1, l as RoomMember, Z as DevicePresenceStatus, _ as PeerLifecycleStatus$1, d as PeerSessionSnapshot$1 } from './ITransport-
|
|
1
|
+
import { y as ConnectionOptions, z as PayloadCrypto, F as ApplicationPayloadReadinessOptions, H as ApplicationPayloadRouteOptions, c as ProtocolName, J as ApplicationPayloadSendOptions, K as ITransport, O as LatencySnapshot, Q as PeerState, T as PeerScope, U as PeerHealth, V as ChannelDescriptor$1, W as ChannelMetadata, D as Device, w as BackendConnectionState, L as LocalDeviceInfo$1, o as DeviceStatusSnapshot, X as ManagedDeviceConnectOptions, h as ClientOptions, u as SignalingSession, m as RuntimeIdentity, Y as JoinRoomOptions$1, l as RoomMember, Z as DevicePresenceStatus, _ as PeerLifecycleStatus$1, d as PeerSessionSnapshot$1 } from './ITransport-CjxCQ6q7.js';
|
|
2
2
|
|
|
3
3
|
type ConnectionHealth = 'unknown' | 'healthy' | 'suspect' | 'stale';
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{z as WasmBridge}from'./chunk-OUFHVLDQ.js';import'./chunk-AJQVMVYW.js';import'./chunk-NXM5ZGHD.js';import'./chunk-NRXEG5GQ.js';import'./chunk-SUWCBTBQ.js';import'./chunk-LN4ALFT6.js';
|
package/dist/chunk-2IRNZN3N.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a,b as b$2}from'./chunk-ZA44REGI.js';import {a as a$1}from'./chunk-DUY34MGT.js';import {b as b$1}from'./chunk-NRXEG5GQ.js';var L={"identity.assertion.exchange":25692e-8,"identity.monthly-active-principal":110352e-9,"capability.issue":212346e-9,"device.enroll":218946e-9,"gateway.grant.issue":202146e-9,"gateway.grant.refresh":200346e-9,"security.attestation.verify":29694e-8,"room.create":388056e-9,"room.join":209946e-9,"room.leave":200346e-9,"coordination.connection.open":299532e-9,"coordination.credential.refresh":259662e-9,"coordination.presence.offline":253638e-9,"coordination.signal.send":259638e-9,"coordination.session.put":259638e-9,"coordination.session.delete":253638e-9,"coordination.usage.ingest":197088e-9};var b=new WeakMap;function B(o){let e=b.get(o);if(!e)throw new Error("[OpenRTC] Capability runtime is unavailable or already closed.");return e}function K(o){let e=o?.trim()??"";if(!/^pk_(?:live|test)_[0-9a-f]{40}$/.test(e))throw new Error("[OpenRTC] apiKey must be a public pk_live_ or pk_test_ key.");return e}function f(o){let e=o?.trim()??"";if(!e||e.length>160||!/^[A-Za-z0-9_.:@-]+$/.test(e))throw new Error("[OpenRTC] Capability id is invalid.");return e}var N=/^[A-Za-z0-9_.:@-]{1,160}$/,$=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function j(o){let e=typeof o=="string"?o.trim():"";if(!N.test(e))return null;let t=e.startsWith("device_")?e.slice(7):"";return $.test(t)?t:e}function W(o){let e=`openrtc:v2:device-id:${o}`,t,i=(()=>{try{return t=globalThis.localStorage,j(t?.getItem(e))||crypto.randomUUID()}catch{return crypto.randomUUID()}})();try{t?.setItem(e,i);}catch{}return i}function U(o){let e=typeof o=="string"?o.trim():"";if(!N.test(e))throw new Error("[OpenRTC] The native host returned an invalid durable device ID.");return e}function k(o){let e=b$2(o.token),t=typeof e.deviceKeyThumbprint=="string"?e.deviceKeyThumbprint.trim():"";if(!/^[A-Za-z0-9_-]{43}$/.test(t))throw new Error("[OpenRTC] Anonymous capability is missing its device-key binding.");return `anon_${t.slice(0,32)}`}var D=class{constructor(){this.descriptors=new Map;this.targets=new Map;}register(e){if(!e?.id?.trim())throw new Error("[OpenRTC] Channel id is required.");this.descriptors.set(e.id,{...e});for(let[t,i]of this.targets)t.channels.register({...e,delivery:e.delivery??i});return ()=>{this.descriptors.delete(e.id);for(let t of this.targets.keys())t.channels.unregister(e.id);}}list(){return [...this.descriptors.values()].map(e=>({...e}))}attach(e,t){this.targets.set(e,t);for(let i of this.descriptors.values())e.channels.register({...i,delivery:i.delivery??t});}detach(e){this.targets.delete(e);}},R=class{constructor(e){this.options=e;this.total=0;this.warned=false;}get sessionCreditsUsd(){return this.total}estimate(e){let t=Math.max(0,Math.floor(e.units??1));return {creditsUsd:(L[e.operation]??0)*t,estimated:true}}assertCanSpend(e,t=1){let i=this.options?.maxSessionCreditsUsd;if(i===void 0||this.total+this.estimate({operation:e,units:t}).creditsUsd<=i)return;let s={sessionCreditsUsd:this.total,operation:e,estimated:true,thresholdCreditsUsd:i,kind:"session-limit"};throw this.options?.onWarning?.(s),new Error("[OpenRTC] The client-side session credit limit was reached.")}record(e,t=1){let i=this.estimate({operation:e,units:t}).creditsUsd;this.total+=i;let n={sessionCreditsUsd:this.total,operation:e,estimated:true};this.options?.onUsage?.(n);let s=this.options?.warnAtSessionCreditsUsd;!this.warned&&s!==void 0&&this.total>=s&&(this.warned=true,this.options?.onWarning?.({...n,thresholdCreditsUsd:s,kind:"warning"}));}},G=32,q=4096;function _(o){let e=o?.trim()??"";if(!e||e.length>80||!/^[A-Za-z0-9_.:@-]+$/.test(e))throw new Error("[OpenRTC] Message name is invalid.");return e}function P(o,e,t,i){let n=JSON.stringify({__openrtc:2,kind:o,name:e,value:t,...i?{gossip:i}:{}});if(n===void 0||!n.includes('"value":'))throw new Error("[OpenRTC] Messages must be JSON-serializable values.");return new TextEncoder().encode(n)}function z(o){if(!o||typeof o!="object"||o instanceof Uint8Array)return null;let e=o,t=e.__openrtc===2&&(e.kind==="channel"||e.kind==="state")&&typeof e.name=="string"&&e.name.length>0&&e.name.length<=80&&/^[A-Za-z0-9_.:@-]+$/.test(e.name)&&Object.prototype.hasOwnProperty.call(e,"value")?e:null;if(!t?.gossip)return t;let{gossip:i}=t;return typeof i.id=="string"&&i.id.length>0&&i.id.length<=384&&typeof i.originPeerId=="string"&&i.originPeerId.length>0&&i.originPeerId.length<=256&&(i.targetPeerId===void 0||typeof i.targetPeerId=="string"&&i.targetPeerId.length>0&&i.targetPeerId.length<=256)&&Number.isSafeInteger(i.hops)&&i.hops>=0&&i.hops<=G?t:null}var T=class{constructor(e,t=false){this.client=e;this.gossipFanout=t;this.connections=new Map;this.connectionListeners=new Set;this.rawListeners=new Map;this.closeListeners=new Map;this.channelListeners=new Map;this.stateListeners=new Map;this.remoteState=new Map;this.localState=new Map;this.stateSenders=new Map;this.seenGossipMessages=new Set;this.seenGossipOrder=[];this.stopMessage=e.onMessage((i,n)=>this.receive(i,n)),this.stopConnection=e.onConnection(i=>this.add(i)),this.stopDisconnection=e.onDisconnection(i=>this.remove(i)),e.getConnections().forEach(i=>this.add(i));}state(e){if(this.gossipFanout)throw new Error("[OpenRTC] state() is not available in sparse gossip rooms; use a named channel with application-owned latest-state revisions.");let t=_(e);return {set:i=>{let n=P("state",t,i);this.localState.set(t,n);for(let{raw:s}of this.connections.values())this.sendState(s,t,n);},watch:i=>{let n=this.stateListeners.get(t);n||this.stateListeners.set(t,n=new Set);let s=(r,a)=>i({peerId:r,value:a});n.add(s);for(let[r,a]of this.remoteState)a.has(t)&&i({peerId:r,value:a.get(t)});return ()=>n?.delete(s)}}}channel(e){let t=_(e),i=n=>P("channel",t,n);return {send:async n=>{let s=i(n);if(!this.gossipFanout){await Promise.all([...this.connections.values()].map(({raw:r})=>r.send(s)));return}await this.sendGossip("channel",t,n);},sendTo:async(n,s)=>{let r=[...this.connections.values()].find(a=>a.view.peerId===n);if(r){await r.raw.send(i(s));return}if(!this.gossipFanout)throw new Error(`[OpenRTC] Peer '${n}' is not connected.`);await this.sendGossip("channel",t,s,n);},onMessage:n=>{let s=this.channelListeners.get(t);s||this.channelListeners.set(t,s=new Set);let r=(a,c)=>n({peerId:a,message:c});return s.add(r),()=>s?.delete(r)}}}onConnection(e){this.connectionListeners.add(e);for(let{view:t}of this.connections.values())e(t);return ()=>this.connectionListeners.delete(e)}close(){this.stopMessage(),this.stopConnection(),this.stopDisconnection();for(let e of this.stateSenders.values())for(let t of e.values())t.close();for(let e of [...this.connections.values()])this.remove(e.raw);this.connectionListeners.clear(),this.channelListeners.clear(),this.stateListeners.clear(),this.localState.clear(),this.seenGossipMessages.clear(),this.seenGossipOrder.splice(0,this.seenGossipOrder.length);}add(e){if(this.connections.has(e.id))return;let t=e.remoteNodeId||e.id,i={id:e.id,peerId:t,send:n=>e.send(n),onMessage:n=>{let s=this.rawListeners.get(e.id);s||this.rawListeners.set(e.id,s=new Set);let r=n;return s.add(r),()=>s?.delete(r)},onClose:n=>{let s=this.closeListeners.get(e.id);return s||this.closeListeners.set(e.id,s=new Set),s.add(n),()=>s?.delete(n)}};this.connections.set(e.id,{raw:e,view:i});for(let n of this.connectionListeners)n(i);for(let[n,s]of this.localState)this.sendState(e,n,s);}remove(e){let t=this.connections.get(e.id);if(!t)return;this.connections.delete(e.id);let i=this.stateSenders.get(e);if(i){for(let s of i.values())s.close();this.stateSenders.delete(e);}for(let s of this.closeListeners.get(e.id)??[])s();this.closeListeners.delete(e.id),this.rawListeners.delete(e.id);let n=this.remoteState.get(t.view.peerId);if(n){for(let s of n.keys())for(let r of this.stateListeners.get(s)??[])r(t.view.peerId,null);this.remoteState.delete(t.view.peerId);}}receive(e,t){this.add(e);let i=z(t);if(!i){for(let r of this.rawListeners.get(e.id)??[])r(t);return}if(i.gossip){if(!this.rememberGossipMessage(i.gossip.id))return;let r=!i.gossip.targetPeerId||i.gossip.targetPeerId===e.localNodeId;if(i.gossip.hops<G){let a=P(i.kind,i.name,i.value,{...i.gossip,hops:i.gossip.hops+1});Promise.allSettled([...this.connections.values()].filter(({raw:c})=>c.id!==e.id).map(({raw:c})=>c.send(a)));}if(!r)return}let n=i.gossip?.originPeerId??this.connections.get(e.id)?.view.peerId??e.remoteNodeId??e.id;if(i.kind==="channel"){for(let r of this.channelListeners.get(i.name)??[])r(n,i.value);return}let s=this.remoteState.get(n);s||this.remoteState.set(n,s=new Map),s.set(i.name,i.value);for(let r of this.stateListeners.get(i.name)??[])r(n,i.value);}sendState(e,t,i){let n=this.stateSenders.get(e);n||this.stateSenders.set(e,n=new Map);let s=n.get(t);s||(s=new a$1(r=>e.send(r)),n.set(t,s)),s.send(i).catch(()=>{});}async sendGossip(e,t,i,n){let s=[...this.connections.values()];if(s.length===0)return;let r=s[0].raw.localNodeId,a=`${r}:${crypto.randomUUID()}`;this.rememberGossipMessage(a);let c=P(e,t,i,{id:a,originPeerId:r,...n?{targetPeerId:n}:{},hops:0});await Promise.all(s.map(({raw:l})=>l.send(c)));}rememberGossipMessage(e){if(this.seenGossipMessages.has(e))return false;if(this.seenGossipMessages.add(e),this.seenGossipOrder.push(e),this.seenGossipOrder.length>q){let t=this.seenGossipOrder.shift();t&&this.seenGossipMessages.delete(t);}return true}},w=class{constructor(e,t,i,n,s=false){this.kind=e;this.id=t;this.client=i;this.onClosed=n;this.gossipFanout=s;this.closed=false;b.set(this,i);}get peers(){return this.client.peers}get channels(){return this.client.channels}get diagnostics(){return this.client.diagnostics}state(e){return this.capabilityMessages().state(e)}channel(e){return this.capabilityMessages().channel(e)}onConnection(e){return this.capabilityMessages().onConnection(e)}async close(){if(!this.closed){this.closed=true,this.messages?.close();try{await this.client.advanced.runtime.shutdown();}finally{b.delete(this),this.onClosed();}}}capabilityMessages(){if(this.closed)throw new Error("[OpenRTC] Capability is closed.");return this.messages??(this.messages=new T(this.client,this.gossipFanout))}},g=class extends w{constructor(t,i,n,s){super("devices",t,i,n);this.roster=s;this.kind="devices";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=t=>this.client.devices.watch(i=>t(this.roster.mergeDevices(i)));this.connect=this.client.devices.connect;this.disconnect=this.client.devices.disconnect;let r=i.devices.list,a=i.devices.listWithStatus,c=i.devices.watch,l=i.devices.watchWithStatus,d=v=>(this.roster.reconcileLiveSnapshot(v),v),h=async()=>this.roster.mergeDevices(d(await r())),p=async()=>this.roster.mergeStatus(await a()),u=v=>c(I=>v(this.roster.mergeDevices(d(I)))),y=v=>l(I=>v(this.roster.mergeStatus(I))),m=Object.create(i);Object.defineProperties(m,{listDevices:{value:h,enumerable:false},listDeviceStatus:{value:p,enumerable:false},watchDevices:{value:u,enumerable:false},watchDeviceStatus:{value:y,enumerable:false},devices:{value:{...i.devices,list:h,listWithStatus:p,watch:u,watchWithStatus:y},enumerable:true}}),b.set(this,m),this.stopRosterSync=c(d);}replaceEnrolledDevices(t){this.roster.replace(t);}removeEnrolledDevice(t){this.roster.remove(t);}retainCurrentEnrolledDevice(t){this.roster.retain(t);}async close(){this.stopRosterSync(),await super.close();}},A=class extends w{constructor(t,i,n,s){super("space",t,i,n);this.delivery=s;this.kind="space";this.leave=()=>this.close();}},S=class extends w{constructor(t,i,n,s,r,a=false){super("room",t,i,n,a);this.membership=s;this.onLeave=r;this.kind="room";this.left=false;}async leave(){this.left||(this.left=true,await this.onLeave?.()),await this.close();}},E=class extends w{constructor(t,i,n,s){super("ticket",t,i,n);this.token=s;this.kind="ticket";}},M=class{constructor(e,t){this.options=e;this.internals=t;this.channels=new D;this.handles=new Set;this.activations=new Map;this.closed=false;this.devices={localId:()=>(this.assertOpen(),this.deviceId()),start:(e={})=>{let t=e.auth??this.options.auth;return this.activateOnce("devices",JSON.stringify({autoConnect:e.autoConnect??"online",maxPeers:e.maxPeers??null,advancedFanout:e.advancedFanout===true,profile:e.profile??null}),t,()=>this.startDevices(e))},listEnrolled:async(e={})=>{this.assertOpen();let t=e.auth??this.options.auth;if(!t)throw new Error("[OpenRTC] devices.listEnrolled() requires an auth provider.");let i=await(await this.controlPlane()).listEnrolledDevices(t,await this.deviceId());for(let n of this.handles)n instanceof g&&n.replaceEnrolledDevices(i);return i},revoke:async(e,t={})=>{this.assertOpen();let i=t.auth??this.options.auth;if(!i)throw new Error("[OpenRTC] devices.revoke() requires an auth provider.");let n=U(e),s=await this.deviceId();await(await this.controlPlane()).revokeDevice(i,s,n);for(let r of this.handles)r instanceof g&&r.removeEnrolledDevice(n);n===s&&this.retireAuthCapabilities(i);},revokeAll:async(e={})=>{this.assertOpen();let t=e.auth??this.options.auth;if(!t)throw new Error("[OpenRTC] devices.revokeAll() requires an auth provider.");if(await(await this.controlPlane()).revokeAllDevices(t,await this.deviceId(),e.exceptCurrent===true),e.exceptCurrent===true){let i=await this.deviceId();for(let n of this.handles)n instanceof g&&n.retainCurrentEnrolledDevice(i);}e.exceptCurrent!==true&&this.retireAuthCapabilities(t);}};this.spaces={join:(e,t={})=>this.activateOnce(`space:${f(e)}`,JSON.stringify({payload:t.payload??"reliable",identity:t.identity??null,maxPeers:t.maxPeers??null,advancedFanout:t.advancedFanout===true}),void 0,()=>this.joinSpace(e,t))};this.rooms={join:(e,t={})=>{let i=t.access??"capability";return this.activateOnce(`room:${f(e)}`,JSON.stringify({access:i,membership:t.membership??"ephemeral",maxPeers:t.maxPeers??null,advancedFanout:t.advancedFanout===true}),i==="authenticated"?t.auth??this.options.auth:void 0,()=>this.joinRoom(e,t))}};this.tickets={issue:(e,t={})=>this.activateOnce(`ticket:${f(e)}`,JSON.stringify({maxPeers:t.maxPeers??null,advancedFanout:t.advancedFanout===true}),void 0,()=>this.issueTicket(e,t))};this.onClosed=e=>{this.handles.delete(e);for(let[t,i]of this.activations)i.handle===e&&this.activations.delete(t);};this.apiKey=K(e.apiKey),this.appTag=`app_${this.apiKey.slice(-16)}`,this.usage=new R(e.usage);}makeControlPlane(e){return Promise.all([import('./controlPlane-JJFURVOX.js'),e]).then(([{ControlPlane:t},i])=>new t(this.apiKey,this.internals.endpoints??a,i,this.options.trust?.attestation,{beforeLogicalOperation:n=>this.usage.assertCanSpend(n),onLogicalOperation:n=>this.usage.record(n),onAuthEpochChanged:n=>this.retireAuthCapabilities(n)},this.options.trust?.botVerification))}controlPlane(){return this.controlPlanePromise??(this.controlPlanePromise=this.makeControlPlane(this.internals.deviceKeyProvider?Promise.resolve(this.internals.deviceKeyProvider):import('./deviceKey-Y35WSEQQ.js').then(({browserDeviceKeyProvider:e})=>e)))}sessionPlane(){return this.sessionPlanePromise??(this.sessionPlanePromise=this.makeControlPlane(import('./deviceKey-Y35WSEQQ.js').then(async({createDeviceKey:e})=>{let t=await e();return {getOrCreate:async()=>t}})))}assertOpen(){if(this.closed)throw new Error("[OpenRTC] Client is closed.")}activateOnce(e,t,i,n){this.assertOpen();let s=this.activations.get(e);if(s){if(s.fingerprint!==t||s.auth!==i)throw new Error(`[OpenRTC] ${e} is already active with different options.`);return s.promise}let r={fingerprint:t,auth:i},a=n().then(c=>(r.handle=c,c)).catch(c=>{throw this.activations.get(e)===r&&this.activations.delete(e),c});return r.promise=a,this.activations.set(e,r),a}retireAuthCapabilities(e){for(let t of this.activations.values())t.auth===e&&t.promise.then(i=>i.close()).catch(()=>{});}async deviceId(){let e=this.internals.deviceIdProvider?await this.internals.deviceIdProvider(this.appTag):W(this.appTag);return U(e)}runtimeOptions(e){let t=this.options.transports,i=t?.privacy==="relay-only";if(i&&t?.relay!==true)throw new Error("[OpenRTC] transports.privacy: relay-only requires transports.relay: true.");let n=i?b$1(t?.priority?[...t.priority]:void 0,true):t?.priority?[...t.priority]:void 0;return {apiKey:this.apiKey,authMode:"external",discoveryMode:e.avenue?.kind==="user"?"user-scoped":"space",space:e.avenue?.id,localDeviceId:e.deviceId,deviceIdPersistence:"persistent",endpointIdPersistence:this.internals.platform==="native"?"persistent":"ephemeral",deviceName:e.deviceName?.trim()||void 0,coordinationPlatformType:e.devicePlatform?.trim()||void 0,nativeStreamConsumer:this.internals.platform==="native"&&t?.nativeHostProtocols===true?"host":"runtime",coordinationAvenueOverride:e.avenue,coordinationRoomGossipFanout:e.roomGossipFanout===true,coordinationGateway:{endpoint:(this.internals.endpoints??a).gateway,environment:"production",grantProvider:e.grantProvider,testingAllowInsecureLoopback:this.internals.testingAllowInsecureLoopback},transports:{iroh:i?{relayOnly:true,relayTransportPolicy:"websocketRequired",localDiscovery:false,persistenceMode:this.internals.platform==="native"?"persistent":"ephemeral",...this.internals.irohTestRelayUrl?{testRelayUrl:this.internals.irohTestRelayUrl}:{}}:this.internals.irohTestRelayUrl?{testRelayUrl:this.internals.irohTestRelayUrl,persistenceMode:this.internals.platform==="native"?"persistent":"ephemeral"}:t?.iroh??true,webrtc:typeof t?.webrtc=="object"?i?{...t.webrtc,privacyMode:true,useTurn:true,useDefaultIceServers:false}:t.webrtc:t?.webrtc===true?i?{privacyMode:true,useTurn:true,useDefaultIceServers:false}:true:false,ble:t?.ble??false,moq:t?.moq??false,privacy:t?.privacy??"direct",optimizeFor:t?.optimizeFor??"balanced",priority:n},transportPriority:n}}async activate(e){let t=e.controlPlane??await this.controlPlane(),i={relay:this.options.transports?.relay===true,moq:!!this.options.transports?.moq,ble:this.options.transports?.ble===true,advancedFanout:e.advancedFanout===true,durableMembership:e.durableMembership===true},n=e.source,s=null,r=()=>({userId:e.principalId,token:n.token,tokenProvider:async()=>n.token,expiresAtMs:n.expiresAtMs}),a=this.runtimeOptions({avenue:e.source.avenue,grantProvider:t.grantProvider(e.source,{maxPeers:e.maxPeers,features:i,deviceProfile:e.deviceName&&e.devicePlatform?{name:e.deviceName,platform:e.devicePlatform}:void 0,onSourceRenewed:async d=>{n={...n,...d},await s?.setAuth(r());}}),deviceId:e.deviceId,userId:e.principalId,roomGossipFanout:e.kind==="room"&&e.advancedFanout===true,deviceName:e.deviceName,devicePlatform:e.devicePlatform}),[c,{wrapAssembly:l}]=await Promise.all([this.internals.runtimeFactory(a),import('./coreClient.js')]);s=l(c,this.internals.platform==="native"?"native":"web"),await s.setAuth(r()),this.channels.attach(s,e.defaultDelivery??"reliable");try{this.usage.assertCanSpend("coordination.connection.open"),await s.devices.startSession({sessionKind:e.kind==="devices"?"app-user-device":"scoped-guest",scope:`v2:${e.kind}:${e.id}`,userId:e.principalId,localDeviceId:e.deviceId,metadata:e.deviceMetadata,autoConnectPolicy:e.autoConnect?"enabled":"disabled",presencePolicy:"online"});}catch(d){throw this.channels.detach(s),await s.advanced.runtime.shutdown().catch(()=>{}),d}return this.usage.record("coordination.connection.open"),s}async startDevices(e={}){this.assertOpen();let t=e.auth??this.options.auth;if(!t)throw new Error("[OpenRTC] devices.start() requires an auth provider.");let i=await this.deviceId(),{resolveDeviceProfile:n}=await import('./deviceProfile-CR2C7OYR.js'),s=n(e.profile,this.internals.platform==="native"?"native":"web"),r=await this.controlPlane(),a=await r.deviceCertificate(t,i,void 0,s),c=await this.activate({kind:"devices",id:a.principalId,source:a.source,principalId:a.principalId,deviceId:i,maxPeers:e.maxPeers,autoConnect:e.autoConnect!=="none",advancedFanout:e.advancedFanout,deviceName:s.name,devicePlatform:s.platform,deviceMetadata:s.metadata}),l;try{l=await r.listEnrolledDevices(t,i);}catch(p){throw this.channels.detach(c),await c.advanced.runtime.shutdown().catch(()=>{}),p}let{AuthenticatedDeviceRoster:d}=await import('./deviceRoster-EUF6BBF5.js'),h;return h=new g(a.principalId,c,()=>{this.channels.detach(c),this.onClosed(h);},new d(l)),this.handles.add(h),h}async joinSpace(e,t={}){this.assertOpen();let i=f(e),n=await(t.identity==="session"?this.sessionPlane():this.controlPlane()),s=await n.capability("space",i,t.maxPeers,t.advancedFanout),r=String(b$2(s.token).principalId),a=await this.activate({kind:"space",id:i,source:s,principalId:r,deviceId:k(s),maxPeers:t.maxPeers,autoConnect:true,defaultDelivery:t.payload??"reliable",advancedFanout:t.advancedFanout,controlPlane:n}),c;return c=new A(i,a,()=>{this.channels.detach(a),this.onClosed(c);},t.payload??"reliable"),this.handles.add(c),c}async joinRoom(e,t={}){this.assertOpen();let i=f(e),n=t.membership??"ephemeral",s=t.access??"capability";if(n==="durable"&&s!=="authenticated")throw new Error("[OpenRTC] Durable room membership requires access: authenticated.");if(s==="authenticated"){let d=t.auth??this.options.auth;if(!d)throw new Error("[OpenRTC] Authenticated rooms require an auth provider.");let h=await this.deviceId(),p=await this.controlPlane(),u=await p.deviceCertificate(d,h,{kind:"room",id:i});n==="durable"&&await p.durableRoomMembership(u.source,i,"join");let y;try{y=await this.activate({kind:"room",id:i,source:u.source,principalId:u.principalId,deviceId:h,maxPeers:t.maxPeers,autoConnect:!0,durableMembership:n==="durable",advancedFanout:t.advancedFanout});}catch(v){throw n==="durable"&&await p.durableRoomMembership(u.source,i,"leave").catch(()=>{}),v}let m;return m=new S(i,y,()=>{this.channels.detach(y),this.onClosed(m);},n,n==="durable"?async()=>{await p.durableRoomMembership(u.source,i,"leave");}:void 0,t.advancedFanout===true),this.handles.add(m),m}let r=await(await this.controlPlane()).capability("room",i,t.maxPeers,t.advancedFanout),a=String(b$2(r.token).principalId),c=await this.activate({kind:"room",id:i,source:r,principalId:a,deviceId:k(r),maxPeers:t.maxPeers,autoConnect:true,advancedFanout:t.advancedFanout}),l;return l=new S(i,c,()=>{this.channels.detach(c),this.onClosed(l);},"ephemeral",void 0,t.advancedFanout===true),this.handles.add(l),l}async issueTicket(e,t={}){this.assertOpen();let i=f(e),n=await(await this.controlPlane()).capability("ticket",i,t.maxPeers,t.advancedFanout),s=String(b$2(n.token).principalId),r=await this.activate({kind:"ticket",id:i,source:n,principalId:s,deviceId:k(n),maxPeers:t.maxPeers,autoConnect:false,advancedFanout:t.advancedFanout}),a;return a=new E(i,r,()=>{this.channels.detach(r),this.onClosed(a);},n.token),this.handles.add(a),a}async close(){if(!this.closed){this.closed=true;try{await Promise.all([...this.handles].map(e=>e.close()));}finally{await Promise.all([this.controlPlanePromise,this.sessionPlanePromise].map(e=>e?.then(t=>t.dispose(),()=>{}))),this.activations.clear();}}}};function Q(o,e){return new M(o,e)}export{B as a,Q as b};
|
package/dist/chunk-DI5VSZ2T.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {b as b$1}from'./chunk-ZA44REGI.js';var S=1440*6e4,y=class extends Error{constructor(i,r,o){super(i);this.status=r;this.reason=o;this.name="RTCError";let e=[502,503,504].includes(r),s=o==="device-reenrollment-auth-required";this.code=s?"auth/device-reenrollment-required":e?"coordination/service-unavailable":r===429?"coordination/rate-limited":r===401?"auth/expired":r===403?"admission/denied":"internal/error",this.retryable=s||e,this.plane=s||r===401?"auth":e||r===429?"coordination":r===403?"admission":"internal";}};function C(a){return !(a instanceof y)||a.status!==403?false:a.reason==="device-certificate-stale"||a.reason==="device-certificate-revoked"?true:!a.reason&&a.message==="Device certificate is revoked or stale."}function b(a,t,i){return `openrtc:v2:device-certificate:${a}:${t}:${i}`}function k(a,t){return `openrtc:v2:device-session:${a}:${t}`}async function E(a,t,i){let r=new TextEncoder().encode(`openrtc:v2:session\0${a}\0${t}\0${i}`),o=new Uint8Array(await crypto.subtle.digest("SHA-256",r)),e="";for(let s of o)e+=String.fromCharCode(s);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function P(a){let t=a.replace(/-/g,"+").replace(/_/g,"/"),i=t.padEnd(Math.ceil(t.length/4)*4,"="),r=atob(i);return Uint8Array.from(r,o=>o.charCodeAt(0))}async function D(a,t,i,r,o){if(typeof a.token!="string"||typeof a.expiresAtMs!="number"||a.expiresAtMs<=Date.now()+S||!a.signingPublicJwk||a.signingPublicJwk.kty!=="OKP"||a.signingPublicJwk.crv!=="Ed25519"||typeof a.signingPublicJwk.x!="string")return null;let e=a.token.split(".");if(e.length!==3)return null;let s,n;try{s=JSON.parse(new TextDecoder().decode(P(e[0]))),n=b$1(a.token);}catch{return null}if(s.alg!=="EdDSA"||a.signingPublicJwk.kid&&s.kid!==a.signingPublicJwk.kid)return null;try{let d=await crypto.subtle.importKey("jwk",a.signingPublicJwk,{name:"Ed25519"},!1,["verify"]);if(!await crypto.subtle.verify({name:"Ed25519"},d,P(e[2]),new TextEncoder().encode(`${e[0]}.${e[1]}`)))return null}catch{return null}let c=typeof n.principalId=="string"?n.principalId:"",l=Number(n.iat),u=Number(n.exp);return n.iss!=="openrtc"||n.aud!=="openrtc:v2:gateway-grant"||n.typ!=="device-certificate"||n.appTag!==t||!c||o!==void 0&&c!==o||typeof n.principalKey!="string"||n.principalKey.length===0||n.deviceId!==i||n.deviceKeyThumbprint!==r||typeof n.jti!="string"||n.jti.length===0||!Number.isSafeInteger(l)||!Number.isSafeInteger(u)||l>=u||u*1e3!==a.expiresAtMs?null:{token:a.token,expiresAtMs:a.expiresAtMs,principalId:c,signingPublicJwk:a.signingPublicJwk,enrolled:false}}async function K(a,t,i,r,o){try{let e=b(t,i,r),s=a.readSecureRecord?await a.readSecureRecord(t,e):globalThis.localStorage?.getItem(e);if(!s)return null;let n=JSON.parse(s),c=await D(n,t,r,o,i);return c?{token:c.token,expiresAtMs:c.expiresAtMs,principalId:i,signingPublicJwk:c.signingPublicJwk}:null}catch(e){if(a.readSecureRecord)throw e;return null}}async function x(a,t,i,r,o){try{let e=k(t,r),s=a.readSecureRecord?await a.readSecureRecord(i,e):globalThis.localStorage?.getItem(e);return s?await D(JSON.parse(s),i,r,o):null}catch(e){if(a.readSecureRecord)throw e;return null}}async function T(a,t,i,r,o){try{let e=b(t,i,r),s=JSON.stringify(o);a.writeSecureRecord?await a.writeSecureRecord(t,e,s):globalThis.localStorage?.setItem(e,s);}catch(e){if(a.writeSecureRecord)throw e}}async function M(a,t,i,r,o){try{let e=k(i,r),s=JSON.stringify({token:o.token,expiresAtMs:o.expiresAtMs,principalId:o.principalId,signingPublicJwk:o.signingPublicJwk});a.writeSecureRecord?await a.writeSecureRecord(t,e,s):globalThis.localStorage?.setItem(e,s);}catch(e){if(a.writeSecureRecord)throw e}}async function m(a,t,i,r,o){try{let e=b(t,i,r);if(a.deleteSecureRecord?await a.deleteSecureRecord(t,e):globalThis.localStorage?.removeItem(e),o){let s=k(o,r);a.deleteSecureRecord?await a.deleteSecureRecord(t,s):globalThis.localStorage?.removeItem(s);}}catch(e){if(a.deleteSecureRecord)throw e}}function G(a){return `${a}_${crypto.randomUUID()}`}async function J(a,t){let i=new TextEncoder().encode(`${a}:${t}`);return [...new Uint8Array(await crypto.subtle.digest("SHA-256",i))].map(o=>o.toString(16).padStart(2,"0")).join("")}var A=class{constructor(t,i,r,o,e={},s){this.apiKey=t;this.endpoints=i;this.keyProvider=r;this.attestation=o;this.events=e;this.botVerification=s;this.keyPromise=null;this.authEpochs=new Map;this.appTag=`app_${t.slice(-16)}`;}record(t){this.events.onLogicalOperation?.(t);}before(t){this.events.beforeLogicalOperation?.(t);}authEpoch(t){let i=this.authEpochs.get(t);if(i)return i;let r={generation:0,devices:new Map};return this.authEpochs.set(t,r),t.subscribe&&(r.unsubscribe=t.subscribe(o=>{o?.type==="principal-changed"&&(r.generation+=1,r.devices.clear(),r.sessionKeyHash=void 0,this.events.onAuthEpochChanged?.(t));})),r}dispose(){for(let t of this.authEpochs.values())t.unsubscribe?.();this.authEpochs.clear();}key(){return this.keyPromise??(this.keyPromise=this.keyProvider.getOrCreate(this.appTag))}async post(t,i){let r=G("request"),o=JSON.stringify({apiKey:this.apiKey,...i}),e=null;for(let s=0;s<2;s+=1)try{let n=await fetch(`${this.endpoints.controlPlane}${t}`,{method:"POST",headers:{"Content-Type":"application/json","X-OpenRTC-Idempotency-Key":r},body:o,signal:AbortSignal.timeout(15e3)});if(n.ok)return n.json();let c=`OpenRTC request failed (${n.status}).`,l;try{let d=await n.json();typeof d.error=="string"&&(c=d.error.slice(0,256)),typeof d.reason=="string"&&/^[a-z0-9-]{1,80}$/.test(d.reason)&&(l=d.reason);}catch{}let u=new y(c,n.status,l);if(e=u,s===0&&[502,503,504].includes(n.status))continue;throw u}catch(n){if(e=n,s===0&&n instanceof TypeError)continue;throw n}throw e instanceof Error?e:new Error("OpenRTC request failed.")}async capability(t,i,r,o=false){this.before("capability.issue");let e=t==="space"?await J(this.apiKey,i):i,n=await(await this.key()).proof((d,p)=>["openrtc:v2:capability",this.apiKey,t,e,d,p].join(":")),c=this.botVerification?await this.botVerification.getToken({action:"openrtc_capability",apiKey:this.apiKey}):void 0,l=await this.post("/v2/capabilities",{avenue:{kind:t,id:e},deviceProof:n,...r?{maxPeers:r}:{},...o?{advancedFanout:true}:{},...c?{turnstileToken:c}:{}});this.record("capability.issue");let u={type:"capability",token:l.capability,avenue:t==="ticket"?{kind:"session",id:e}:l.avenue,expiresAtMs:l.expiresAt*1e3};return u.renew=()=>this.capability(t,i,r,o),u}async deviceCertificate(t,i,r,o,e){let s=this.authEpoch(t),n=s.devices.get(i)??{};if(s.devices.set(i,n),e&&n.current&&n.current.token!==e.token)return this.deviceCertificateResult(t,i,r,o,{...n.current,enrolled:false});if(!e&&n.current&&n.current.expiresAtMs>Date.now()+S)return this.deviceCertificateResult(t,i,r,o,{...n.current,enrolled:false});if(!n.inFlight){let l=s.generation;e&&(n.current=void 0,n.recoverRevokedEnrollment=true);let u=e?m(this.keyProvider,this.appTag,e.principalId,i,s.sessionKeyHash).then(()=>this.enrollAuthenticatedDevice(t,i,s.sessionKeyHash,o,true)):this.resolveAuthenticatedDevice(t,i,s,o,n.recoverRevokedEnrollment===true);n.inFlight=u.then(d=>{if(s.generation!==l)throw new Error("The OpenRTC authentication identity changed during enrollment.");return n.recoverRevokedEnrollment=false,n.current=d,d}).finally(()=>{n.inFlight=void 0;});}let c=await n.inFlight;return this.deviceCertificateResult(t,i,r,o,c)}async resolveAuthenticatedDevice(t,i,r,o,e=false){let s=await this.key();if(t.getSessionKey){let n=await t.getSessionKey();if(!n)throw new Error("The OpenRTC auth provider has no active principal.");let c=await E(this.appTag,s.thumbprint,n);r.sessionKeyHash=c;let l=await x(this.keyProvider,c,this.appTag,i,s.thumbprint);if(l)return l}return this.enrollAuthenticatedDevice(t,i,r.sessionKeyHash,o,e)}deviceCertificateResult(t,i,r,o,e){let s={type:"device-certificate",token:e.token,avenue:r??{kind:"user",id:e.principalId},expiresAtMs:e.expiresAtMs};return s.renew=async()=>(await this.deviceCertificate(t,i,r,o)).source,s.recoverRejectedCertificate=async()=>(await this.deviceCertificate(t,i,r,o,e)).source,{principalId:e.principalId,source:s,enrolled:e.enrolled}}async enrollAuthenticatedDevice(t,i,r,o,e=false){this.before("identity.assertion.exchange"),this.before("identity.monthly-active-principal");let s=async(h,g)=>{let w=await t.getAssertion({audience:"https://api.openrtc.app/v2/assertions/exchange",forceRefresh:h,deviceId:i,...{}});if(!w)throw new Error("The OpenRTC auth provider returned no assertion.");return this.post("/v2/assertions/exchange",{assertion:w,deviceId:i,...t.providerId?{providerId:t.providerId}:{}})},n;try{n=await s(!1);}catch(h){if(!(h instanceof y)||h.status!==401)throw h;n=await s(true);}this.record("identity.assertion.exchange"),this.record("identity.monthly-active-principal");let c=await this.key(),l=await K(this.keyProvider,this.appTag,n.principalId,i,c.thumbprint);if(l)return {...l,principalId:n.principalId,enrolled:false};this.before("device.enroll"),this.attestation&&this.before("security.attestation.verify");let{enrollDevice:u}=await import('./deviceEnrollment-Z2EHP2EX.js'),d=await u({apiKey:this.apiKey,appTag:this.appTag,auth:t,attestation:this.attestation,deviceId:i,identity:n,key:c,profile:o,recoverRevokedEnrollment:e||n.deviceRecoveryAuthorized===true,post:(h,g)=>this.post(h,g),recordAssertionExchange:()=>this.record("identity.assertion.exchange")});n=d.identity;let p=d.enrollment;this.record("device.enroll"),this.attestation&&this.record("security.attestation.verify");let v={principalId:n.principalId,token:p.deviceCertificate,expiresAtMs:p.expiresAt*1e3,signingPublicJwk:p.signingPublicJwk,enrolled:true};return await T(this.keyProvider,this.appTag,n.principalId,i,{token:v.token,expiresAtMs:v.expiresAtMs,signingPublicJwk:v.signingPublicJwk}),r&&await M(this.keyProvider,this.appTag,r,i,v),v}async listEnrolledDevices(t,i){let r=await this.deviceCertificate(t,i);return (await this.deviceManagement(r.source,i,"list")).devices??[]}async revokeDevice(t,i,r){let o=await this.deviceCertificate(t,i);if(await this.deviceManagement(o.source,i,"revoke",r),r===i){let e=this.authEpoch(t);await m(this.keyProvider,this.appTag,o.principalId,i,e.sessionKeyHash),e.devices.delete(i),await this.deleteDeviceKey();}}async revokeAllDevices(t,i,r){let o=await this.deviceCertificate(t,i);await this.deviceManagement(o.source,i,"revoke-all",void 0,r);let e=this.authEpoch(t);await m(this.keyProvider,this.appTag,o.principalId,i,e.sessionKeyHash),e.devices.delete(i),r?await this.deviceCertificate(t,i):(e.devices.clear(),await this.deleteDeviceKey());}async deleteDeviceKey(){this.keyPromise=null,await this.keyProvider.delete?.(this.appTag);}async deviceManagement(t,i,r,o,e=false){let s=r==="revoke"?"device.revoke":r==="revoke-all"?"identity.revoke-all":null;s&&this.before(s);let{manageDevice:n}=await import('./deviceManagement-SUMBRXXC.js'),c=await n({source:t,currentDeviceId:i,action:r,targetDeviceId:o,exceptCurrent:e,key:()=>this.key(),post:l=>this.post("/v2/devices/manage",l),isStale:C});return s&&this.record(s),c}async durableRoomMembership(t,i,r){if(t.type!=="device-certificate")throw new Error("Durable rooms require a device certificate.");this.before(r==="join"?"room.join":"room.leave");let o=b$1(t.token),e=String(o.jti??""),n=await(await this.key()).proof((c,l)=>["openrtc:v2:room-membership",e,r,i,c,l].join(":"));await this.post("/v2/rooms/memberships",{action:r,roomId:i,deviceCertificate:t.token,deviceProof:n}),this.record(r==="join"?"room.join":"room.leave");}grantProvider(t,i={}){let r=null,o=t;return async e=>{if(r)return r;let s=(async()=>{let n=false;o.expiresAtMs<=Date.now()+5*6e4&&o.renew&&(o=await o.renew(),n=true);let c=e.refreshGrant?"gateway.grant.refresh":"gateway.grant.issue";this.before(c),e.refreshGrant&&this.before("coordination.credential.refresh");let l=async d=>{let p=b$1(d.token),v=String(p.jti??""),g=await(await this.key()).proof((w,R)=>["openrtc:v2:gateway-grant",v,e.avenue.kind,e.avenue.id,e.runtimeInstanceId,w,R].join(":"));return this.post("/v2/gateway/grants",{credentialType:d.type,credential:d.token,avenue:e.avenue,runtimeInstanceId:e.runtimeInstanceId,ticketFingerprint:e.ticketFingerprint,deviceProof:g,...e.refreshGrant?{refreshGrant:e.refreshGrant}:{},...i.maxPeers?{maxPeers:i.maxPeers}:{},...i.features?{features:i.features}:{},...d.type==="device-certificate"&&i.deviceProfile?{deviceProfile:i.deviceProfile}:{}})},u;try{u=await l(o);}catch(d){if(!C(d))throw d;let p=await o.recoverRejectedCertificate?.();if(!p)throw d;o=p,n=true,u=await l(o);}return this.record(c),e.refreshGrant&&this.record("coordination.credential.refresh"),n&&await i.onSourceRenewed?.({token:o.token,expiresAtMs:o.expiresAtMs}),u})();r=s;try{return await s}finally{r===s&&(r=null);}}}};
|
|
2
|
-
export{A as a};
|
package/dist/chunk-NRXEG5GQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var o=["iroh-relay","iroh-moq","moq","iroh"];function u(e){return (Array.isArray(e.urls)?e.urls:[e.urls]).some(r=>typeof r=="string"&&(r.startsWith("turn:")||r.startsWith("turns:")))}function a(e){let r=(Array.isArray(e.urls)?e.urls:[e.urls]).filter(t=>typeof t=="string"&&!t.startsWith("stun:"));return r.length===0?null:{...e,urls:Array.isArray(e.urls)?r:r[0]}}function l(e){if(e)return e.map(n=>a(n)).filter(n=>n!==null)}function f(e,n){let r=new Set(["iroh-relay","iroh-moq","iroh","moq"]);n&&(r.add("webrtc"),r.add("webrtc-turn"),r.add("iroh-webrtc"));let t=(e??o).filter(i=>r.has(i));return t.length>0?t:[...o]}function c(e){let n=e?.transports?.webrtc;if(!n||n===true)return false;let r=n.implementation??"iroh-carrier";return r==="external"||r==="auto"}function d(e,n){if(c(e))return s(e,n)}function C(e,n){let r=e?.transports?.webrtc;if(!r)return;if(r===true)return {};let t=r.implementation??"iroh-carrier";if(!(t!=="iroh-carrier"&&t!=="auto"))return s(e,n)}function s(e,n){let r=e?.transports?.webrtc||void 0;if(r)return e?.strictMode||e?.transports?.privacy==="relay-only"||r.privacyMode?{...r,iceServers:l(r.iceServers),iceTransportPolicy:"relay"}:r.iceTransportPolicy==="relay"&&!(Array.isArray(r.iceServers)&&r.iceServers.some(i=>u(i)))?(n?.("[Client] Overriding relay-only ICE policy to all because no TURN servers are configured"),{...r,iceTransportPolicy:"all"}):r}export{l as a,f as b,c,d,C as e};
|
package/dist/chunk-NXM5ZGHD.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {b,a as a$1}from'./chunk-NRXEG5GQ.js';import {c}from'./chunk-LN4ALFT6.js';var y=new Set;function d(e,t){y.has(e)||(y.add(e),console.warn(t));}function h(e){return /^pk_(live|test)_[0-9a-f]{40}$/.test(e)}async function q(e,t){let r=`${e}:${t}`,o=new TextEncoder().encode(r),s=await crypto.subtle.digest("SHA-256",o);return Array.from(new Uint8Array(s)).map(S=>S.toString(16).padStart(2,"0")).join("")}function p(e){let t=typeof e.apiKey=="string"?e.apiKey.trim():"";if(t)return h(t)||d(`invalid-api-key:${t.slice(0,10)}`,"[pluto-rtc] The provided `apiKey` does not match the expected format (pk_live_... or pk_test_...). Create an app at https://api.openrtc.app/developer."),`app_${t.slice(-16)}`;throw new Error("[openrtc] `apiKey` is required. Create an app at https://api.openrtc.app/developer.")}function a(e){return e.authMode?e.authMode:("apiKey"in e&&typeof e.apiKey=="string"&&e.apiKey.trim().length>0&&typeof(e.spaceKey??e.space)=="string"&&(e.spaceKey??e.space).trim().length>0||d("default-auth-mode","[pluto-rtc] `authMode` is not set; defaulting to `anonymous` for compatibility."),"anonymous")}function F(e){let t=typeof e.projectId=="string"?e.projectId.trim():"";return t||(d("default-project-id","[pluto-rtc] `projectId` is not set; defaulting to the built-in PlutoRTC Firebase project."),i)}function v(e){return e.trim().replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function j(e){let t="storagePrefix"in e&&typeof e.storagePrefix=="string"?v(e.storagePrefix):"";return t||v(p(e))||"default"}var T={devicesPerUser:100,maxRooms:1e4,maxMembersPerRoom:250,maxPersonalDevices:25e3},B=T;var x=[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun.cloudflare.com:3478"}],P={iceServers:x},H={};var R=/^[A-Za-z0-9._-]+$/,M="[redacted]";function f(e){let t;try{t=new URL(e);}catch{throw new Error("[OpenRTC] transports.moq.relayUrl must be a valid HTTPS URL.")}if(t.protocol!=="https:")throw new Error("[OpenRTC] transports.moq.relayUrl must use HTTPS/WebTransport.");if(t.hash)throw new Error("[OpenRTC] transports.moq.relayUrl must not contain a fragment.");if(t.searchParams.has("jwt"))throw new Error("[OpenRTC] transports.moq.relayUrl must not contain a jwt query parameter; use transports.moq.accessToken.");return t}function u(e){return f(e.trim()).toString()}function Q(e,t){let r=f(e.trim());if(t!==void 0){let n=t.trim();if(!n)throw new Error("[OpenRTC] transports.moq.accessToken must not be empty when provided.");if(new TextEncoder().encode(n).byteLength>16384)throw new Error("[OpenRTC] transports.moq.accessToken exceeds the maximum supported size.");if(!R.test(n))throw new Error("[OpenRTC] transports.moq.accessToken must be a URL-safe JWT.");r.searchParams.append("jwt",n);}return r.toString()}function W(e){try{let t=new URL(e);return t.search="",t.hash="",t.toString()}catch{return "invalid-moq-relay-url"}}function z(e,t){let r=e instanceof Error?`${e.name}: ${e.message}`:String(e),n=t?.trim();return n?r.split(n).join(M):r}var A=[...c];function m(e){let t=e.spaceKey??e.space;return {...e,...t!==void 0?{spaceKey:t}:{}}}function I(e){return {...e,iceServers:e.iceServers?e.iceServers.map(t=>({...t})):e.iceServers}}function w(e){return {...e}}function O(e){return {...e}}function D(e){if(e)return {iroh:typeof e.iroh=="object"?O(e.iroh):e.iroh,webrtc:typeof e.webrtc=="object"?I(e.webrtc):e.webrtc,ble:typeof e.ble=="object"?{...e.ble}:e.ble,moq:typeof e.moq=="object"?w(e.moq):e.moq,privacy:e.privacy,optimizeFor:e.optimizeFor,priority:e.priority?[...e.priority]:e.priority}}function k(e){if(e.strictMode&&!e.transports&&(e.transports={iroh:{relayOnly:true}}),!!e.transports){if(e.transports.webrtc===true?e.transports.webrtc=I(P):e.transports.webrtc===false&&(e.transports.webrtc=void 0),e.transports.moq===true)throw new Error("[OpenRTC] transports.moq=true is ambiguous because no anonymous MoQ relay is available; provide transports.moq.relayUrl explicitly.");if(e.transports.moq===false)e.transports.moq=void 0;else if(e.transports.moq&&typeof e.transports.moq=="object"){let t=e.transports.moq,r=t.relayUrl?.trim(),n=t.accessToken;if(n!==void 0&&!n.trim())throw new Error("[OpenRTC] transports.moq.accessToken must not be empty when provided.");e.transports.moq={...t,...r?{relayUrl:u(r)}:{},...n!==void 0?{accessToken:n.trim()}:{}};}if(e.transports.iroh===true?e.transports.iroh={}:e.transports.iroh===false&&(e.transports.iroh=void 0),e.transports.privacy==="relay-only"){let t=e.transports.iroh&&typeof e.transports.iroh=="object"?e.transports.iroh:{};e.transports.iroh={...t,relayOnly:true,localDiscovery:false,localDiscoveryMode:void 0},e.transports.ble=void 0;let r=e.transports.webrtc;r&&typeof r=="object"&&(e.transports.webrtc={...r,privacyMode:true,lanMode:false,iceServers:a$1(r.iceServers)??[],iceTransportPolicy:"relay"}),e.transports.priority=b(e.transports.priority,!!e.transports.webrtc);}}}function N(e){if(!e.strictMode||!e.transports)return;let t=e.transports.iroh&&typeof e.transports.iroh=="object"?e.transports.iroh:{};e.transports.iroh={...t,relayOnly:true,relayTransportPolicy:t.relayTransportPolicy??"websocketRequired",localDiscovery:false,localDiscoveryMode:void 0},e.transports.privacy="relay-only",e.transports.ble=void 0;let r=e.transports.webrtc;r&&typeof r=="object"&&(e.transports.webrtc={...r,privacyMode:true,lanMode:false,iceServers:a$1(r.iceServers)??[],iceTransportPolicy:"relay"});let n=e.transports.moq;if(n&&typeof n=="object"){let o=n.relayUrl?.trim();if(!o)throw new Error("[OpenRTC] strictMode requires an explicit transports.moq.relayUrl.");e.transports.moq={...n,relayUrl:u(o)};}}function ee(e){let t=m(e),r=p(t),n=a(t),o={strictMode:false,disableIrohFallback:false,transportPriority:[...A],...t,authMode:n,transports:D(t.transports)};k(o),N(o),(o.strictMode||o.transports?.privacy==="relay-only")&&(o.transportPriority=b(t.transportPriority??o.transports?.priority,!!o.transports?.webrtc));let s=C(o),g=(o.discoveryMode??"space")==="space"?"client-open":"client-auth";return {appTag:r,authMode:n,configuredPersistenceMode:s,options:o,roomCreationMode:g}}function C(e){let t=e.transports?.iroh;return e.endpointIdPersistence??e.nodeIdPersistence??(typeof t=="object"?t.persistenceMode:void 0)??"ephemeral"}function te(e){return "options"in e&&"configuredPersistenceMode"in e?{apiKey:e.options.apiKey,authMode:a(e.options),projectId:e.options.projectId,storagePrefix:e.options.storagePrefix,nodeIdPersistence:e.configuredPersistenceMode}:{apiKey:e.apiKey,authMode:a(e),projectId:e.projectId,storagePrefix:e.storagePrefix,nodeIdPersistence:C(e)}}function re(e,t){t&&(e.transports={...e.transports||{},...t});}var i="pluto-rtc-prod",E="https://api.openrtc.app",U="https://gateway.openrtc.app";function ie(e){let t=m(e),n=(typeof t.projectId=="string"&&t.projectId.trim()?t.projectId.trim():void 0)??i,o=n===i;return {...t,projectId:n,coordinationGateway:t.coordinationGateway??(o?{endpoint:U,controlPlaneEndpoint:E,environment:"production"}:void 0)}}
|
|
2
|
-
export{ie as a,q as b,p as c,a as d,F as e,j as f,B as g,x as h,P as i,H as j,Q as k,W as l,z as m,m as n,ee as o,te as p,re as q};
|