@simplito/privmx-webendpoint 2.6.0 → 2.6.2

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.
Binary file
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see privmx-endpoint-web.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["privmx-webendpoint"]=t():e.PrivmxWebEndpoint=t()}(self,(()=>(()=>{"use strict";var e={54:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FinalizationHelper=void 0;const s=i(457);class n{wasmLib;static instance;static wasmLib;static init(e){n.wasmLib=e}static getInstance(){if(!n.wasmLib)throw new Error("Initialize first with the WASM Library object");return this.instance||(this.instance=new n(n.wasmLib)),this.instance}finalizationRegistry;finalizationQueue=[];scheduler=null;constructor(e){this.wasmLib=e,this.finalizationRegistry=new FinalizationRegistry((e=>{s.ApiStatic.getInstance(),this.finalizationQueue.push(e.onFree),this.scheduleCleanup()}))}scheduleCleanup(){this.scheduler||(this.scheduler=setTimeout((async()=>{for(const e of this.finalizationQueue)await e();this.finalizationQueue=[],clearTimeout(this.scheduler),this.scheduler=null}),1e3))}register(e,t){this.finalizationRegistry.register(e,t,e)}}t.FinalizationHelper=n},667:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Api=void 0;const s=i(785);t.Api=class{lib;promises;taskIdGenerator;constructor(e){this.lib=e,this.taskIdGenerator=new s.IdGenerator,this.promises=new Map,this.setResultsCallback()}async runAsync(e){return new Promise(((t,i)=>{const s=this.generateId();this.promises.set(s,{resolve:t,reject:i}),e(s)}))}resolveResult(e){1==e.status?this.promises.get(e.taskId).resolve(e.result):this.promises.get(e.taskId).reject(e.error),this.promises.delete(e.taskId)}generateId(){return this.taskIdGenerator.generateId()}setResultsCallback(){this.lib.setResultsCallback((e=>this.resolveResult(e)))}}},457:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ApiStatic=void 0,t.ApiStatic=class{static instance;static init(e){this.instance=e}static getInstance(){if(!this.instance)throw new Error("API Static not initialized");return this.instance}}},361:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseNative=void 0,t.BaseNative=class{_api;constructor(e){this._api=e}get api(){if(!this._api)throw new Error("This API instance is no longer valid because the connection associated with it has been closed.");return this._api}deleteApiRef(){this._api=null}async runAsync(e){if(!this.api)throw new Error("This API instance is no longer valid because the connection associated with it has been closed.");return this.api.runAsync(e)}}},140:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionNative=void 0;const s=i(361);class n extends s.BaseNative{lastConnectionId=-1;userVerifierPtr=-1;static verifierBindingId=-1;static getVerifierBindingId(){return++this.verifierBindingId}async newApi(e){throw new Error("Use the newConnection() - specialized version of method instead.")}async deleteApi(e){await this.runAsync((t=>this.api.lib.Connection_deleteConnection(t,e))),this.deleteApiRef()}async newConnection(){return this.runAsync((e=>this.api.lib.Connection_newConnection(e)))}async deleteConnection(e){await this.runAsync((t=>this.api.lib.Connection_deleteConnection(t,e))),this.deleteApiRef()}async connect(e,t){await this.runAsync((i=>this.api.lib.Connection_connect(i,e,t))),await this.getConnectionId(e,[])}async connectPublic(e,t){return this.runAsync((i=>this.api.lib.Connection_connectPublic(i,e,t)))}async getConnectionId(e,t){return this.lastConnectionId<0&&(this.lastConnectionId=await this.runAsync((i=>this.api.lib.Connection_getConnectionId(i,e,t)))),this.lastConnectionId}async listContexts(e,t){return this.runAsync((i=>this.api.lib.Connection_listContexts(i,e,t)))}async listContextUsers(e,t){return this.runAsync((i=>this.api.lib.Connection_listContextUsers(i,e,t)))}async subscribeFor(e,t){return this.runAsync((i=>this.api.lib.Connection_subscribeFor(i,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((i=>this.api.lib.Connection_unsubscribeFrom(i,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((i=>this.api.lib.Connection_buildSubscriptionQuery(i,e,t)))}async disconnect(e,t){await this.runAsync((i=>this.api.lib.Connection_disconnect(i,e,t)))}async setUserVerifier(e,t){this.userVerifierPtr>-1&&(await this.deleteUserVerifierInterface(this.userVerifierPtr),this.userVerifierPtr=-1);const[i,s]=t,r=n.getVerifierBindingId();window.userVerifierBinder||(window.userVerifierBinder={}),window.userVerifierBinder[r]={userVierifier_verify:async e=>{if(s&&"function"==typeof s.verify)return s.verify(e);throw new Error("Call on UserVerifierInterface with missing implementation")}},this.userVerifierPtr=await this.runAsync((e=>this.api.lib.Connection_newUserVerifierInterface(e,i,r)))}async newUserVerifierInterface(e){return this.runAsync((t=>this.api.lib.Connection_newUserVerifierInterface(t,e)))}async deleteUserVerifierInterface(e){await this.runAsync((t=>this.api.lib.Connection_deleteUserVerifierInterface(t,e)))}}t.ConnectionNative=n},711:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CryptoApiNative=void 0;const s=i(504),n=i(361);class r extends n.BaseNative{async newApi(){return this.runAsync((e=>this.api.lib.CryptoApi_newCryptoApi(e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.CryptoApi_deleteCryptoApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_create(i,e,t)))}async signData(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_signData(i,e,t)))}async verifySignature(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_verifySignature(i,e,t)))}async generatePrivateKey(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_generatePrivateKey(i,e,t)))}async derivePrivateKey(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_derivePrivateKey(i,e,t)))}async derivePrivateKey2(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_derivePrivateKey2(i,e,t)))}async derivePublicKey(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_derivePublicKey(i,e,t)))}async generateKeySymmetric(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_generateKeySymmetric(i,e,t)))}async encryptDataSymmetric(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_encryptDataSymmetric(i,e,t)))}async decryptDataSymmetric(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_decryptDataSymmetric(i,e,t)))}async convertPEMKeytoWIFKey(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_convertPEMKeytoWIFKey(i,e,t)))}async generateBip39(e,t){const i=await this.runAsync((i=>this.api.lib.CryptoApi_generateBip39(i,e,t)));return this.convertBIP(i)}async fromMnemonic(e,t){const i=await this.runAsync((i=>this.api.lib.CryptoApi_fromMnemonic(i,e,t)));return this.convertBIP(i)}async fromEntropy(e,t){const i=await this.runAsync((i=>this.api.lib.CryptoApi_fromEntropy(i,e,t)));return this.convertBIP(i)}async entropyToMnemonic(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_entropyToMnemonic(i,e,t)))}async mnemonicToEntropy(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_mnemonicToEntropy(i,e,t)))}async mnemonicToSeed(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_mnemonicToSeed(i,e,t)))}convertBIP(e){return{mnemonic:e.mnemonic,entropy:e.entropy,extKey:s.ExtKey.fromPtr(e.extKey)}}}t.CryptoApiNative=r},688:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EventApiNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(e){return this.runAsync((t=>this.api.lib.EventApi_newEventApi(t,e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.EventApi_deleteEventApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((i=>this.api.lib.EventApi_create(i,e,t)))}async emitEvent(e,t){return this.runAsync((i=>this.api.lib.EventApi_emitEvent(i,e,t)))}async subscribeFor(e,t){return this.runAsync((i=>this.api.lib.EventApi_subscribeFor(i,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((i=>this.api.lib.EventApi_unsubscribeFrom(i,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((i=>this.api.lib.EventApi_buildSubscriptionQuery(i,e,t)))}}t.EventApiNative=n},467:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EventQueueNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(e){throw new Error("Use the newEventQueue() - specialized version of method instead.")}async deleteApi(e){await this.runAsync((t=>this.api.lib.EventQueue_deleteEventQueue(t,e))),this.deleteApiRef()}async newEventQueue(){return this.runAsync((e=>this.api.lib.EventQueue_newEventQueue(e)))}async deleteEventQueue(e){await this.runAsync((t=>this.api.lib.EventQueue_deleteEventQueue(t,e))),this.deleteApiRef()}async waitEvent(e,t){return this.runAsync((i=>this.api.lib.EventQueue_waitEvent(i,e,t)))}async emitBreakEvent(e,t){return this.runAsync((i=>this.api.lib.EventQueue_emitBreakEvent(i,e,t)))}}t.EventQueueNative=n},614:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtKeyNative=void 0;const s=i(457),n=i(361);class r extends n.BaseNative{async newApi(){throw new Error("Use the specialized version of method instead.")}async deleteApi(e){return this.runAsync((t=>this.api.lib.ExtKey_deleteExtKey(t,e)))}async deleteExtKey(e){return this.runAsync((t=>this.api.lib.ExtKey_deleteExtKey(t,e)))}static async fromSeed(e){const t=s.ApiStatic.getInstance();return t.runAsync((i=>t.lib.ExtKey_fromSeed(i,e)))}static async fromBase58(e){const t=s.ApiStatic.getInstance();return t.runAsync((i=>t.lib.ExtKey_fromBase58(i,e)))}static async generateRandom(e){const t=s.ApiStatic.getInstance();return t.runAsync((i=>t.lib.ExtKey_generateRandom(i,e)))}async derive(e,t){return this.runAsync((i=>this.api.lib.ExtKey_derive(i,e,t)))}async deriveHardened(e,t){return this.runAsync((i=>this.api.lib.ExtKey_deriveHardened(i,e,t)))}getPrivatePartAsBase58(e,t){return this.runAsync((i=>this.api.lib.ExtKey_getPrivatePartAsBase58(i,e,t)))}getPublicPartAsBase58(e,t){return this.runAsync((i=>this.api.lib.ExtKey_getPublicPartAsBase58(i,e,t)))}getPrivateKey(e,t){return this.runAsync((i=>this.api.lib.ExtKey_getPrivateKey(i,e,t)))}getPublicKey(e,t){return this.runAsync((i=>this.api.lib.ExtKey_getPublicKey(i,e,t)))}getPrivateEncKey(e,t){return this.runAsync((i=>this.api.lib.ExtKey_getPrivateEncKey(i,e,t)))}getPublicKeyAsBase58Address(e,t){return this.runAsync((i=>this.api.lib.ExtKey_getPublicKeyAsBase58Address(i,e,t)))}getChainCode(e,t){return this.runAsync((i=>this.api.lib.ExtKey_getChainCode(i,e,t)))}verifyCompactSignatureWithHash(e,t){return this.runAsync((i=>this.api.lib.ExtKey_verifyCompactSignatureWithHash(i,e,t)))}isPrivate(e,t){return this.runAsync((i=>this.api.lib.ExtKey_isPrivate(i,e,t)))}}t.ExtKeyNative=r},785:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IdGenerator=void 0,t.IdGenerator=class{_id=0;generateId(){return this._id++,this._id}}},252:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InboxApiNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(e,t,i){return this.runAsync((s=>this.api.lib.InboxApi_newInboxApi(s,e,t,i)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.InboxApi_deleteInboxApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((i=>this.api.lib.InboxApi_create(i,e,t)))}async createInbox(e,t){return this.runAsync((i=>this.api.lib.InboxApi_createInbox(i,e,t)))}async updateInbox(e,t){return this.runAsync((i=>this.api.lib.InboxApi_updateInbox(i,e,t)))}async getInbox(e,t){return this.runAsync((i=>this.api.lib.InboxApi_getInbox(i,e,t)))}async listInboxes(e,t){return this.runAsync((i=>this.api.lib.InboxApi_listInboxes(i,e,t)))}async getInboxPublicView(e,t){return this.runAsync((i=>this.api.lib.InboxApi_getInboxPublicView(i,e,t)))}async deleteInbox(e,t){return this.runAsync((i=>this.api.lib.InboxApi_deleteInbox(i,e,t)))}async prepareEntry(e,t){return this.runAsync((i=>this.api.lib.InboxApi_prepareEntry(i,e,t)))}async sendEntry(e,t){return this.runAsync((i=>this.api.lib.InboxApi_sendEntry(i,e,t)))}async readEntry(e,t){return this.runAsync((i=>this.api.lib.InboxApi_readEntry(i,e,t)))}async deleteEntry(e,t){return this.runAsync((i=>this.api.lib.InboxApi_deleteEntry(i,e,t)))}async listEntries(e,t){return this.runAsync((i=>this.api.lib.InboxApi_listEntries(i,e,t)))}async createFileHandle(e,t){return this.runAsync((i=>this.api.lib.InboxApi_createFileHandle(i,e,t)))}async writeToFile(e,t){return this.runAsync((i=>this.api.lib.InboxApi_writeToFile(i,e,t)))}async openFile(e,t){return this.runAsync((i=>this.api.lib.InboxApi_openFile(i,e,t)))}async readFromFile(e,t){return this.runAsync((i=>this.api.lib.InboxApi_readFromFile(i,e,t)))}async seekInFile(e,t){return this.runAsync((i=>this.api.lib.InboxApi_seekInFile(i,e,t)))}async closeFile(e,t){return this.runAsync((i=>this.api.lib.InboxApi_closeFile(i,e,t)))}async subscribeFor(e,t){return this.runAsync((i=>this.api.lib.InboxApi_subscribeFor(i,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((i=>this.api.lib.InboxApi_unsubscribeFrom(i,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((i=>this.api.lib.InboxApi_buildSubscriptionQuery(i,e,t)))}}t.InboxApiNative=n},453:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.KvdbApiNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(e){return this.runAsync((t=>this.api.lib.KvdbApi_newKvdbApi(t,e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.KvdbApi_deleteKvdbApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_create(i,e,t)))}async createKvdb(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_createKvdb(i,e,t)))}async updateKvdb(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_updateKvdb(i,e,t)))}async deleteKvdb(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_deleteKvdb(i,e,t)))}async getKvdb(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_getKvdb(i,e,t)))}async listKvdbs(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_listKvdbs(i,e,t)))}async hasEntry(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_hasEntry(i,e,t)))}async getEntry(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_getEntry(i,e,t)))}async listEntriesKeys(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_listEntriesKeys(i,e,t)))}async listEntries(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_listEntries(i,e,t)))}async setEntry(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_setEntry(i,e,t)))}async deleteEntry(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_deleteEntry(i,e,t)))}async deleteEntries(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_deleteEntries(i,e,t)))}async subscribeFor(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_subscribeFor(i,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_unsubscribeFrom(i,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_buildSubscriptionQuery(i,e,t)))}async buildSubscriptionQueryForSelectedEntry(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_buildSubscriptionQueryForSelectedEntry(i,e,t)))}}t.KvdbApiNative=n},243:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StoreApiNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(e){return this.runAsync((t=>this.api.lib.StoreApi_newStoreApi(t,e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.StoreApi_deleteStoreApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((i=>this.api.lib.StoreApi_create(i,e,t)))}async createStore(e,t){return this.runAsync((i=>this.api.lib.StoreApi_createStore(i,e,t)))}async updateStore(e,t){return this.runAsync((i=>this.api.lib.StoreApi_updateStore(i,e,t)))}async deleteStore(e,t){return this.runAsync((i=>this.api.lib.StoreApi_deleteStore(i,e,t)))}async getStore(e,t){return this.runAsync((i=>this.api.lib.StoreApi_getStore(i,e,t)))}async listStores(e,t){return this.runAsync((i=>this.api.lib.StoreApi_listStores(i,e,t)))}async createFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_createFile(i,e,t)))}async updateFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_updateFile(i,e,t)))}async updateFileMeta(e,t){return this.runAsync((i=>this.api.lib.StoreApi_updateFileMeta(i,e,t)))}async writeToFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_writeToFile(i,e,t)))}async deleteFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_deleteFile(i,e,t)))}async getFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_getFile(i,e,t)))}async listFiles(e,t){return this.runAsync((i=>this.api.lib.StoreApi_listFiles(i,e,t)))}async openFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_openFile(i,e,t)))}async readFromFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_readFromFile(i,e,t)))}async seekInFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_seekInFile(i,e,t)))}async closeFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_closeFile(i,e,t)))}async subscribeFor(e,t){return this.runAsync((i=>this.api.lib.StoreApi_subscribeFor(i,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((i=>this.api.lib.StoreApi_unsubscribeFrom(i,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((i=>this.api.lib.StoreApi_buildSubscriptionQuery(i,e,t)))}}t.StoreApiNative=n},272:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ThreadApiNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(e){return this.runAsync((t=>this.api.lib.ThreadApi_newThreadApi(t,e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.ThreadApi_deleteThreadApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_create(i,e,t)))}async createThread(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_createThread(i,e,t)))}async updateThread(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_updateThread(i,e,t)))}async deleteThread(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_deleteThread(i,e,t)))}async getThread(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_getThread(i,e,t)))}async listThreads(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_listThreads(i,e,t)))}async getMessage(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_getMessage(i,e,t)))}async listMessages(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_listMessages(i,e,t)))}async sendMessage(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_sendMessage(i,e,t)))}async deleteMessage(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_deleteMessage(i,e,t)))}async updateMessage(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_updateMessage(i,e,t)))}async subscribeFor(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_subscribeFor(i,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_unsubscribeFrom(i,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_buildSubscriptionQuery(i,e,t)))}}t.ThreadApiNative=n},647:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseApi=void 0,t.BaseApi=class{_servicePtr;constructor(e){this._servicePtr=e}get servicePtr(){if(this._servicePtr<0)throw new Error("This API instance is no longer valid because the connection associated with it has been closed.");return this._servicePtr}destroyRefs(){this._servicePtr=-1}}},262:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Connection=void 0;const s=i(647);class n extends s.BaseApi{native;apisRefs={};nativeApisDeps={};constructor(e,t){super(t),this.native=e}async getConnectionId(){return this.native.getConnectionId(this.servicePtr,[])}async listContexts(e){return this.native.listContexts(this.servicePtr,[e])}async listContextUsers(e,t){return this.native.listContextUsers(this.servicePtr,[e,t])}async subscribeFor(e){return this.native.subscribeFor(this.servicePtr,[e])}async unsubscribeFrom(e){return this.native.unsubscribeFrom(this.servicePtr,[e])}async buildSubscriptionQuery(e,t,i){return this.native.buildSubscriptionQuery(this.servicePtr,[e,t,i])}async disconnect(){await this.native.disconnect(this.servicePtr,[]),await this.freeApis(),await this.native.deleteConnection(this.servicePtr)}setUserVerifier(e){return this.native.setUserVerifier(this.servicePtr,[this.servicePtr,e])}async freeApis(){for(const e in this.apisRefs)this.nativeApisDeps[e]&&await this.nativeApisDeps[e].deleteApi(this.apisRefs[e]._apiServicePtr)}}t.Connection=n},11:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CryptoApi=void 0;const s=i(647);class n extends s.BaseApi{native;constructor(e,t){super(t),this.native=e}async signData(e,t){return this.native.signData(this.servicePtr,[e,t])}async verifySignature(e,t,i){return this.native.verifySignature(this.servicePtr,[e,t,i])}async generatePrivateKey(e){return this.native.generatePrivateKey(this.servicePtr,[e])}async derivePrivateKey(e,t){return this.native.derivePrivateKey(this.servicePtr,[e,t])}async derivePrivateKey2(e,t){return this.native.derivePrivateKey2(this.servicePtr,[e,t])}async derivePublicKey(e){return this.native.derivePublicKey(this.servicePtr,[e])}async generateKeySymmetric(){return this.native.generateKeySymmetric(this.servicePtr,[])}async encryptDataSymmetric(e,t){return this.native.encryptDataSymmetric(this.servicePtr,[e,t])}async decryptDataSymmetric(e,t){return this.native.decryptDataSymmetric(this.servicePtr,[e,t])}async convertPEMKeytoWIFKey(e){return this.native.convertPEMKeytoWIFKey(this.servicePtr,[e])}async generateBip39(e,t=""){return this.native.generateBip39(this.servicePtr,[e,t])}async fromMnemonic(e,t=""){return this.native.fromMnemonic(this.servicePtr,[e,t])}async fromEntropy(e,t=""){return this.native.fromEntropy(this.servicePtr,[e,t])}async entropyToMnemonic(e){return this.native.entropyToMnemonic(this.servicePtr,[e])}async mnemonicToEntropy(e){return this.native.mnemonicToEntropy(this.servicePtr,[e])}async mnemonicToSeed(e,t=""){return this.native.mnemonicToSeed(this.servicePtr,[e,t])}}t.CryptoApi=n},181:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EndpointFactory=void 0;const s=i(667),n=i(457),r=i(140),a=i(711),c=i(688),u=i(467),o=i(252),h=i(453),y=i(243),p=i(272),l=i(54),v=i(262),d=i(11),b=i(590),A=i(297),P=i(134),_=i(789),w=i(985),g=i(148);class E{static api;static eventQueueInstance;static async setup(e){const t=e||document.currentScript.src.split("/").slice(0,-1).join("/"),i=["driver-web-context.js","endpoint-wasm-module.js"];for(const e of i)await this.loadScript(t+"/"+e);const s=await endpointWasmModule();E.init(s)}static async loadScript(e){return new Promise((t=>{const i=document.getElementsByTagName("head")[0],s=document.createElement("script");s.type="text/javascript",s.src=e,s.onload=()=>{t()},i.appendChild(s)}))}static init(e){this.api=new s.Api(e),n.ApiStatic.init(this.api),l.FinalizationHelper.init(e)}static async getEventQueue(){if(!this.eventQueueInstance){const e=new u.EventQueueNative(this.api),t=await e.newEventQueue();this.eventQueueInstance=new A.EventQueue(e,t)}return this.eventQueueInstance}static generateDefaultPKIVerificationOptions(){return{bridgeInstanceId:void 0,bridgePubKey:void 0}}static async connect(e,t,i,s){const n=new r.ConnectionNative(this.api),a=await n.newConnection();return await n.connect(a,[e,t,i,s||this.generateDefaultPKIVerificationOptions()]),new v.Connection(n,a)}static async connectPublic(e,t,i){const s=new r.ConnectionNative(this.api),n=await s.newConnection();return await s.connectPublic(n,[e,t,i||this.generateDefaultPKIVerificationOptions()]),new v.Connection(s,n)}static async createThreadApi(e){if("threads"in e.apisRefs)throw new Error("ThreadApi already registered for given connection.");const t=new p.ThreadApiNative(this.api),i=await t.newApi(e.servicePtr);return await t.create(i,[]),e.apisRefs.threads={_apiServicePtr:i},e.nativeApisDeps.threads=t,new g.ThreadApi(t,i)}static async createStoreApi(e){if("stores"in e.apisRefs)throw new Error("StoreApi already registered for given connection.");const t=new y.StoreApiNative(this.api),i=await t.newApi(e.servicePtr);return e.apisRefs.stores={_apiServicePtr:i},e.nativeApisDeps.stores=t,await t.create(i,[]),new w.StoreApi(t,i)}static async createInboxApi(e,t,i){if("inboxes"in e.apisRefs)throw new Error("InboxApi already registered for given connection.");const s=new o.InboxApiNative(this.api),n=await s.newApi(e.servicePtr,t.servicePtr,i.servicePtr);return e.apisRefs.inboxes={_apiServicePtr:n},e.nativeApisDeps.inboxes=s,await s.create(n,[]),new P.InboxApi(s,n)}static async createKvdbApi(e){if("kvdbs"in e.apisRefs)throw new Error("KvdbApi already registered for given connection.");const t=new h.KvdbApiNative(this.api),i=await t.newApi(e.servicePtr);return await t.create(i,[]),e.apisRefs.kvdbs={_apiServicePtr:i},e.nativeApisDeps.kvdbs=t,new _.KvdbApi(t,i)}static async createCryptoApi(){const e=new a.CryptoApiNative(this.api),t=await e.newApi();return await e.create(t,[]),new d.CryptoApi(e,t)}static async createEventApi(e){if("events"in e.apisRefs)throw new Error("EventApi already registered for given connection.");const t=new c.EventApiNative(this.api),i=await t.newApi(e.servicePtr);return e.apisRefs.events={_apiServicePtr:i},e.nativeApisDeps.events=t,await t.create(i,[]),new b.EventApi(t,i)}}t.EndpointFactory=E},590:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EventApi=void 0;const s=i(647);class n extends s.BaseApi{native;constructor(e,t){super(t),this.native=e}async emitEvent(e,t,i,s){return this.native.emitEvent(this.servicePtr,[e,t,i,s])}async subscribeFor(e){return this.native.subscribeFor(this.servicePtr,[e])}async unsubscribeFrom(e){return this.native.unsubscribeFrom(this.servicePtr,[e])}async buildSubscriptionQuery(e,t,i){return this.native.buildSubscriptionQuery(this.servicePtr,[e,t,i])}}t.EventApi=n},297:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EventQueue=void 0;const s=i(647);class n extends s.BaseApi{native;isPending=!1;constructor(e,t){super(t),this.native=e}async waitEvent(){if(this.isPending)throw"WaitEvent() is already in a pending state waiting for new events";try{return await this.native.waitEvent(this.servicePtr,[])}finally{this.isPending=!1}}async emitBreakEvent(){return this.native.emitBreakEvent(this.servicePtr,[])}}t.EventQueue=n},504:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtKey=void 0;const s=i(457),n=i(614),r=i(54),a=i(647);class c extends a.BaseApi{native;ptr;static async freeExtKey(e){const t=new n.ExtKeyNative(s.ApiStatic.getInstance());await t.deleteExtKey(e)}static async fromSeed(e){const t=await n.ExtKeyNative.fromSeed([e]),i=new n.ExtKeyNative(s.ApiStatic.getInstance()),a=new c(i,t);return r.FinalizationHelper.getInstance().register(a,{ptr:t,onFree:()=>this.freeExtKey(t)}),a}static async fromBase58(e){const t=await n.ExtKeyNative.fromBase58([e]),i=new n.ExtKeyNative(s.ApiStatic.getInstance()),a=new c(i,t);return r.FinalizationHelper.getInstance().register(a,{ptr:t,onFree:()=>this.freeExtKey(t)}),a}static async generateRandom(){const e=await n.ExtKeyNative.generateRandom([]),t=new n.ExtKeyNative(s.ApiStatic.getInstance()),i=new c(t,e);return r.FinalizationHelper.getInstance().register(i,{ptr:e,onFree:()=>this.freeExtKey(e)}),i}constructor(e,t){super(t),this.native=e,this.ptr=t}static fromPtr(e){const t=new n.ExtKeyNative(s.ApiStatic.getInstance());return new c(t,e)}async derive(e){const t=await this.native.derive(this.servicePtr,[e]),i=new c(this.native,t);return r.FinalizationHelper.getInstance().register(i,{ptr:t,onFree:()=>c.freeExtKey(t)}),i}async deriveHardened(e){const t=await this.native.deriveHardened(this.servicePtr,[e]);return new c(this.native,t)}async getPrivatePartAsBase58(){return this.native.getPrivatePartAsBase58(this.servicePtr,[])}async getPublicPartAsBase58(){return this.native.getPublicPartAsBase58(this.servicePtr,[])}async getPrivateKey(){return this.native.getPrivateKey(this.servicePtr,[])}async getPublicKey(){return this.native.getPublicKey(this.servicePtr,[])}async getPrivateEncKey(){return this.native.getPrivateEncKey(this.servicePtr,[])}async getPublicKeyAsBase58Address(){return this.native.getPublicKeyAsBase58Address(this.servicePtr,[])}async getChainCode(){return this.native.getChainCode(this.servicePtr,[])}async verifyCompactSignatureWithHash(e,t){return this.native.verifyCompactSignatureWithHash(this.servicePtr,[e,t])}async isPrivate(){return this.native.isPrivate(this.servicePtr,[])}}t.ExtKey=c},134:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InboxApi=void 0;const s=i(647);class n extends s.BaseApi{native;constructor(e,t){super(t),this.native=e}async createInbox(e,t,i,s,n,r,a){return this.native.createInbox(this.servicePtr,[e,t,i,s,n,r,a])}async updateInbox(e,t,i,s,n,r,a,c,u,o){return this.native.updateInbox(this.servicePtr,[e,t,i,s,n,r,a,c,u,o])}async getInbox(e){return this.native.getInbox(this.servicePtr,[e])}async listInboxes(e,t){return this.native.listInboxes(this.servicePtr,[e,t])}async getInboxPublicView(e){return this.native.getInboxPublicView(this.servicePtr,[e])}async deleteInbox(e){return this.native.deleteInbox(this.servicePtr,[e])}async prepareEntry(e,t,i,s){return this.native.prepareEntry(this.servicePtr,[e,t,i,s])}async sendEntry(e){return this.native.sendEntry(this.servicePtr,[e])}async readEntry(e){return this.native.readEntry(this.servicePtr,[e])}async listEntries(e,t){return this.native.listEntries(this.servicePtr,[e,t])}async deleteEntry(e){return this.native.deleteEntry(this.servicePtr,[e])}async createFileHandle(e,t,i){return this.native.createFileHandle(this.servicePtr,[e,t,i])}async writeToFile(e,t,i){return this.native.writeToFile(this.servicePtr,[e,t,i])}async openFile(e){return this.native.openFile(this.servicePtr,[e])}async readFromFile(e,t){return this.native.readFromFile(this.servicePtr,[e,t])}async seekInFile(e,t){return this.native.seekInFile(this.servicePtr,[e,t])}async closeFile(e){return this.native.closeFile(this.servicePtr,[e])}async subscribeFor(e){return this.native.subscribeFor(this.servicePtr,[e])}async unsubscribeFrom(e){return this.native.unsubscribeFrom(this.servicePtr,[e])}async buildSubscriptionQuery(e,t,i){return this.native.buildSubscriptionQuery(this.servicePtr,[e,t,i])}}t.InboxApi=n},789:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.KvdbApi=void 0;const s=i(647);class n extends s.BaseApi{native;constructor(e,t){super(t),this.native=e}async createKvdb(e,t,i,s,n,r){return this.native.createKvdb(this.servicePtr,[e,t,i,s,n,r])}async updateKvdb(e,t,i,s,n,r,a,c,u){return this.native.updateKvdb(this.servicePtr,[e,t,i,s,n,r,a,c,u])}async deleteKvdb(e){return this.native.deleteKvdb(this.servicePtr,[e])}async getKvdb(e){return this.native.getKvdb(this.servicePtr,[e])}async listKvdbs(e,t){return this.native.listKvdbs(this.servicePtr,[e,t])}async getEntry(e,t){return this.native.getEntry(this.servicePtr,[e,t])}async hasEntry(e,t){return this.native.hasEntry(this.servicePtr,[e,t])}async listEntriesKeys(e,t){return this.native.listEntriesKeys(this.servicePtr,[e,t])}async listEntries(e,t){return this.native.listEntries(this.servicePtr,[e,t])}async setEntry(e,t,i,s,n,r){return this.native.setEntry(this.servicePtr,[e,t,i,s,n,r||0])}async deleteEntry(e,t){return this.native.deleteEntry(this.servicePtr,[e,t])}async deleteEntries(e,t){return this.native.deleteEntries(this.servicePtr,[e,t])}async subscribeFor(e){return this.native.subscribeFor(this.servicePtr,[e])}async unsubscribeFrom(e){return this.native.unsubscribeFrom(this.servicePtr,[e])}async buildSubscriptionQuery(e,t,i){return this.native.buildSubscriptionQuery(this.servicePtr,[e,t,i])}async buildSubscriptionQueryForSelectedEntry(e,t,i){return this.native.buildSubscriptionQueryForSelectedEntry(this.servicePtr,[e,t,i])}}t.KvdbApi=n},985:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StoreApi=void 0;const s=i(647);class n extends s.BaseApi{native;constructor(e,t){super(t),this.native=e}async createStore(e,t,i,s,n,r){return this.native.createStore(this.servicePtr,[e,t,i,s,n,r])}async updateStore(e,t,i,s,n,r,a,c,u){return this.native.updateStore(this.servicePtr,[e,t,i,s,n,r,a,c,u])}async deleteStore(e){return this.native.deleteStore(this.servicePtr,[e])}async getStore(e){return this.native.getStore(this.servicePtr,[e])}async listStores(e,t){return this.native.listStores(this.servicePtr,[e,t])}async createFile(e,t,i,s,n=!1){return this.native.createFile(this.servicePtr,[e,t,i,s,n])}async updateFile(e,t,i,s){return this.native.updateFile(this.servicePtr,[e,t,i,s])}async updateFileMeta(e,t,i){return this.native.updateFileMeta(this.servicePtr,[e,t,i])}async writeToFile(e,t,i=!1){return this.native.writeToFile(this.servicePtr,[e,t,i])}async deleteFile(e){return this.native.deleteFile(this.servicePtr,[e])}async getFile(e){return this.native.getFile(this.servicePtr,[e])}async listFiles(e,t){return this.native.listFiles(this.servicePtr,[e,t])}async openFile(e){return this.native.openFile(this.servicePtr,[e])}async readFromFile(e,t){return this.native.readFromFile(this.servicePtr,[e,t])}async seekInFile(e,t){return this.native.seekInFile(this.servicePtr,[e,t])}async closeFile(e){return this.native.closeFile(this.servicePtr,[e])}async subscribeFor(e){return this.native.subscribeFor(this.servicePtr,[e])}async unsubscribeFrom(e){return this.native.unsubscribeFrom(this.servicePtr,[e])}async buildSubscriptionQuery(e,t,i){return this.native.buildSubscriptionQuery(this.servicePtr,[e,t,i])}}t.StoreApi=n},148:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ThreadApi=void 0;const s=i(647);class n extends s.BaseApi{native;constructor(e,t){super(t),this.native=e}async createThread(e,t,i,s,n,r){return this.native.createThread(this.servicePtr,[e,t,i,s,n,r])}async updateThread(e,t,i,s,n,r,a,c,u){return this.native.updateThread(this.servicePtr,[e,t,i,s,n,r,a,c,u])}async deleteThread(e){return this.native.deleteThread(this.servicePtr,[e])}async getThread(e){return this.native.getThread(this.servicePtr,[e])}async listThreads(e,t){return this.native.listThreads(this.servicePtr,[e,t])}async getMessage(e){return this.native.getMessage(this.servicePtr,[e])}async listMessages(e,t){return this.native.listMessages(this.servicePtr,[e,t])}async sendMessage(e,t,i,s){return this.native.sendMessage(this.servicePtr,[e,t,i,s])}async deleteMessage(e){return this.native.deleteMessage(this.servicePtr,[e])}async updateMessage(e,t,i,s){return this.native.updateMessage(this.servicePtr,[e,t,i,s])}async subscribeFor(e){return this.native.subscribeFor(this.servicePtr,[e])}async unsubscribeFrom(e){return this.native.unsubscribeFrom(this.servicePtr,[e])}async buildSubscriptionQuery(e,t,i){return this.native.buildSubscriptionQuery(this.servicePtr,[e,t,i])}}t.ThreadApi=n}},t={};function i(s){var n=t[s];if(void 0!==n)return n.exports;var r=t[s]={exports:{}};return e[s](r,r.exports,i),r.exports}var s={};return(()=>{var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.Endpoint=void 0;const t=i(181);Object.defineProperty(e,"Endpoint",{enumerable:!0,get:function(){return t.EndpointFactory}})})(),s})()));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["privmx-webendpoint"]=t():e.PrivmxWebEndpoint=t()}(self,(()=>(()=>{"use strict";var e={54:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FinalizationHelper=void 0;const s=i(457);class n{wasmLib;static instance;static wasmLib;static init(e){n.wasmLib=e}static getInstance(){if(!n.wasmLib)throw new Error("Initialize first with the WASM Library object");return this.instance||(this.instance=new n(n.wasmLib)),this.instance}finalizationRegistry;finalizationQueue=[];scheduler=null;constructor(e){this.wasmLib=e,this.finalizationRegistry=new FinalizationRegistry((e=>{s.ApiStatic.getInstance(),this.finalizationQueue.push(e.onFree),this.scheduleCleanup()}))}scheduleCleanup(){this.scheduler||(this.scheduler=setTimeout((async()=>{for(const e of this.finalizationQueue)await e();this.finalizationQueue=[],clearTimeout(this.scheduler),this.scheduler=null}),1e3))}register(e,t){this.finalizationRegistry.register(e,t,e)}}t.FinalizationHelper=n},667:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Api=void 0;const s=i(785);t.Api=class{lib;promises;taskIdGenerator;constructor(e){this.lib=e,this.taskIdGenerator=new s.IdGenerator,this.promises=new Map,this.setResultsCallback()}async runAsync(e){return new Promise(((t,i)=>{const s=this.generateId();this.promises.set(s,{resolve:t,reject:i}),e(s)}))}resolveResult(e){1==e.status?this.promises.get(e.taskId).resolve(e.result):this.promises.get(e.taskId).reject(e.error),this.promises.delete(e.taskId)}generateId(){return this.taskIdGenerator.generateId()}setResultsCallback(){this.lib.setResultsCallback((e=>this.resolveResult(e)))}}},457:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ApiStatic=void 0,t.ApiStatic=class{static instance;static init(e){this.instance=e}static getInstance(){if(!this.instance)throw new Error("API Static not initialized");return this.instance}}},361:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseNative=void 0,t.BaseNative=class{_api;constructor(e){this._api=e}get api(){if(!this._api)throw new Error("This API instance is no longer valid because the connection associated with it has been closed.");return this._api}deleteApiRef(){this._api=null}async runAsync(e){if(!this.api)throw new Error("This API instance is no longer valid because the connection associated with it has been closed.");return this.api.runAsync(e)}}},140:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionNative=void 0;const s=i(361);class n extends s.BaseNative{lastConnectionId=-1;userVerifierPtr=-1;static verifierBindingId=-1;static getVerifierBindingId(){return++this.verifierBindingId}async newApi(e){throw new Error("Use the newConnection() - specialized version of method instead.")}async deleteApi(e){await this.runAsync((t=>this.api.lib.Connection_deleteConnection(t,e))),this.deleteApiRef()}async newConnection(){return this.runAsync((e=>this.api.lib.Connection_newConnection(e)))}async deleteConnection(e){await this.runAsync((t=>this.api.lib.Connection_deleteConnection(t,e))),this.deleteApiRef()}async connect(e,t){await this.runAsync((i=>this.api.lib.Connection_connect(i,e,t))),await this.getConnectionId(e,[])}async connectPublic(e,t){return this.runAsync((i=>this.api.lib.Connection_connectPublic(i,e,t)))}async getConnectionId(e,t){return this.lastConnectionId<0&&(this.lastConnectionId=await this.runAsync((i=>this.api.lib.Connection_getConnectionId(i,e,t)))),this.lastConnectionId}async listContexts(e,t){return this.runAsync((i=>this.api.lib.Connection_listContexts(i,e,t)))}async listContextUsers(e,t){return this.runAsync((i=>this.api.lib.Connection_listContextUsers(i,e,t)))}async subscribeFor(e,t){return this.runAsync((i=>this.api.lib.Connection_subscribeFor(i,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((i=>this.api.lib.Connection_unsubscribeFrom(i,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((i=>this.api.lib.Connection_buildSubscriptionQuery(i,e,t)))}async disconnect(e,t){await this.runAsync((i=>this.api.lib.Connection_disconnect(i,e,t)))}async setUserVerifier(e,t){this.userVerifierPtr>-1&&(await this.deleteUserVerifierInterface(this.userVerifierPtr),this.userVerifierPtr=-1);const[i,s]=t,r=n.getVerifierBindingId();window.userVerifierBinder||(window.userVerifierBinder={}),window.userVerifierBinder[r]={userVierifier_verify:async e=>{if(s&&"function"==typeof s.verify)return s.verify(e);throw new Error("Call on UserVerifierInterface with missing implementation")}},this.userVerifierPtr=await this.runAsync((e=>this.api.lib.Connection_newUserVerifierInterface(e,i,r)))}async newUserVerifierInterface(e){return this.runAsync((t=>this.api.lib.Connection_newUserVerifierInterface(t,e)))}async deleteUserVerifierInterface(e){await this.runAsync((t=>this.api.lib.Connection_deleteUserVerifierInterface(t,e)))}}t.ConnectionNative=n},711:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CryptoApiNative=void 0;const s=i(504),n=i(361);class r extends n.BaseNative{async newApi(){return this.runAsync((e=>this.api.lib.CryptoApi_newCryptoApi(e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.CryptoApi_deleteCryptoApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_create(i,e,t)))}async signData(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_signData(i,e,t)))}async verifySignature(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_verifySignature(i,e,t)))}async generatePrivateKey(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_generatePrivateKey(i,e,t)))}async derivePrivateKey(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_derivePrivateKey(i,e,t)))}async derivePrivateKey2(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_derivePrivateKey2(i,e,t)))}async derivePublicKey(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_derivePublicKey(i,e,t)))}async generateKeySymmetric(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_generateKeySymmetric(i,e,t)))}async encryptDataSymmetric(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_encryptDataSymmetric(i,e,t)))}async decryptDataSymmetric(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_decryptDataSymmetric(i,e,t)))}async convertPEMKeytoWIFKey(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_convertPEMKeytoWIFKey(i,e,t)))}async generateBip39(e,t){const i=await this.runAsync((i=>this.api.lib.CryptoApi_generateBip39(i,e,t)));return this.convertBIP(i)}async fromMnemonic(e,t){const i=await this.runAsync((i=>this.api.lib.CryptoApi_fromMnemonic(i,e,t)));return this.convertBIP(i)}async fromEntropy(e,t){const i=await this.runAsync((i=>this.api.lib.CryptoApi_fromEntropy(i,e,t)));return this.convertBIP(i)}async entropyToMnemonic(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_entropyToMnemonic(i,e,t)))}async mnemonicToEntropy(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_mnemonicToEntropy(i,e,t)))}async mnemonicToSeed(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_mnemonicToSeed(i,e,t)))}convertBIP(e){return{mnemonic:e.mnemonic,entropy:e.entropy,extKey:s.ExtKey.fromPtr(e.extKey)}}}t.CryptoApiNative=r},688:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EventApiNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(e){return this.runAsync((t=>this.api.lib.EventApi_newEventApi(t,e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.EventApi_deleteEventApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((i=>this.api.lib.EventApi_create(i,e,t)))}async emitEvent(e,t){return this.runAsync((i=>this.api.lib.EventApi_emitEvent(i,e,t)))}async subscribeFor(e,t){return this.runAsync((i=>this.api.lib.EventApi_subscribeFor(i,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((i=>this.api.lib.EventApi_unsubscribeFrom(i,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((i=>this.api.lib.EventApi_buildSubscriptionQuery(i,e,t)))}}t.EventApiNative=n},467:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EventQueueNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(e){throw new Error("Use the newEventQueue() - specialized version of method instead.")}async deleteApi(e){await this.runAsync((t=>this.api.lib.EventQueue_deleteEventQueue(t,e))),this.deleteApiRef()}async newEventQueue(){return this.runAsync((e=>this.api.lib.EventQueue_newEventQueue(e)))}async deleteEventQueue(e){await this.runAsync((t=>this.api.lib.EventQueue_deleteEventQueue(t,e))),this.deleteApiRef()}async waitEvent(e,t){return this.runAsync((i=>this.api.lib.EventQueue_waitEvent(i,e,t)))}async emitBreakEvent(e,t){return this.runAsync((i=>this.api.lib.EventQueue_emitBreakEvent(i,e,t)))}}t.EventQueueNative=n},614:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtKeyNative=void 0;const s=i(457),n=i(361);class r extends n.BaseNative{async newApi(){throw new Error("Use the specialized version of method instead.")}async deleteApi(e){return this.runAsync((t=>this.api.lib.ExtKey_deleteExtKey(t,e)))}async deleteExtKey(e){return this.runAsync((t=>this.api.lib.ExtKey_deleteExtKey(t,e)))}static async fromSeed(e){const t=s.ApiStatic.getInstance();return t.runAsync((i=>t.lib.ExtKey_fromSeed(i,e)))}static async fromBase58(e){const t=s.ApiStatic.getInstance();return t.runAsync((i=>t.lib.ExtKey_fromBase58(i,e)))}static async generateRandom(e){const t=s.ApiStatic.getInstance();return t.runAsync((i=>t.lib.ExtKey_generateRandom(i,e)))}async derive(e,t){return this.runAsync((i=>this.api.lib.ExtKey_derive(i,e,t)))}async deriveHardened(e,t){return this.runAsync((i=>this.api.lib.ExtKey_deriveHardened(i,e,t)))}getPrivatePartAsBase58(e,t){return this.runAsync((i=>this.api.lib.ExtKey_getPrivatePartAsBase58(i,e,t)))}getPublicPartAsBase58(e,t){return this.runAsync((i=>this.api.lib.ExtKey_getPublicPartAsBase58(i,e,t)))}getPrivateKey(e,t){return this.runAsync((i=>this.api.lib.ExtKey_getPrivateKey(i,e,t)))}getPublicKey(e,t){return this.runAsync((i=>this.api.lib.ExtKey_getPublicKey(i,e,t)))}getPrivateEncKey(e,t){return this.runAsync((i=>this.api.lib.ExtKey_getPrivateEncKey(i,e,t)))}getPublicKeyAsBase58Address(e,t){return this.runAsync((i=>this.api.lib.ExtKey_getPublicKeyAsBase58Address(i,e,t)))}getChainCode(e,t){return this.runAsync((i=>this.api.lib.ExtKey_getChainCode(i,e,t)))}verifyCompactSignatureWithHash(e,t){return this.runAsync((i=>this.api.lib.ExtKey_verifyCompactSignatureWithHash(i,e,t)))}isPrivate(e,t){return this.runAsync((i=>this.api.lib.ExtKey_isPrivate(i,e,t)))}}t.ExtKeyNative=r},785:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IdGenerator=void 0,t.IdGenerator=class{_id=0;generateId(){return this._id++,this._id}}},252:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InboxApiNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(e,t,i){return this.runAsync((s=>this.api.lib.InboxApi_newInboxApi(s,e,t,i)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.InboxApi_deleteInboxApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((i=>this.api.lib.InboxApi_create(i,e,t)))}async createInbox(e,t){return this.runAsync((i=>this.api.lib.InboxApi_createInbox(i,e,t)))}async updateInbox(e,t){return this.runAsync((i=>this.api.lib.InboxApi_updateInbox(i,e,t)))}async getInbox(e,t){return this.runAsync((i=>this.api.lib.InboxApi_getInbox(i,e,t)))}async listInboxes(e,t){return this.runAsync((i=>this.api.lib.InboxApi_listInboxes(i,e,t)))}async getInboxPublicView(e,t){return this.runAsync((i=>this.api.lib.InboxApi_getInboxPublicView(i,e,t)))}async deleteInbox(e,t){return this.runAsync((i=>this.api.lib.InboxApi_deleteInbox(i,e,t)))}async prepareEntry(e,t){return this.runAsync((i=>this.api.lib.InboxApi_prepareEntry(i,e,t)))}async sendEntry(e,t){return this.runAsync((i=>this.api.lib.InboxApi_sendEntry(i,e,t)))}async readEntry(e,t){return this.runAsync((i=>this.api.lib.InboxApi_readEntry(i,e,t)))}async deleteEntry(e,t){return this.runAsync((i=>this.api.lib.InboxApi_deleteEntry(i,e,t)))}async listEntries(e,t){return this.runAsync((i=>this.api.lib.InboxApi_listEntries(i,e,t)))}async createFileHandle(e,t){return this.runAsync((i=>this.api.lib.InboxApi_createFileHandle(i,e,t)))}async writeToFile(e,t){return this.runAsync((i=>this.api.lib.InboxApi_writeToFile(i,e,t)))}async openFile(e,t){return this.runAsync((i=>this.api.lib.InboxApi_openFile(i,e,t)))}async readFromFile(e,t){return this.runAsync((i=>this.api.lib.InboxApi_readFromFile(i,e,t)))}async seekInFile(e,t){return this.runAsync((i=>this.api.lib.InboxApi_seekInFile(i,e,t)))}async closeFile(e,t){return this.runAsync((i=>this.api.lib.InboxApi_closeFile(i,e,t)))}async subscribeFor(e,t){return this.runAsync((i=>this.api.lib.InboxApi_subscribeFor(i,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((i=>this.api.lib.InboxApi_unsubscribeFrom(i,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((i=>this.api.lib.InboxApi_buildSubscriptionQuery(i,e,t)))}}t.InboxApiNative=n},453:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.KvdbApiNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(e){return this.runAsync((t=>this.api.lib.KvdbApi_newKvdbApi(t,e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.KvdbApi_deleteKvdbApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_create(i,e,t)))}async createKvdb(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_createKvdb(i,e,t)))}async updateKvdb(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_updateKvdb(i,e,t)))}async deleteKvdb(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_deleteKvdb(i,e,t)))}async getKvdb(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_getKvdb(i,e,t)))}async listKvdbs(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_listKvdbs(i,e,t)))}async hasEntry(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_hasEntry(i,e,t)))}async getEntry(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_getEntry(i,e,t)))}async listEntriesKeys(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_listEntriesKeys(i,e,t)))}async listEntries(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_listEntries(i,e,t)))}async setEntry(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_setEntry(i,e,t)))}async deleteEntry(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_deleteEntry(i,e,t)))}async deleteEntries(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_deleteEntries(i,e,t)))}async subscribeFor(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_subscribeFor(i,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_unsubscribeFrom(i,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_buildSubscriptionQuery(i,e,t)))}async buildSubscriptionQueryForSelectedEntry(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_buildSubscriptionQueryForSelectedEntry(i,e,t)))}}t.KvdbApiNative=n},243:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StoreApiNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(e){return this.runAsync((t=>this.api.lib.StoreApi_newStoreApi(t,e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.StoreApi_deleteStoreApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((i=>this.api.lib.StoreApi_create(i,e,t)))}async createStore(e,t){return this.runAsync((i=>this.api.lib.StoreApi_createStore(i,e,t)))}async updateStore(e,t){return this.runAsync((i=>this.api.lib.StoreApi_updateStore(i,e,t)))}async deleteStore(e,t){return this.runAsync((i=>this.api.lib.StoreApi_deleteStore(i,e,t)))}async getStore(e,t){return this.runAsync((i=>this.api.lib.StoreApi_getStore(i,e,t)))}async listStores(e,t){return this.runAsync((i=>this.api.lib.StoreApi_listStores(i,e,t)))}async createFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_createFile(i,e,t)))}async updateFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_updateFile(i,e,t)))}async updateFileMeta(e,t){return this.runAsync((i=>this.api.lib.StoreApi_updateFileMeta(i,e,t)))}async writeToFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_writeToFile(i,e,t)))}async deleteFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_deleteFile(i,e,t)))}async getFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_getFile(i,e,t)))}async listFiles(e,t){return this.runAsync((i=>this.api.lib.StoreApi_listFiles(i,e,t)))}async openFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_openFile(i,e,t)))}async readFromFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_readFromFile(i,e,t)))}async seekInFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_seekInFile(i,e,t)))}async closeFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_closeFile(i,e,t)))}async syncFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_syncFile(i,e,t)))}async subscribeFor(e,t){return this.runAsync((i=>this.api.lib.StoreApi_subscribeFor(i,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((i=>this.api.lib.StoreApi_unsubscribeFrom(i,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((i=>this.api.lib.StoreApi_buildSubscriptionQuery(i,e,t)))}}t.StoreApiNative=n},272:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ThreadApiNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(e){return this.runAsync((t=>this.api.lib.ThreadApi_newThreadApi(t,e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.ThreadApi_deleteThreadApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_create(i,e,t)))}async createThread(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_createThread(i,e,t)))}async updateThread(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_updateThread(i,e,t)))}async deleteThread(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_deleteThread(i,e,t)))}async getThread(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_getThread(i,e,t)))}async listThreads(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_listThreads(i,e,t)))}async getMessage(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_getMessage(i,e,t)))}async listMessages(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_listMessages(i,e,t)))}async sendMessage(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_sendMessage(i,e,t)))}async deleteMessage(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_deleteMessage(i,e,t)))}async updateMessage(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_updateMessage(i,e,t)))}async subscribeFor(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_subscribeFor(i,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_unsubscribeFrom(i,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_buildSubscriptionQuery(i,e,t)))}}t.ThreadApiNative=n},647:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseApi=void 0,t.BaseApi=class{_servicePtr;constructor(e){this._servicePtr=e}get servicePtr(){if(this._servicePtr<0)throw new Error("This API instance is no longer valid because the connection associated with it has been closed.");return this._servicePtr}destroyRefs(){this._servicePtr=-1}}},262:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Connection=void 0;const s=i(647);class n extends s.BaseApi{native;apisRefs={};nativeApisDeps={};constructor(e,t){super(t),this.native=e}async getConnectionId(){return this.native.getConnectionId(this.servicePtr,[])}async listContexts(e){return this.native.listContexts(this.servicePtr,[e])}async listContextUsers(e,t){return this.native.listContextUsers(this.servicePtr,[e,t])}async subscribeFor(e){return this.native.subscribeFor(this.servicePtr,[e])}async unsubscribeFrom(e){return this.native.unsubscribeFrom(this.servicePtr,[e])}async buildSubscriptionQuery(e,t,i){return this.native.buildSubscriptionQuery(this.servicePtr,[e,t,i])}async disconnect(){await this.native.disconnect(this.servicePtr,[]),await this.freeApis(),await this.native.deleteConnection(this.servicePtr)}setUserVerifier(e){return this.native.setUserVerifier(this.servicePtr,[this.servicePtr,e])}async freeApis(){for(const e in this.apisRefs)this.nativeApisDeps[e]&&await this.nativeApisDeps[e].deleteApi(this.apisRefs[e]._apiServicePtr)}}t.Connection=n},11:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CryptoApi=void 0;const s=i(647);class n extends s.BaseApi{native;constructor(e,t){super(t),this.native=e}async signData(e,t){return this.native.signData(this.servicePtr,[e,t])}async verifySignature(e,t,i){return this.native.verifySignature(this.servicePtr,[e,t,i])}async generatePrivateKey(e){return this.native.generatePrivateKey(this.servicePtr,[e])}async derivePrivateKey(e,t){return this.native.derivePrivateKey(this.servicePtr,[e,t])}async derivePrivateKey2(e,t){return this.native.derivePrivateKey2(this.servicePtr,[e,t])}async derivePublicKey(e){return this.native.derivePublicKey(this.servicePtr,[e])}async generateKeySymmetric(){return this.native.generateKeySymmetric(this.servicePtr,[])}async encryptDataSymmetric(e,t){return this.native.encryptDataSymmetric(this.servicePtr,[e,t])}async decryptDataSymmetric(e,t){return this.native.decryptDataSymmetric(this.servicePtr,[e,t])}async convertPEMKeytoWIFKey(e){return this.native.convertPEMKeytoWIFKey(this.servicePtr,[e])}async generateBip39(e,t=""){return this.native.generateBip39(this.servicePtr,[e,t])}async fromMnemonic(e,t=""){return this.native.fromMnemonic(this.servicePtr,[e,t])}async fromEntropy(e,t=""){return this.native.fromEntropy(this.servicePtr,[e,t])}async entropyToMnemonic(e){return this.native.entropyToMnemonic(this.servicePtr,[e])}async mnemonicToEntropy(e){return this.native.mnemonicToEntropy(this.servicePtr,[e])}async mnemonicToSeed(e,t=""){return this.native.mnemonicToSeed(this.servicePtr,[e,t])}}t.CryptoApi=n},181:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EndpointFactory=void 0;const s=i(667),n=i(457),r=i(140),a=i(711),c=i(688),u=i(467),o=i(252),h=i(453),y=i(243),p=i(272),l=i(54),v=i(262),d=i(11),b=i(590),A=i(297),P=i(134),_=i(789),w=i(985),g=i(148);class E{static api;static eventQueueInstance;static async setup(e){const t=e||document.currentScript.src.split("/").slice(0,-1).join("/"),i=["driver-web-context.js","endpoint-wasm-module.js"];for(const e of i)await this.loadScript(t+"/"+e);const s=await endpointWasmModule();E.init(s)}static async loadScript(e){return new Promise((t=>{const i=document.getElementsByTagName("head")[0],s=document.createElement("script");s.type="text/javascript",s.src=e,s.onload=()=>{t()},i.appendChild(s)}))}static init(e){this.api=new s.Api(e),n.ApiStatic.init(this.api),l.FinalizationHelper.init(e)}static async getEventQueue(){if(!this.eventQueueInstance){const e=new u.EventQueueNative(this.api),t=await e.newEventQueue();this.eventQueueInstance=new A.EventQueue(e,t)}return this.eventQueueInstance}static generateDefaultPKIVerificationOptions(){return{bridgeInstanceId:void 0,bridgePubKey:void 0}}static async connect(e,t,i,s){const n=new r.ConnectionNative(this.api),a=await n.newConnection();return await n.connect(a,[e,t,i,s||this.generateDefaultPKIVerificationOptions()]),new v.Connection(n,a)}static async connectPublic(e,t,i){const s=new r.ConnectionNative(this.api),n=await s.newConnection();return await s.connectPublic(n,[e,t,i||this.generateDefaultPKIVerificationOptions()]),new v.Connection(s,n)}static async createThreadApi(e){if("threads"in e.apisRefs)throw new Error("ThreadApi already registered for given connection.");const t=new p.ThreadApiNative(this.api),i=await t.newApi(e.servicePtr);return await t.create(i,[]),e.apisRefs.threads={_apiServicePtr:i},e.nativeApisDeps.threads=t,new g.ThreadApi(t,i)}static async createStoreApi(e){if("stores"in e.apisRefs)throw new Error("StoreApi already registered for given connection.");const t=new y.StoreApiNative(this.api),i=await t.newApi(e.servicePtr);return e.apisRefs.stores={_apiServicePtr:i},e.nativeApisDeps.stores=t,await t.create(i,[]),new w.StoreApi(t,i)}static async createInboxApi(e,t,i){if("inboxes"in e.apisRefs)throw new Error("InboxApi already registered for given connection.");const s=new o.InboxApiNative(this.api),n=await s.newApi(e.servicePtr,t.servicePtr,i.servicePtr);return e.apisRefs.inboxes={_apiServicePtr:n},e.nativeApisDeps.inboxes=s,await s.create(n,[]),new P.InboxApi(s,n)}static async createKvdbApi(e){if("kvdbs"in e.apisRefs)throw new Error("KvdbApi already registered for given connection.");const t=new h.KvdbApiNative(this.api),i=await t.newApi(e.servicePtr);return await t.create(i,[]),e.apisRefs.kvdbs={_apiServicePtr:i},e.nativeApisDeps.kvdbs=t,new _.KvdbApi(t,i)}static async createCryptoApi(){const e=new a.CryptoApiNative(this.api),t=await e.newApi();return await e.create(t,[]),new d.CryptoApi(e,t)}static async createEventApi(e){if("events"in e.apisRefs)throw new Error("EventApi already registered for given connection.");const t=new c.EventApiNative(this.api),i=await t.newApi(e.servicePtr);return e.apisRefs.events={_apiServicePtr:i},e.nativeApisDeps.events=t,await t.create(i,[]),new b.EventApi(t,i)}}t.EndpointFactory=E},590:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EventApi=void 0;const s=i(647);class n extends s.BaseApi{native;constructor(e,t){super(t),this.native=e}async emitEvent(e,t,i,s){return this.native.emitEvent(this.servicePtr,[e,t,i,s])}async subscribeFor(e){return this.native.subscribeFor(this.servicePtr,[e])}async unsubscribeFrom(e){return this.native.unsubscribeFrom(this.servicePtr,[e])}async buildSubscriptionQuery(e,t,i){return this.native.buildSubscriptionQuery(this.servicePtr,[e,t,i])}}t.EventApi=n},297:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EventQueue=void 0;const s=i(647);class n extends s.BaseApi{native;isPending=!1;constructor(e,t){super(t),this.native=e}async waitEvent(){if(this.isPending)throw"WaitEvent() is already in a pending state waiting for new events";try{return await this.native.waitEvent(this.servicePtr,[])}finally{this.isPending=!1}}async emitBreakEvent(){return this.native.emitBreakEvent(this.servicePtr,[])}}t.EventQueue=n},504:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtKey=void 0;const s=i(457),n=i(614),r=i(54),a=i(647);class c extends a.BaseApi{native;ptr;static async freeExtKey(e){const t=new n.ExtKeyNative(s.ApiStatic.getInstance());await t.deleteExtKey(e)}static async fromSeed(e){const t=await n.ExtKeyNative.fromSeed([e]),i=new n.ExtKeyNative(s.ApiStatic.getInstance()),a=new c(i,t);return r.FinalizationHelper.getInstance().register(a,{ptr:t,onFree:()=>this.freeExtKey(t)}),a}static async fromBase58(e){const t=await n.ExtKeyNative.fromBase58([e]),i=new n.ExtKeyNative(s.ApiStatic.getInstance()),a=new c(i,t);return r.FinalizationHelper.getInstance().register(a,{ptr:t,onFree:()=>this.freeExtKey(t)}),a}static async generateRandom(){const e=await n.ExtKeyNative.generateRandom([]),t=new n.ExtKeyNative(s.ApiStatic.getInstance()),i=new c(t,e);return r.FinalizationHelper.getInstance().register(i,{ptr:e,onFree:()=>this.freeExtKey(e)}),i}constructor(e,t){super(t),this.native=e,this.ptr=t}static fromPtr(e){const t=new n.ExtKeyNative(s.ApiStatic.getInstance());return new c(t,e)}async derive(e){const t=await this.native.derive(this.servicePtr,[e]),i=new c(this.native,t);return r.FinalizationHelper.getInstance().register(i,{ptr:t,onFree:()=>c.freeExtKey(t)}),i}async deriveHardened(e){const t=await this.native.deriveHardened(this.servicePtr,[e]);return new c(this.native,t)}async getPrivatePartAsBase58(){return this.native.getPrivatePartAsBase58(this.servicePtr,[])}async getPublicPartAsBase58(){return this.native.getPublicPartAsBase58(this.servicePtr,[])}async getPrivateKey(){return this.native.getPrivateKey(this.servicePtr,[])}async getPublicKey(){return this.native.getPublicKey(this.servicePtr,[])}async getPrivateEncKey(){return this.native.getPrivateEncKey(this.servicePtr,[])}async getPublicKeyAsBase58Address(){return this.native.getPublicKeyAsBase58Address(this.servicePtr,[])}async getChainCode(){return this.native.getChainCode(this.servicePtr,[])}async verifyCompactSignatureWithHash(e,t){return this.native.verifyCompactSignatureWithHash(this.servicePtr,[e,t])}async isPrivate(){return this.native.isPrivate(this.servicePtr,[])}}t.ExtKey=c},134:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InboxApi=void 0;const s=i(647);class n extends s.BaseApi{native;constructor(e,t){super(t),this.native=e}async createInbox(e,t,i,s,n,r,a){return this.native.createInbox(this.servicePtr,[e,t,i,s,n,r,a])}async updateInbox(e,t,i,s,n,r,a,c,u,o){return this.native.updateInbox(this.servicePtr,[e,t,i,s,n,r,a,c,u,o])}async getInbox(e){return this.native.getInbox(this.servicePtr,[e])}async listInboxes(e,t){return this.native.listInboxes(this.servicePtr,[e,t])}async getInboxPublicView(e){return this.native.getInboxPublicView(this.servicePtr,[e])}async deleteInbox(e){return this.native.deleteInbox(this.servicePtr,[e])}async prepareEntry(e,t,i,s){return this.native.prepareEntry(this.servicePtr,[e,t,i,s])}async sendEntry(e){return this.native.sendEntry(this.servicePtr,[e])}async readEntry(e){return this.native.readEntry(this.servicePtr,[e])}async listEntries(e,t){return this.native.listEntries(this.servicePtr,[e,t])}async deleteEntry(e){return this.native.deleteEntry(this.servicePtr,[e])}async createFileHandle(e,t,i){return this.native.createFileHandle(this.servicePtr,[e,t,i])}async writeToFile(e,t,i){return this.native.writeToFile(this.servicePtr,[e,t,i])}async openFile(e){return this.native.openFile(this.servicePtr,[e])}async readFromFile(e,t){return this.native.readFromFile(this.servicePtr,[e,t])}async seekInFile(e,t){return this.native.seekInFile(this.servicePtr,[e,t])}async closeFile(e){return this.native.closeFile(this.servicePtr,[e])}async subscribeFor(e){return this.native.subscribeFor(this.servicePtr,[e])}async unsubscribeFrom(e){return this.native.unsubscribeFrom(this.servicePtr,[e])}async buildSubscriptionQuery(e,t,i){return this.native.buildSubscriptionQuery(this.servicePtr,[e,t,i])}}t.InboxApi=n},789:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.KvdbApi=void 0;const s=i(647);class n extends s.BaseApi{native;constructor(e,t){super(t),this.native=e}async createKvdb(e,t,i,s,n,r){return this.native.createKvdb(this.servicePtr,[e,t,i,s,n,r])}async updateKvdb(e,t,i,s,n,r,a,c,u){return this.native.updateKvdb(this.servicePtr,[e,t,i,s,n,r,a,c,u])}async deleteKvdb(e){return this.native.deleteKvdb(this.servicePtr,[e])}async getKvdb(e){return this.native.getKvdb(this.servicePtr,[e])}async listKvdbs(e,t){return this.native.listKvdbs(this.servicePtr,[e,t])}async getEntry(e,t){return this.native.getEntry(this.servicePtr,[e,t])}async hasEntry(e,t){return this.native.hasEntry(this.servicePtr,[e,t])}async listEntriesKeys(e,t){return this.native.listEntriesKeys(this.servicePtr,[e,t])}async listEntries(e,t){return this.native.listEntries(this.servicePtr,[e,t])}async setEntry(e,t,i,s,n,r){return this.native.setEntry(this.servicePtr,[e,t,i,s,n,r||0])}async deleteEntry(e,t){return this.native.deleteEntry(this.servicePtr,[e,t])}async deleteEntries(e,t){return this.native.deleteEntries(this.servicePtr,[e,t])}async subscribeFor(e){return this.native.subscribeFor(this.servicePtr,[e])}async unsubscribeFrom(e){return this.native.unsubscribeFrom(this.servicePtr,[e])}async buildSubscriptionQuery(e,t,i){return this.native.buildSubscriptionQuery(this.servicePtr,[e,t,i])}async buildSubscriptionQueryForSelectedEntry(e,t,i){return this.native.buildSubscriptionQueryForSelectedEntry(this.servicePtr,[e,t,i])}}t.KvdbApi=n},985:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StoreApi=void 0;const s=i(647);class n extends s.BaseApi{native;constructor(e,t){super(t),this.native=e}async createStore(e,t,i,s,n,r){return this.native.createStore(this.servicePtr,[e,t,i,s,n,r])}async updateStore(e,t,i,s,n,r,a,c,u){return this.native.updateStore(this.servicePtr,[e,t,i,s,n,r,a,c,u])}async deleteStore(e){return this.native.deleteStore(this.servicePtr,[e])}async getStore(e){return this.native.getStore(this.servicePtr,[e])}async listStores(e,t){return this.native.listStores(this.servicePtr,[e,t])}async createFile(e,t,i,s,n=!1){return this.native.createFile(this.servicePtr,[e,t,i,s,n])}async updateFile(e,t,i,s){return this.native.updateFile(this.servicePtr,[e,t,i,s])}async updateFileMeta(e,t,i){return this.native.updateFileMeta(this.servicePtr,[e,t,i])}async writeToFile(e,t,i=!1){return this.native.writeToFile(this.servicePtr,[e,t,i])}async deleteFile(e){return this.native.deleteFile(this.servicePtr,[e])}async getFile(e){return this.native.getFile(this.servicePtr,[e])}async listFiles(e,t){return this.native.listFiles(this.servicePtr,[e,t])}async openFile(e){return this.native.openFile(this.servicePtr,[e])}async readFromFile(e,t){return this.native.readFromFile(this.servicePtr,[e,t])}async seekInFile(e,t){return this.native.seekInFile(this.servicePtr,[e,t])}async closeFile(e){return this.native.closeFile(this.servicePtr,[e])}async syncFile(e){return this.native.syncFile(this.servicePtr,[e])}async subscribeFor(e){return this.native.subscribeFor(this.servicePtr,[e])}async unsubscribeFrom(e){return this.native.unsubscribeFrom(this.servicePtr,[e])}async buildSubscriptionQuery(e,t,i){return this.native.buildSubscriptionQuery(this.servicePtr,[e,t,i])}}t.StoreApi=n},148:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ThreadApi=void 0;const s=i(647);class n extends s.BaseApi{native;constructor(e,t){super(t),this.native=e}async createThread(e,t,i,s,n,r){return this.native.createThread(this.servicePtr,[e,t,i,s,n,r])}async updateThread(e,t,i,s,n,r,a,c,u){return this.native.updateThread(this.servicePtr,[e,t,i,s,n,r,a,c,u])}async deleteThread(e){return this.native.deleteThread(this.servicePtr,[e])}async getThread(e){return this.native.getThread(this.servicePtr,[e])}async listThreads(e,t){return this.native.listThreads(this.servicePtr,[e,t])}async getMessage(e){return this.native.getMessage(this.servicePtr,[e])}async listMessages(e,t){return this.native.listMessages(this.servicePtr,[e,t])}async sendMessage(e,t,i,s){return this.native.sendMessage(this.servicePtr,[e,t,i,s])}async deleteMessage(e){return this.native.deleteMessage(this.servicePtr,[e])}async updateMessage(e,t,i,s){return this.native.updateMessage(this.servicePtr,[e,t,i,s])}async subscribeFor(e){return this.native.subscribeFor(this.servicePtr,[e])}async unsubscribeFrom(e){return this.native.unsubscribeFrom(this.servicePtr,[e])}async buildSubscriptionQuery(e,t,i){return this.native.buildSubscriptionQuery(this.servicePtr,[e,t,i])}}t.ThreadApi=n}},t={};function i(s){var n=t[s];if(void 0!==n)return n.exports;var r=t[s]={exports:{}};return e[s](r,r.exports,i),r.exports}var s={};return(()=>{var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.Endpoint=void 0;const t=i(181);Object.defineProperty(e,"Endpoint",{enumerable:!0,get:function(){return t.EndpointFactory}})})(),s})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplito/privmx-webendpoint",
3
- "version": "2.6.0",
3
+ "version": "2.6.2",
4
4
  "description": "PrivMX Web Endpoint library",
5
5
  "author": "Simplito",
6
6
  "license": "PrivMX Free License",
@@ -18,11 +18,11 @@ export declare class EventApi extends BaseApi {
18
18
  * Emits the custom event on the given Context and channel.
19
19
  *
20
20
  * @param {string} contextId ID of the Context
21
+ * @param {UserWithPubKey[]} users list of UserWithPubKey objects which defines the recipients of the event
21
22
  * @param {string} channelName name of the Channel
22
23
  * @param {Uint8Array} eventData event's data
23
- * @param {UserWithPubKey[]} users list of UserWithPubKey objects which defines the recipients of the event
24
24
  */
25
- emitEvent(contextId: string, channelName: string, eventData: Uint8Array, users: UserWithPubKey[]): Promise<void>;
25
+ emitEvent(contextId: string, users: UserWithPubKey[], channelName: string, eventData: Uint8Array): Promise<void>;
26
26
  /**
27
27
  * Subscribe for the custom events on the given subscription query.
28
28
  *
@@ -31,12 +31,12 @@ class EventApi extends BaseApi_1.BaseApi {
31
31
  * Emits the custom event on the given Context and channel.
32
32
  *
33
33
  * @param {string} contextId ID of the Context
34
+ * @param {UserWithPubKey[]} users list of UserWithPubKey objects which defines the recipients of the event
34
35
  * @param {string} channelName name of the Channel
35
36
  * @param {Uint8Array} eventData event's data
36
- * @param {UserWithPubKey[]} users list of UserWithPubKey objects which defines the recipients of the event
37
37
  */
38
- async emitEvent(contextId, channelName, eventData, users) {
39
- return this.native.emitEvent(this.servicePtr, [contextId, channelName, eventData, users]);
38
+ async emitEvent(contextId, users, channelName, eventData) {
39
+ return this.native.emitEvent(this.servicePtr, [contextId, users, channelName, eventData]);
40
40
  }
41
41
  // /**
42
42
  // * Subscribe for the custom events on the given channel.
@@ -151,6 +151,12 @@ export declare class StoreApi extends BaseApi {
151
151
  * @returns {string} ID of closed file
152
152
  */
153
153
  closeFile(fileHandle: number): Promise<string>;
154
+ /**
155
+ * Synchronize file handle data with newest data on server
156
+ *
157
+ * @param {number} fileHandle handle to read/write file data
158
+ */
159
+ syncFile(fileHandle: number): Promise<void>;
154
160
  /**
155
161
  * Subscribe for the Store events on the given subscription query.
156
162
  *
@@ -219,6 +219,14 @@ class StoreApi extends BaseApi_1.BaseApi {
219
219
  async closeFile(fileHandle) {
220
220
  return this.native.closeFile(this.servicePtr, [fileHandle]);
221
221
  }
222
+ /**
223
+ * Synchronize file handle data with newest data on server
224
+ *
225
+ * @param {number} fileHandle handle to read/write file data
226
+ */
227
+ async syncFile(fileHandle) {
228
+ return this.native.syncFile(this.servicePtr, [fileHandle]);
229
+ }
222
230
  // /**
223
231
  // * Subscribes for the Store module main events.
224
232
  // */
@@ -1 +0,0 @@
1
- (()=>{"use strict";var e={320:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isDecryptionSuccess=t.isEncryptionSuccess=t.decryptWithAES256GCM=t.encryptWithAES256GCM=void 0,t.encryptWithAES256GCM=async function(e,t,r,n){try{const s=await crypto.subtle.importKey("raw",e,{name:"AES-GCM"},!1,["encrypt"]),a=await crypto.subtle.encrypt({name:"AES-GCM",iv:t,additionalData:n,tagLength:128},s,r);return{success:!0,data:new Uint8Array(a)}}catch(e){return{success:!1,error:"EncryptionFailed"}}},t.decryptWithAES256GCM=async function(e,t,r,n){try{const s=await crypto.subtle.importKey("raw",e,{name:"AES-GCM"},!1,["decrypt"]),a=await crypto.subtle.decrypt({name:"AES-GCM",iv:t,additionalData:n,tagLength:128},s,r);return{success:!0,data:new Uint8Array(a)}}catch(e){return{success:!1,error:"DecryptionFailed"}}},t.isEncryptionSuccess=function(e){return e.success},t.isDecryptionSuccess=function(e){return e.success}},928:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.KeyStore=void 0,t.KeyStore=class{_keys=new Map;_encryptionKeyId=void 0;setKeys(e){this._keys.clear();for(const t of e)this._keys.set(t.keyId,t),0===t.type&&(this._encryptionKeyId=t.keyId)}getKey(e){return this._keys.get(e)}hasKey(e){return this._keys.has(e)}getEncriptionKey(){if(!this._encryptionKeyId)throw console.error("No encryption key set."),console.log("DEBUG-info: ",this._keys),console.trace("Location"),new Error("No encryption key set.");return this._keys.get(this._encryptionKeyId)}}},251:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utils=void 0;class r{static generateNumericId(){return Math.round(1e15*Math.random())}static getRandomString(e){return[...Array(e)].map((()=>Math.floor(16*Math.random()).toString(16))).join("")}static async encryptSymmetric(e,t,r){let n;n="string"==typeof e?(new TextEncoder).encode(e):e;const s=await crypto.subtle.importKey("raw",Buffer.from(t,"base64"),{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),a=await crypto.subtle.encrypt({name:"AES-GCM",iv:Buffer.from(r,"base64")},s,n);return{ciphertext:Buffer.from(a),iv:r}}static async decryptSymmetricBuffer(e,t,r){const n=await crypto.subtle.importKey("raw",r,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),s=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},n,e);return Buffer.from(s)}static async decryptSymmetric(e,t,r){const n=await crypto.subtle.importKey("raw",Buffer.from(r,"base64"),{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),s=await crypto.subtle.decrypt({name:"AES-GCM",iv:Buffer.from(t,"base64")},n,Buffer.from(e,"base64"));return(new TextDecoder).decode(s)}static genKey(){return Buffer.from(crypto.getRandomValues(new Uint8Array(32))).toString("base64")}static genIv(){return Buffer.from(crypto.getRandomValues(new Uint8Array(12))).toString("base64")}static genIvAsBuffer(){return crypto.getRandomValues(new Uint8Array(12))}static base64abc=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"];static base64codes=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];static bytesToBase64(e){let t,n="",s=e.length;for(t=2;t<s;t+=3)n+=r.base64abc[e[t-2]>>2],n+=r.base64abc[(3&e[t-2])<<4|e[t-1]>>4],n+=r.base64abc[(15&e[t-1])<<2|e[t]>>6],n+=r.base64abc[63&e[t]];return t===s+1&&(n+=r.base64abc[e[t-2]>>2],n+=r.base64abc[(3&e[t-2])<<4],n+="=="),t===s&&(n+=r.base64abc[e[t-2]>>2],n+=r.base64abc[(3&e[t-2])<<4|e[t-1]>>4],n+=r.base64abc[(15&e[t-1])<<2],n+="="),n}static isBitOn(e,t){return Boolean(e&1<<t)}static getBits(e,t,r){const n=Math.pow(2,r)-1,s=t/8,a=t%=8;return e[s]>>a&n}static numAsOneByteUint(e){if(e>255)throw new Error("Out of bounds value");const t=new Uint8Array(1);return t[0]=e,t}static oneByteUint8AsNum(e){if(e[0]>255)throw new Error("Out of bounds value");return e[0]}}t.Utils=r}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}(()=>{const e=r(251),t=r(320),n=r(928);class s{keyStore;constructor(e){this.keyStore=e}getHeaderSizeByType(e){return"key"===e?10:"delta"===e?3:"undefined"===e?1:0}async encryptFrame(r,n,s){const a="video"===n?this.getHeaderSizeByType(r.type):1,o=new Uint8Array(r.data,0,a),i=new Uint8Array(r.data,a),c=e.Utils.genIvAsBuffer(),y=this.keyStore.getEncriptionKey(),u=await(0,t.encryptWithAES256GCM)(y.key,c,i,o);if(!(0,t.isEncryptionSuccess)(u))throw new Error("Cannot encrypt frame");const d=(new TextEncoder).encode(y.keyId),p=o.byteLength,f=p+u.data.byteLength,l=f+c.byteLength,m=l+1,h=m+d.byteLength,b=new ArrayBuffer(h+1),g=new Uint8Array(b);g.set(o),g.set(u.data,p),g.set(c,f),g.set(e.Utils.numAsOneByteUint(c.byteLength),l),g.set(d,m),JSON.stringify(d),g.set(e.Utils.numAsOneByteUint(d.byteLength),h),r.data=b,s.enqueue(r)}async decryptFrame(r,n,s){const a="video"===n?this.getHeaderSizeByType(r.type):1,o=r.data,c=new Uint8Array(o,0,a),y=new Uint8Array(o,o.byteLength-1,1),u=e.Utils.oneByteUint8AsNum(y),d=new Uint8Array(o,o.byteLength-2-u,1),p=e.Utils.oneByteUint8AsNum(d),f=a+u+p+2,l=o.byteLength-f,m=o.slice(a,a+l),h=a+l+p+1,b=o.slice(h,h+u),g=(new TextDecoder).decode(b);try{if(!this.keyStore.hasKey(g))return i({msg:"Decryption failed. Cannot find key",keyId:g,store:this.keyStore}),void s.enqueue(r);const e=this.keyStore.getKey(g),n=new Uint8Array(o.slice(a+l,a+l+p)),y=await(0,t.decryptWithAES256GCM)(e.key,n,m,c);if(!(0,t.isDecryptionSuccess)(y))return i({msg:"Decryption failed. Cannot decrypt frame"}),void s.enqueue(r);const u=y.data,d=new ArrayBuffer(c.byteLength+u.byteLength),f=new Uint8Array(d);f.set(c),f.set(new Uint8Array(u),c.byteLength),r.data=d,s.enqueue(r)}catch(e){i(e),s.enqueue(r)}}}self.keyStore=new n.KeyStore;const a=()=>self.keyStore;function o(e,t,r,n,a){let o;JSON.stringify({operation:t,context:e}),"encode"==t?(o=function(e,t){const r=new s(e);return new TransformStream({start(){},async transform(e,n){r.encryptFrame(e,t,n)},flush(){}})}(e.keyStore,r),n.pipeThrough(o).pipeTo(a)):"decode"==t?(o=function(e,t){const r=new s(e);return new TransformStream({start(){},flush(){},async transform(e,n){r.decryptFrame(e,t,n)}})}(e.keyStore,r),n.pipeThrough(o).pipeTo(a)):i(`Invalid operation: ${t}`)}function i(e){postMessage({type:"error",data:e})}self.onmessage=e=>{i("message: "+JSON.stringify(e));const{operation:t,kind:r}=e.data;if("encode"===t||"decode"===t){const n={keyStore:a()},{readableStream:s,writableStream:i,participantId:c}=e.data;o(n,t,r,s,i)}else if("setKeys"===t){const t=e.data;a().setKeys(t.keys)}},self.RTCTransformEvent&&(self.onrtctransform=e=>{const t=e.transformer,{operation:r,kind:n}=t.options;JSON.stringify(e),o({keyStore:a()},r,n,t.readable,t.writable)})})()})();
@@ -1,2 +0,0 @@
1
- /*! For license information please see privmx-endpoint-web.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["privmx-webendpoint"]=t():e.PrivmxWebEndpoint=t()}(self,(()=>(()=>{"use strict";var e={667:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Api=void 0;const s=i(785);t.Api=class{lib;promises;taskIdGenerator;constructor(e){this.lib=e,this.taskIdGenerator=new s.IdGenerator,this.promises=new Map,this.setResultsCallback()}async runAsync(e){return new Promise(((t,i)=>{const s=this.generateId();this.promises.set(s,{resolve:t,reject:i}),e(s)}))}resolveResult(e){1==e.status?this.promises.get(e.taskId).resolve(e.result):this.promises.get(e.taskId).reject(e.error),this.promises.delete(e.taskId)}generateId(){return this.taskIdGenerator.generateId()}setResultsCallback(){this.lib.setResultsCallback((e=>this.resolveResult(e)))}}},361:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseNative=void 0,t.BaseNative=class{_api;constructor(e){this._api=e}get api(){if(!this._api)throw new Error("This API instance is no longer valid because the connection associated with it has been closed.");return this._api}deleteApiRef(){this._api=null}async runAsync(e){if(!this.api)throw new Error("This API instance is no longer valid because the connection associated with it has been closed.");return this.api.runAsync(e)}}},140:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionNative=void 0;const s=i(361);class n extends s.BaseNative{lastConnectionId=-1;async newApi(e){throw new Error("Use the newConnection() - specialized version of method instead.")}async deleteApi(e){await this.runAsync((t=>this.api.lib.Connection_deleteConnection(t,e))),this.deleteApiRef()}async newConnection(){return this.runAsync((e=>this.api.lib.Connection_newConnection(e)))}async deleteConnection(e){await this.runAsync((t=>this.api.lib.Connection_deleteConnection(t,e))),this.deleteApiRef()}async connect(e,t){await this.runAsync((i=>this.api.lib.Connection_connect(i,e,t))),await this.getConnectionId(e,[])}async connectPublic(e,t){return this.runAsync((i=>this.api.lib.Connection_connectPublic(i,e,t)))}async getConnectionId(e,t){return this.lastConnectionId<0&&(this.lastConnectionId=await this.runAsync((i=>this.api.lib.Connection_getConnectionId(i,e,t)))),this.lastConnectionId}async listContexts(e,t){return this.runAsync((i=>this.api.lib.Connection_listContexts(i,e,t)))}async disconnect(e,t){await this.runAsync((i=>this.api.lib.Connection_disconnect(i,e,t)))}}t.ConnectionNative=n},711:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CryptoApiNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(){return this.runAsync((e=>this.api.lib.CryptoApi_newCryptoApi(e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.CryptoApi_deleteCryptoApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_create(i,e,t)))}async signData(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_signData(i,e,t)))}async generatePrivateKey(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_generatePrivateKey(i,e,t)))}async derivePrivateKey(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_derivePrivateKey(i,e,t)))}async derivePrivateKey2(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_derivePrivateKey2(i,e,t)))}async derivePublicKey(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_derivePublicKey(i,e,t)))}async generateKeySymmetric(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_generateKeySymmetric(i,e,t)))}async encryptDataSymmetric(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_encryptDataSymmetric(i,e,t)))}async decryptDataSymmetric(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_decryptDataSymmetric(i,e,t)))}async convertPEMKeytoWIFKey(e,t){return this.runAsync((i=>this.api.lib.CryptoApi_convertPEMKeytoWIFKey(i,e,t)))}}t.CryptoApiNative=n},467:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EventQueueNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(e){throw new Error("Use the newEventQueue() - specialized version of method instead.")}async deleteApi(e){await this.runAsync((t=>this.api.lib.EventQueue_deleteEventQueue(t,e))),this.deleteApiRef()}async newEventQueue(){return this.runAsync((e=>this.api.lib.EventQueue_newEventQueue(e)))}async deleteEventQueue(e){await this.runAsync((t=>this.api.lib.EventQueue_deleteEventQueue(t,e))),this.deleteApiRef()}async waitEvent(e,t){return this.runAsync((i=>this.api.lib.EventQueue_waitEvent(i,e,t)))}async emitBreakEvent(e,t){return this.runAsync((i=>this.api.lib.EventQueue_emitBreakEvent(i,e,t)))}}t.EventQueueNative=n},785:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IdGenerator=void 0,t.IdGenerator=class{_id=0;generateId(){return this._id++,this._id}}},252:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InboxApiNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(e,t,i){return this.runAsync((s=>this.api.lib.InboxApi_newInboxApi(s,e,t,i)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.InboxApi_deleteInboxApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((i=>this.api.lib.InboxApi_create(i,e,t)))}async createInbox(e,t){return this.runAsync((i=>this.api.lib.InboxApi_createInbox(i,e,t)))}async updateInbox(e,t){return this.runAsync((i=>this.api.lib.InboxApi_updateInbox(i,e,t)))}async getInbox(e,t){return this.runAsync((i=>this.api.lib.InboxApi_getInbox(i,e,t)))}async listInboxes(e,t){return this.runAsync((i=>this.api.lib.InboxApi_listInboxes(i,e,t)))}async getInboxPublicView(e,t){return this.runAsync((i=>this.api.lib.InboxApi_getInboxPublicView(i,e,t)))}async deleteInbox(e,t){return this.runAsync((i=>this.api.lib.InboxApi_deleteInbox(i,e,t)))}async prepareEntry(e,t){return this.runAsync((i=>this.api.lib.InboxApi_prepareEntry(i,e,t)))}async sendEntry(e,t){return this.runAsync((i=>this.api.lib.InboxApi_sendEntry(i,e,t)))}async readEntry(e,t){return this.runAsync((i=>this.api.lib.InboxApi_readEntry(i,e,t)))}async deleteEntry(e,t){return this.runAsync((i=>this.api.lib.InboxApi_deleteEntry(i,e,t)))}async listEntries(e,t){return this.runAsync((i=>this.api.lib.InboxApi_listEntries(i,e,t)))}async createFileHandle(e,t){return this.runAsync((i=>this.api.lib.InboxApi_createFileHandle(i,e,t)))}async writeToFile(e,t){return this.runAsync((i=>this.api.lib.InboxApi_writeToFile(i,e,t)))}async openFile(e,t){return this.runAsync((i=>this.api.lib.InboxApi_openFile(i,e,t)))}async readFromFile(e,t){return this.runAsync((i=>this.api.lib.InboxApi_readFromFile(i,e,t)))}async seekInFile(e,t){return this.runAsync((i=>this.api.lib.InboxApi_seekInFile(i,e,t)))}async closeFile(e,t){return this.runAsync((i=>this.api.lib.InboxApi_closeFile(i,e,t)))}async subscribeForInboxEvents(e,t){return this.runAsync((i=>this.api.lib.InboxApi_subscribeForInboxEvents(i,e,t)))}async unsubscribeFromInboxEvents(e,t){return this.runAsync((i=>this.api.lib.InboxApi_unsubscribeFromInboxEvents(i,e,t)))}async subscribeForEntryEvents(e,t){return this.runAsync((i=>this.api.lib.InboxApi_subscribeForEntryEvents(i,e,t)))}async unsubscribeFromEntryEvents(e,t){return this.runAsync((i=>this.api.lib.InboxApi_unsubscribeFromEntryEvents(i,e,t)))}}t.InboxApiNative=n},243:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StoreApiNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(e){return this.runAsync((t=>this.api.lib.StoreApi_newStoreApi(t,e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.StoreApi_deleteStoreApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((i=>this.api.lib.StoreApi_create(i,e,t)))}async createStore(e,t){return this.runAsync((i=>this.api.lib.StoreApi_createStore(i,e,t)))}async updateStore(e,t){return this.runAsync((i=>this.api.lib.StoreApi_updateStore(i,e,t)))}async deleteStore(e,t){return this.runAsync((i=>this.api.lib.StoreApi_deleteStore(i,e,t)))}async getStore(e,t){return this.runAsync((i=>this.api.lib.StoreApi_getStore(i,e,t)))}async listStores(e,t){return this.runAsync((i=>this.api.lib.StoreApi_listStores(i,e,t)))}async createFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_createFile(i,e,t)))}async updateFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_updateFile(i,e,t)))}async updateFileMeta(e,t){return this.runAsync((i=>this.api.lib.StoreApi_updateFileMeta(i,e,t)))}async writeToFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_writeToFile(i,e,t)))}async deleteFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_deleteFile(i,e,t)))}async getFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_getFile(i,e,t)))}async listFiles(e,t){return this.runAsync((i=>this.api.lib.StoreApi_listFiles(i,e,t)))}async openFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_openFile(i,e,t)))}async readFromFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_readFromFile(i,e,t)))}async seekInFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_seekInFile(i,e,t)))}async closeFile(e,t){return this.runAsync((i=>this.api.lib.StoreApi_closeFile(i,e,t)))}async subscribeForStoreEvents(e,t){return this.runAsync((i=>this.api.lib.StoreApi_subscribeForStoreEvents(i,e,t)))}async unsubscribeFromStoreEvents(e,t){return this.runAsync((i=>this.api.lib.StoreApi_unsubscribeFromStoreEvents(i,e,t)))}async subscribeForFileEvents(e,t){return this.runAsync((i=>this.api.lib.StoreApi_subscribeForFileEvents(i,e,t)))}async unsubscribeFromFileEvents(e,t){return this.runAsync((i=>this.api.lib.StoreApi_unsubscribeFromFileEvents(i,e,t)))}}t.StoreApiNative=n},272:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ThreadApiNative=void 0;const s=i(361);class n extends s.BaseNative{async newApi(e){return this.runAsync((t=>this.api.lib.ThreadApi_newThreadApi(t,e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.ThreadApi_deleteThreadApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_create(i,e,t)))}async createThread(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_createThread(i,e,t)))}async updateThread(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_updateThread(i,e,t)))}async deleteThread(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_deleteThread(i,e,t)))}async getThread(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_getThread(i,e,t)))}async listThreads(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_listThreads(i,e,t)))}async getMessage(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_getMessage(i,e,t)))}async listMessages(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_listMessages(i,e,t)))}async sendMessage(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_sendMessage(i,e,t)))}async deleteMessage(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_deleteMessage(i,e,t)))}async updateMessage(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_updateMessage(i,e,t)))}async subscribeForThreadEvents(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_subscribeForThreadEvents(i,e,t)))}async unsubscribeFromThreadEvents(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_unsubscribeFromThreadEvents(i,e,t)))}async subscribeForMessageEvents(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_subscribeForMessageEvents(i,e,t)))}async unsubscribeFromMessageEvents(e,t){return this.runAsync((i=>this.api.lib.ThreadApi_unsubscribeFromMessageEvents(i,e,t)))}}t.ThreadApiNative=n},647:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseApi=void 0,t.BaseApi=class{_servicePtr;constructor(e){this._servicePtr=e}get servicePtr(){if(this._servicePtr<0)throw new Error("This API instance is no longer valid because the connection associated with it has been closed.");return this._servicePtr}destroyRefs(){this._servicePtr=-1}}},262:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Connection=void 0;const s=i(647);class n extends s.BaseApi{native;apisRefs={};nativeApisDeps={};constructor(e,t){super(t),this.native=e}async getConnectionId(){return this.native.getConnectionId(this.servicePtr,[])}async listContexts(e){return this.native.listContexts(this.servicePtr,[e])}async disconnect(){await this.native.disconnect(this.servicePtr,[]),await this.freeApis(),await this.native.deleteConnection(this.servicePtr)}async freeApis(){for(const e in this.apisRefs)this.nativeApisDeps[e]&&await this.nativeApisDeps[e].deleteApi(this.apisRefs[e]._apiServicePtr)}}t.Connection=n},11:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CryptoApi=void 0;const s=i(647);class n extends s.BaseApi{native;constructor(e,t){super(t),this.native=e}async signData(e,t){return this.native.signData(this.servicePtr,[e,t])}async generatePrivateKey(e){return this.native.generatePrivateKey(this.servicePtr,[e])}async derivePrivateKey(e,t){return this.native.derivePrivateKey(this.servicePtr,[e,t])}async derivePrivateKey2(e,t){return this.native.derivePrivateKey2(this.servicePtr,[e,t])}async derivePublicKey(e){return this.native.derivePublicKey(this.servicePtr,[e])}async generateKeySymmetric(){return this.native.generateKeySymmetric(this.servicePtr,[])}async encryptDataSymmetric(e,t){return this.native.encryptDataSymmetric(this.servicePtr,[e,t])}async decryptDataSymmetric(e,t){return this.native.decryptDataSymmetric(this.servicePtr,[e,t])}async convertPEMKeytoWIFKey(e){return this.native.convertPEMKeytoWIFKey(this.servicePtr,[e])}}t.CryptoApi=n},181:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EndpointFactory=void 0;const s=i(667),n=i(140),r=i(711),a=i(467),c=i(252),o=i(243),u=i(272),h=i(262),p=i(11),y=i(297),l=i(134),v=i(985),d=i(148);class b{static api;static eventQueueInstance;static async setup(e){const t=e||document.currentScript.src.split("/").slice(0,-1).join("/"),i=["driver-web-context.js","endpoint-wasm-module.js"];for(const e of i)await this.loadScript(t+"/"+e);const s=await endpointWasmModule();b.init(s)}static async loadScript(e){return new Promise((t=>{const i=document.getElementsByTagName("head")[0],s=document.createElement("script");s.type="text/javascript",s.src=e,s.onload=()=>{t()},i.appendChild(s)}))}static init(e){this.api=new s.Api(e)}static async getEventQueue(){if(!this.eventQueueInstance){const e=new a.EventQueueNative(this.api),t=await e.newEventQueue();this.eventQueueInstance=new y.EventQueue(e,t)}return this.eventQueueInstance}static async connect(e,t,i){const s=new n.ConnectionNative(this.api),r=await s.newConnection();return await s.connect(r,[e,t,i]),new h.Connection(s,r)}static async connectPublic(e,t){const i=new n.ConnectionNative(this.api),s=await i.newConnection();return await i.connectPublic(s,[e,t]),new h.Connection(i,s)}static async createThreadApi(e){if("threads"in e.apisRefs)throw new Error("ThreadApi already registered for given connection.");const t=new u.ThreadApiNative(this.api),i=await t.newApi(e.servicePtr);return await t.create(i,[]),e.apisRefs.threads={_apiServicePtr:i},e.nativeApisDeps.threads=t,new d.ThreadApi(t,i)}static async createStoreApi(e){if("stores"in e.apisRefs)throw new Error("StoreApi already registered for given connection.");const t=new o.StoreApiNative(this.api),i=await t.newApi(e.servicePtr);return e.apisRefs.stores={_apiServicePtr:i},e.nativeApisDeps.stores=t,await t.create(i,[]),new v.StoreApi(t,i)}static async createInboxApi(e,t,i){if("inboxes"in e.apisRefs)throw new Error("InboxApi already registered for given connection.");const s=new c.InboxApiNative(this.api),n=await s.newApi(e.servicePtr,t.servicePtr,i.servicePtr);return e.apisRefs.inboxes={_apiServicePtr:n},e.nativeApisDeps.inboxes=s,await s.create(n,[]),new l.InboxApi(s,n)}static async createCryptoApi(){const e=new r.CryptoApiNative(this.api),t=await e.newApi();return await e.create(t,[]),new p.CryptoApi(e,t)}}t.EndpointFactory=b},297:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EventQueue=void 0;const s=i(647);class n extends s.BaseApi{native;isPending=!1;constructor(e,t){super(t),this.native=e}async waitEvent(){if(this.isPending)throw"WaitEvent() is already in a pending state waiting for new events";try{return await this.native.waitEvent(this.servicePtr,[])}finally{this.isPending=!1}}async emitBreakEvent(){return this.native.emitBreakEvent(this.servicePtr,[])}}t.EventQueue=n},134:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InboxApi=void 0;const s=i(647);class n extends s.BaseApi{native;constructor(e,t){super(t),this.native=e}async createInbox(e,t,i,s,n,r,a){return this.native.createInbox(this.servicePtr,[e,t,i,s,n,r,a])}async updateInbox(e,t,i,s,n,r,a,c,o,u){return this.native.updateInbox(this.servicePtr,[e,t,i,s,n,r,a,c,o,u])}async getInbox(e){return this.native.getInbox(this.servicePtr,[e])}async listInboxes(e,t){return this.native.listInboxes(this.servicePtr,[e,t])}async getInboxPublicView(e){return this.native.getInboxPublicView(this.servicePtr,[e])}async deleteInbox(e){return this.native.deleteInbox(this.servicePtr,[e])}async prepareEntry(e,t,i,s){return this.native.prepareEntry(this.servicePtr,[e,t,i,s])}async sendEntry(e){return this.native.sendEntry(this.servicePtr,[e])}async readEntry(e){return this.native.readEntry(this.servicePtr,[e])}async listEntries(e,t){return this.native.listEntries(this.servicePtr,[e,t])}async deleteEntry(e){return this.native.deleteEntry(this.servicePtr,[e])}async createFileHandle(e,t,i){return this.native.createFileHandle(this.servicePtr,[e,t,i])}async writeToFile(e,t,i){return this.native.writeToFile(this.servicePtr,[e,t,i])}async openFile(e){return this.native.openFile(this.servicePtr,[e])}async readFromFile(e,t){return this.native.readFromFile(this.servicePtr,[e,t])}async seekInFile(e,t){return this.native.seekInFile(this.servicePtr,[e,t])}async closeFile(e){return this.native.closeFile(this.servicePtr,[e])}async subscribeForInboxEvents(){return this.native.subscribeForInboxEvents(this.servicePtr,[])}async unsubscribeFromInboxEvents(){return this.native.unsubscribeFromInboxEvents(this.servicePtr,[])}async subscribeForEntryEvents(e){return this.native.subscribeForEntryEvents(this.servicePtr,[e])}async unsubscribeFromEntryEvents(e){return this.native.unsubscribeFromEntryEvents(this.servicePtr,[e])}}t.InboxApi=n},985:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StoreApi=void 0;const s=i(647);class n extends s.BaseApi{native;constructor(e,t){super(t),this.native=e}async createStore(e,t,i,s,n,r){return this.native.createStore(this.servicePtr,[e,t,i,s,n,r])}async updateStore(e,t,i,s,n,r,a,c,o){return this.native.updateStore(this.servicePtr,[e,t,i,s,n,r,a,c,o])}async deleteStore(e){return this.native.deleteStore(this.servicePtr,[e])}async getStore(e){return this.native.getStore(this.servicePtr,[e])}async listStores(e,t){return this.native.listStores(this.servicePtr,[e,t])}async createFile(e,t,i,s){return this.native.createFile(this.servicePtr,[e,t,i,s])}async updateFile(e,t,i,s){return this.native.updateFile(this.servicePtr,[e,t,i,s])}async updateFileMeta(e,t,i){return this.native.updateFileMeta(this.servicePtr,[e,t,i])}async writeToFile(e,t){return this.native.writeToFile(this.servicePtr,[e,t])}async deleteFile(e){return this.native.deleteFile(this.servicePtr,[e])}async getFile(e){return this.native.getFile(this.servicePtr,[e])}async listFiles(e,t){return this.native.listFiles(this.servicePtr,[e,t])}async openFile(e){return this.native.openFile(this.servicePtr,[e])}async readFromFile(e,t){return this.native.readFromFile(this.servicePtr,[e,t])}async seekInFile(e,t){return this.native.seekInFile(this.servicePtr,[e,t])}async closeFile(e){return this.native.closeFile(this.servicePtr,[e])}async subscribeForStoreEvents(){return this.native.subscribeForStoreEvents(this.servicePtr,[])}async unsubscribeFromStoreEvents(){return this.native.unsubscribeFromStoreEvents(this.servicePtr,[])}async subscribeForFileEvents(e){return this.native.subscribeForFileEvents(this.servicePtr,[e])}async unsubscribeFromFileEvents(e){return this.native.unsubscribeFromFileEvents(this.servicePtr,[e])}}t.StoreApi=n},148:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ThreadApi=void 0;const s=i(647);class n extends s.BaseApi{native;constructor(e,t){super(t),this.native=e}async createThread(e,t,i,s,n,r){return this.native.createThread(this.servicePtr,[e,t,i,s,n,r])}async updateThread(e,t,i,s,n,r,a,c,o){return this.native.updateThread(this.servicePtr,[e,t,i,s,n,r,a,c,o])}async deleteThread(e){return this.native.deleteThread(this.servicePtr,[e])}async getThread(e){return this.native.getThread(this.servicePtr,[e])}async listThreads(e,t){return this.native.listThreads(this.servicePtr,[e,t])}async getMessage(e){return this.native.getMessage(this.servicePtr,[e])}async listMessages(e,t){return this.native.listMessages(this.servicePtr,[e,t])}async sendMessage(e,t,i,s){return this.native.sendMessage(this.servicePtr,[e,t,i,s])}async deleteMessage(e){return this.native.deleteMessage(this.servicePtr,[e])}async updateMessage(e,t,i,s){return this.native.updateMessage(this.servicePtr,[e,t,i,s])}async subscribeForThreadEvents(){return this.native.subscribeForThreadEvents(this.servicePtr,[])}async unsubscribeFromThreadEvents(){return this.native.unsubscribeFromThreadEvents(this.servicePtr,[])}async subscribeForMessageEvents(e){return this.native.subscribeForMessageEvents(this.servicePtr,[e])}async unsubscribeFromMessageEvents(e){return this.native.unsubscribeFromMessageEvents(this.servicePtr,[e])}}t.ThreadApi=n}},t={};function i(s){var n=t[s];if(void 0!==n)return n.exports;var r=t[s]={exports:{}};return e[s](r,r.exports,i),r.exports}var s={};return(()=>{var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.Endpoint=void 0;const t=i(181);Object.defineProperty(e,"Endpoint",{enumerable:!0,get:function(){return t.EndpointFactory}})})(),s})()));