@simplito/privmx-webendpoint 2.3.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Types.d.ts +101 -0
- package/Types.js +4 -0
- package/api/ConnectionNative.d.ts +3 -3
- package/api/KvdbApiNative.d.ts +33 -0
- package/api/KvdbApiNative.js +75 -0
- package/assets/driver-web-context.js +1 -1
- package/assets/endpoint-wasm-module.js +1 -1
- package/assets/endpoint-wasm-module.wasm +0 -0
- package/bundle/privmx-endpoint-web.js +1 -1
- package/extra/PrivmxClient.d.ts +7 -1
- package/extra/PrivmxClient.js +14 -0
- package/index.d.ts +2 -2
- package/index.js +2 -1
- package/package.json +1 -1
- package/service/Connection.d.ts +2 -2
- package/service/Connection.js +2 -2
- package/service/EndpointFactory.d.ts +15 -3
- package/service/EndpointFactory.js +32 -5
- package/service/InboxApi.d.ts +9 -9
- package/service/InboxApi.js +9 -9
- package/service/KvdbApi.d.ts +142 -0
- package/service/KvdbApi.js +208 -0
- package/service/StoreApi.d.ts +6 -6
- package/service/StoreApi.js +6 -6
- package/service/ThreadApi.d.ts +6 -6
- package/service/ThreadApi.js +6 -6
- package/service/index.d.ts +2 -1
- package/service/index.js +3 -1
|
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;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 getContextUsers(e,t){return this.runAsync((i=>this.api.lib.Connection_getContextUsers(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;window.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)))}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 subscribeForCustomEvents(e,t){return this.runAsync((i=>this.api.lib.EventApi_subscribeForCustomEvents(i,e,t)))}async unsubscribeFromCustomEvents(e,t){return this.runAsync((i=>this.api.lib.EventApi_unsubscribeFromCustomEvents(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 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 getContextUsers(e){return this.native.getContextUsers(this.servicePtr,[e])}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),o=i(467),u=i(252),h=i(243),y=i(272),p=i(54),v=i(262),l=i(11),d=i(590),b=i(297),A=i(134),P=i(985),E=i(148);class _{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();_.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),p.FinalizationHelper.init(e)}static async getEventQueue(){if(!this.eventQueueInstance){const e=new o.EventQueueNative(this.api),t=await e.newEventQueue();this.eventQueueInstance=new b.EventQueue(e,t)}return this.eventQueueInstance}static async connect(e,t,i){const s=new r.ConnectionNative(this.api),n=await s.newConnection();return await s.connect(n,[e,t,i]),new v.Connection(s,n)}static async connectPublic(e,t){const i=new r.ConnectionNative(this.api),s=await i.newConnection();return await i.connectPublic(s,[e,t]),new v.Connection(i,s)}static async createThreadApi(e){if("threads"in e.apisRefs)throw new Error("ThreadApi already registered for given connection.");const t=new y.ThreadApiNative(this.api),i=await t.newApi(e.servicePtr);return await t.create(i,[]),e.apisRefs.threads={_apiServicePtr:i},e.nativeApisDeps.threads=t,new E.ThreadApi(t,i)}static async createStoreApi(e){if("stores"in e.apisRefs)throw new Error("StoreApi already registered for given connection.");const t=new h.StoreApiNative(this.api),i=await t.newApi(e.servicePtr);return e.apisRefs.stores={_apiServicePtr:i},e.nativeApisDeps.stores=t,await t.create(i,[]),new P.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 u.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 A.InboxApi(s,n)}static async createCryptoApi(){const e=new a.CryptoApiNative(this.api),t=await e.newApi();return await e.create(t,[]),new l.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 d.EventApi(t,i)}}t.EndpointFactory=_},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 subscribeForCustomEvents(e,t){return this.native.subscribeForCustomEvents(this.servicePtr,[e,t])}async unsubscribeFromCustomEvents(e,t){return this.native.unsubscribeFromCustomEvents(this.servicePtr,[e,t])}}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,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})()));
|
|
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;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 getContextUsers(e,t){return this.runAsync((i=>this.api.lib.Connection_getContextUsers(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;window.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)))}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 subscribeForCustomEvents(e,t){return this.runAsync((i=>this.api.lib.EventApi_subscribeForCustomEvents(i,e,t)))}async unsubscribeFromCustomEvents(e,t){return this.runAsync((i=>this.api.lib.EventApi_unsubscribeFromCustomEvents(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 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},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 subscribeForKvdbEvents(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_subscribeForKvdbEvents(i,e,t)))}async unsubscribeFromKvdbEvents(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_unsubscribeFromKvdbEvents(i,e,t)))}async subscribeForEntryEvents(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_subscribeForEntryEvents(i,e,t)))}async unsubscribeFromEntryEvents(e,t){return this.runAsync((i=>this.api.lib.KvdbApi_unsubscribeFromEntryEvents(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 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 getContextUsers(e){return this.native.getContextUsers(this.servicePtr,[e])}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),o=i(467),u=i(252),h=i(453),y=i(243),v=i(272),p=i(54),l=i(262),d=i(11),b=i(590),A=i(297),E=i(134),P=i(789),_=i(985),g=i(148);class w{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();w.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),p.FinalizationHelper.init(e)}static async getEventQueue(){if(!this.eventQueueInstance){const e=new o.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 l.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 l.Connection(s,n)}static async createThreadApi(e){if("threads"in e.apisRefs)throw new Error("ThreadApi already registered for given connection.");const t=new v.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 _.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 u.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 E.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 P.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=w},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 subscribeForCustomEvents(e,t){return this.native.subscribeForCustomEvents(this.servicePtr,[e,t])}async unsubscribeFromCustomEvents(e,t){return this.native.unsubscribeFromCustomEvents(this.servicePtr,[e,t])}}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,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},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,o){return this.native.updateKvdb(this.servicePtr,[e,t,i,s,n,r,a,c,o])}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 subscribeForKvdbEvents(){return this.native.subscribeForKvdbEvents(this.servicePtr,[])}async unsubscribeFromKvdbEvents(){return this.native.unsubscribeFromKvdbEvents(this.servicePtr,[])}async subscribeForEntryEvents(e){return this.native.subscribeForEntryEvents(this.servicePtr,[e])}async unsubscribeFromEntryEvents(e){return this.native.unsubscribeFromEntryEvents(this.servicePtr,[e])}}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,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})()));
|
package/extra/PrivmxClient.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Connection, CryptoApi, EventQueue, InboxApi, StoreApi, ThreadApi } from '../service';
|
|
1
|
+
import { Connection, CryptoApi, EventQueue, InboxApi, StoreApi, ThreadApi, KvdbApi } from '../service';
|
|
2
2
|
import { ConnectionEventsManager, EventManager, InboxEventsManager, StoreEventsManager, ThreadEventsManager } from './events';
|
|
3
3
|
import { PublicConnection } from './PublicConnection';
|
|
4
4
|
/**
|
|
@@ -35,6 +35,7 @@ export declare class PrivmxClient {
|
|
|
35
35
|
private threadApi;
|
|
36
36
|
private storeApi;
|
|
37
37
|
private inboxApi;
|
|
38
|
+
private kvdbApi;
|
|
38
39
|
private connectionEventManager;
|
|
39
40
|
private threadEventManager;
|
|
40
41
|
private storeEventManager;
|
|
@@ -105,6 +106,11 @@ export declare class PrivmxClient {
|
|
|
105
106
|
* @returns {Promise<InboxApi>}
|
|
106
107
|
*/
|
|
107
108
|
getInboxApi(): Promise<InboxApi>;
|
|
109
|
+
/**
|
|
110
|
+
* @description Gets the Kvdb API.
|
|
111
|
+
* @returns {Promise<KvdbApi>}
|
|
112
|
+
*/
|
|
113
|
+
getKvdbApi(): Promise<KvdbApi>;
|
|
108
114
|
/**
|
|
109
115
|
* @description Gets the Connection Event Manager.
|
|
110
116
|
* @returns {Promise<ConnectionEventsManager>}
|
package/extra/PrivmxClient.js
CHANGED
|
@@ -38,6 +38,7 @@ class PrivmxClient {
|
|
|
38
38
|
threadApi = null;
|
|
39
39
|
storeApi = null;
|
|
40
40
|
inboxApi = null;
|
|
41
|
+
kvdbApi = null;
|
|
41
42
|
connectionEventManager = null;
|
|
42
43
|
threadEventManager = null;
|
|
43
44
|
storeEventManager = null;
|
|
@@ -190,6 +191,19 @@ class PrivmxClient {
|
|
|
190
191
|
}
|
|
191
192
|
return this.inboxApi;
|
|
192
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* @description Gets the Kvdb API.
|
|
196
|
+
* @returns {Promise<KvdbApi>}
|
|
197
|
+
*/
|
|
198
|
+
async getKvdbApi() {
|
|
199
|
+
if (!this.kvdbApi) {
|
|
200
|
+
this.kvdbApi = (async () => {
|
|
201
|
+
const connection = this.getConnection();
|
|
202
|
+
return service_1.EndpointFactory.createKvdbApi(connection);
|
|
203
|
+
})();
|
|
204
|
+
}
|
|
205
|
+
return this.kvdbApi;
|
|
206
|
+
}
|
|
193
207
|
/**
|
|
194
208
|
* @description Gets the Connection Event Manager.
|
|
195
209
|
* @returns {Promise<ConnectionEventsManager>}
|
package/index.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ See the License for the specific language governing permissions and
|
|
|
9
9
|
limitations under the License.
|
|
10
10
|
*/
|
|
11
11
|
import { EndpointFactory } from "./service/EndpointFactory";
|
|
12
|
-
import { EventQueue, StoreApi, ThreadApi, InboxApi, Connection, CryptoApi, BaseApi, ExtKey } from "./service";
|
|
12
|
+
import { EventQueue, StoreApi, ThreadApi, InboxApi, KvdbApi, Connection, CryptoApi, BaseApi, ExtKey } from "./service";
|
|
13
13
|
import * as Types from "./Types";
|
|
14
|
-
export { EndpointFactory as Endpoint, Types, EventQueue, StoreApi, ThreadApi, InboxApi, CryptoApi, Connection, BaseApi, ExtKey };
|
|
14
|
+
export { EndpointFactory as Endpoint, Types, EventQueue, StoreApi, ThreadApi, InboxApi, KvdbApi, CryptoApi, Connection, BaseApi, ExtKey };
|
package/index.js
CHANGED
|
@@ -10,7 +10,7 @@ See the License for the specific language governing permissions and
|
|
|
10
10
|
limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.ExtKey = exports.BaseApi = exports.Connection = exports.CryptoApi = exports.InboxApi = exports.ThreadApi = exports.StoreApi = exports.EventQueue = exports.Types = exports.Endpoint = void 0;
|
|
13
|
+
exports.ExtKey = exports.BaseApi = exports.Connection = exports.CryptoApi = exports.KvdbApi = exports.InboxApi = exports.ThreadApi = exports.StoreApi = exports.EventQueue = exports.Types = exports.Endpoint = void 0;
|
|
14
14
|
const EndpointFactory_1 = require("./service/EndpointFactory");
|
|
15
15
|
Object.defineProperty(exports, "Endpoint", { enumerable: true, get: function () { return EndpointFactory_1.EndpointFactory; } });
|
|
16
16
|
const service_1 = require("./service");
|
|
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "EventQueue", { enumerable: true, get: function (
|
|
|
18
18
|
Object.defineProperty(exports, "StoreApi", { enumerable: true, get: function () { return service_1.StoreApi; } });
|
|
19
19
|
Object.defineProperty(exports, "ThreadApi", { enumerable: true, get: function () { return service_1.ThreadApi; } });
|
|
20
20
|
Object.defineProperty(exports, "InboxApi", { enumerable: true, get: function () { return service_1.InboxApi; } });
|
|
21
|
+
Object.defineProperty(exports, "KvdbApi", { enumerable: true, get: function () { return service_1.KvdbApi; } });
|
|
21
22
|
Object.defineProperty(exports, "Connection", { enumerable: true, get: function () { return service_1.Connection; } });
|
|
22
23
|
Object.defineProperty(exports, "CryptoApi", { enumerable: true, get: function () { return service_1.CryptoApi; } });
|
|
23
24
|
Object.defineProperty(exports, "BaseApi", { enumerable: true, get: function () { return service_1.BaseApi; } });
|
package/package.json
CHANGED
package/service/Connection.d.ts
CHANGED
|
@@ -39,8 +39,8 @@ export declare class Connection extends BaseApi {
|
|
|
39
39
|
/**
|
|
40
40
|
* Gets a list of Contexts available for the user.
|
|
41
41
|
*
|
|
42
|
-
* @param pagingQuery
|
|
43
|
-
* @returns {PagingList<Context>}
|
|
42
|
+
* @param pagingQuery with list query parameters
|
|
43
|
+
* @returns {PagingList<Context>} containing a list of Contexts
|
|
44
44
|
*/
|
|
45
45
|
listContexts(pagingQuery: PagingQuery): Promise<PagingList<Context>>;
|
|
46
46
|
/**
|
package/service/Connection.js
CHANGED
|
@@ -37,8 +37,8 @@ class Connection extends BaseApi_1.BaseApi {
|
|
|
37
37
|
/**
|
|
38
38
|
* Gets a list of Contexts available for the user.
|
|
39
39
|
*
|
|
40
|
-
* @param pagingQuery
|
|
41
|
-
* @returns {PagingList<Context>}
|
|
40
|
+
* @param pagingQuery with list query parameters
|
|
41
|
+
* @returns {PagingList<Context>} containing a list of Contexts
|
|
42
42
|
*/
|
|
43
43
|
async listContexts(pagingQuery) {
|
|
44
44
|
return this.native.listContexts(this.servicePtr, [pagingQuery]);
|
|
@@ -8,11 +8,13 @@ This software is Licensed under the PrivMX Free License.
|
|
|
8
8
|
See the License for the specific language governing permissions and
|
|
9
9
|
limitations under the License.
|
|
10
10
|
*/
|
|
11
|
+
import { PKIVerificationOptions } from "../Types";
|
|
11
12
|
import { Connection } from "./Connection";
|
|
12
13
|
import { CryptoApi } from "./CryptoApi";
|
|
13
14
|
import { EventApi } from "./EventApi";
|
|
14
15
|
import { EventQueue } from "./EventQueue";
|
|
15
16
|
import { InboxApi } from "./InboxApi";
|
|
17
|
+
import { KvdbApi } from "./KvdbApi";
|
|
16
18
|
import { StoreApi } from "./StoreApi";
|
|
17
19
|
import { ThreadApi } from "./ThreadApi";
|
|
18
20
|
/**
|
|
@@ -38,24 +40,26 @@ export declare class EndpointFactory {
|
|
|
38
40
|
* @returns {EventQueue} instance of EventQueue
|
|
39
41
|
*/
|
|
40
42
|
static getEventQueue(): Promise<EventQueue>;
|
|
43
|
+
private static generateDefaultPKIVerificationOptions;
|
|
41
44
|
/**
|
|
42
45
|
* Connects to the platform backend.
|
|
43
46
|
*
|
|
44
47
|
* @param {string} userPrivKey user's private key
|
|
45
48
|
* @param {string} solutionId ID of the Solution
|
|
46
49
|
* @param {string} bridgeUrl the Bridge Server URL
|
|
50
|
+
* @param {PKIVerificationOptions} [verificationOptions] PrivMX Bridge server instance verification options using a PKI server
|
|
47
51
|
* @returns {Connection} instance of Connection
|
|
48
52
|
*/
|
|
49
|
-
static connect(userPrivKey: string, solutionId: string, bridgeUrl: string): Promise<Connection>;
|
|
53
|
+
static connect(userPrivKey: string, solutionId: string, bridgeUrl: string, verificationOptions?: PKIVerificationOptions): Promise<Connection>;
|
|
50
54
|
/**
|
|
51
55
|
* Connects to the Platform backend as a guest user.
|
|
52
56
|
*
|
|
53
57
|
* @param {string} solutionId ID of the Solution
|
|
54
58
|
* @param {string} bridgeUrl the Bridge Server URL
|
|
55
|
-
*
|
|
59
|
+
* @param {PKIVerificationOptions} [verificationOptions] PrivMX Bridge server instance verification options using a PKI server
|
|
56
60
|
* @returns {Connection} instance of Connection
|
|
57
61
|
*/
|
|
58
|
-
static connectPublic(solutionId: string, bridgeUrl: string): Promise<Connection>;
|
|
62
|
+
static connectPublic(solutionId: string, bridgeUrl: string, verificationOptions?: PKIVerificationOptions): Promise<Connection>;
|
|
59
63
|
/**
|
|
60
64
|
* Creates an instance of the Thread API.
|
|
61
65
|
*
|
|
@@ -81,6 +85,14 @@ export declare class EndpointFactory {
|
|
|
81
85
|
* @returns {InboxApi} instance of InboxApi
|
|
82
86
|
*/
|
|
83
87
|
static createInboxApi(connection: Connection, threadApi: ThreadApi, storeApi: StoreApi): Promise<InboxApi>;
|
|
88
|
+
/**
|
|
89
|
+
* Creates an instance of the Kvdb API.
|
|
90
|
+
*
|
|
91
|
+
* @param {Connection} connection instance of Connection
|
|
92
|
+
*
|
|
93
|
+
* @returns {KvdbApi} instance of KvdbApi
|
|
94
|
+
*/
|
|
95
|
+
static createKvdbApi(connection: Connection): Promise<KvdbApi>;
|
|
84
96
|
/**
|
|
85
97
|
* Creates an instance of the Crypto API.
|
|
86
98
|
*
|
|
@@ -18,6 +18,7 @@ const CryptoApiNative_1 = require("../api/CryptoApiNative");
|
|
|
18
18
|
const EventApiNative_1 = require("../api/EventApiNative");
|
|
19
19
|
const EventQueueNative_1 = require("../api/EventQueueNative");
|
|
20
20
|
const InboxApiNative_1 = require("../api/InboxApiNative");
|
|
21
|
+
const KvdbApiNative_1 = require("../api/KvdbApiNative");
|
|
21
22
|
const StoreApiNative_1 = require("../api/StoreApiNative");
|
|
22
23
|
const ThreadApiNative_1 = require("../api/ThreadApiNative");
|
|
23
24
|
const FinalizationHelper_1 = require("../FinalizationHelper");
|
|
@@ -26,6 +27,7 @@ const CryptoApi_1 = require("./CryptoApi");
|
|
|
26
27
|
const EventApi_1 = require("./EventApi");
|
|
27
28
|
const EventQueue_1 = require("./EventQueue");
|
|
28
29
|
const InboxApi_1 = require("./InboxApi");
|
|
30
|
+
const KvdbApi_1 = require("./KvdbApi");
|
|
29
31
|
const StoreApi_1 = require("./StoreApi");
|
|
30
32
|
const ThreadApi_1 = require("./ThreadApi");
|
|
31
33
|
/**
|
|
@@ -81,18 +83,25 @@ class EndpointFactory {
|
|
|
81
83
|
}
|
|
82
84
|
return this.eventQueueInstance;
|
|
83
85
|
}
|
|
86
|
+
static generateDefaultPKIVerificationOptions() {
|
|
87
|
+
return {
|
|
88
|
+
bridgeInstanceId: undefined,
|
|
89
|
+
bridgePubKey: undefined
|
|
90
|
+
};
|
|
91
|
+
}
|
|
84
92
|
/**
|
|
85
93
|
* Connects to the platform backend.
|
|
86
94
|
*
|
|
87
95
|
* @param {string} userPrivKey user's private key
|
|
88
96
|
* @param {string} solutionId ID of the Solution
|
|
89
97
|
* @param {string} bridgeUrl the Bridge Server URL
|
|
98
|
+
* @param {PKIVerificationOptions} [verificationOptions] PrivMX Bridge server instance verification options using a PKI server
|
|
90
99
|
* @returns {Connection} instance of Connection
|
|
91
100
|
*/
|
|
92
|
-
static async connect(userPrivKey, solutionId, bridgeUrl) {
|
|
101
|
+
static async connect(userPrivKey, solutionId, bridgeUrl, verificationOptions) {
|
|
93
102
|
const nativeApi = new ConnectionNative_1.ConnectionNative(this.api);
|
|
94
103
|
const ptr = await nativeApi.newConnection();
|
|
95
|
-
await nativeApi.connect(ptr, [userPrivKey, solutionId, bridgeUrl]);
|
|
104
|
+
await nativeApi.connect(ptr, [userPrivKey, solutionId, bridgeUrl, verificationOptions || this.generateDefaultPKIVerificationOptions()]);
|
|
96
105
|
return new Connection_1.Connection(nativeApi, ptr);
|
|
97
106
|
}
|
|
98
107
|
/**
|
|
@@ -100,13 +109,13 @@ class EndpointFactory {
|
|
|
100
109
|
*
|
|
101
110
|
* @param {string} solutionId ID of the Solution
|
|
102
111
|
* @param {string} bridgeUrl the Bridge Server URL
|
|
103
|
-
*
|
|
112
|
+
* @param {PKIVerificationOptions} [verificationOptions] PrivMX Bridge server instance verification options using a PKI server
|
|
104
113
|
* @returns {Connection} instance of Connection
|
|
105
114
|
*/
|
|
106
|
-
static async connectPublic(solutionId, bridgeUrl) {
|
|
115
|
+
static async connectPublic(solutionId, bridgeUrl, verificationOptions) {
|
|
107
116
|
const nativeApi = new ConnectionNative_1.ConnectionNative(this.api);
|
|
108
117
|
const ptr = await nativeApi.newConnection();
|
|
109
|
-
await nativeApi.connectPublic(ptr, [solutionId, bridgeUrl]);
|
|
118
|
+
await nativeApi.connectPublic(ptr, [solutionId, bridgeUrl, verificationOptions || this.generateDefaultPKIVerificationOptions()]);
|
|
110
119
|
return new Connection_1.Connection(nativeApi, ptr);
|
|
111
120
|
}
|
|
112
121
|
/**
|
|
@@ -164,6 +173,24 @@ class EndpointFactory {
|
|
|
164
173
|
await nativeApi.create(ptr, []);
|
|
165
174
|
return new InboxApi_1.InboxApi(nativeApi, ptr);
|
|
166
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Creates an instance of the Kvdb API.
|
|
178
|
+
*
|
|
179
|
+
* @param {Connection} connection instance of Connection
|
|
180
|
+
*
|
|
181
|
+
* @returns {KvdbApi} instance of KvdbApi
|
|
182
|
+
*/
|
|
183
|
+
static async createKvdbApi(connection) {
|
|
184
|
+
if ("kvdbs" in connection.apisRefs) {
|
|
185
|
+
throw new Error("KvdbApi already registered for given connection.");
|
|
186
|
+
}
|
|
187
|
+
const nativeApi = new KvdbApiNative_1.KvdbApiNative(this.api);
|
|
188
|
+
const ptr = await nativeApi.newApi(connection.servicePtr);
|
|
189
|
+
await nativeApi.create(ptr, []);
|
|
190
|
+
connection.apisRefs["kvdbs"] = { _apiServicePtr: ptr };
|
|
191
|
+
connection.nativeApisDeps["kvdbs"] = nativeApi;
|
|
192
|
+
return new KvdbApi_1.KvdbApi(nativeApi, ptr);
|
|
193
|
+
}
|
|
167
194
|
/**
|
|
168
195
|
* Creates an instance of the Crypto API.
|
|
169
196
|
*
|
package/service/InboxApi.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare class InboxApi extends BaseApi {
|
|
|
23
23
|
* the created Inbox
|
|
24
24
|
* @param {Uint8Array} publicMeta public (unencrypted) metadata
|
|
25
25
|
* @param {Uint8Array} privateMeta private (encrypted) metadata
|
|
26
|
-
* @param {FilesConfig} filesConfig
|
|
26
|
+
* @param {FilesConfig} filesConfig to override default file configuration
|
|
27
27
|
* @param {ContainerWithoutItemPolicy} policies Inbox policies
|
|
28
28
|
* @returns {string} ID of the created Inbox
|
|
29
29
|
*/
|
|
@@ -37,7 +37,7 @@ export declare class InboxApi extends BaseApi {
|
|
|
37
37
|
* the created Inbox
|
|
38
38
|
* @param {Uint8Array} publicMeta public (unencrypted) metadata
|
|
39
39
|
* @param {Uint8Array} privateMeta private (encrypted) metadata
|
|
40
|
-
* @param {FilesConfig} filesConfig
|
|
40
|
+
* @param {FilesConfig} filesConfig to override default files configuration
|
|
41
41
|
* @param {number} version current version of the updated Inbox
|
|
42
42
|
* @param {boolean} force force update (without checking version)
|
|
43
43
|
* @param {boolean} forceGenerateNewKey force to regenerate a key for the Inbox
|
|
@@ -48,15 +48,15 @@ export declare class InboxApi extends BaseApi {
|
|
|
48
48
|
* Gets a single Inbox by given Inbox ID.
|
|
49
49
|
*
|
|
50
50
|
* @param {string} inboxId ID of the Inbox to get
|
|
51
|
-
* @returns {Inbox}
|
|
51
|
+
* @returns {Inbox} containing information about the Inbox
|
|
52
52
|
*/
|
|
53
53
|
getInbox(inboxId: string): Promise<Inbox>;
|
|
54
54
|
/**
|
|
55
55
|
* Gets s list of Inboxes in given Context.
|
|
56
56
|
*
|
|
57
57
|
* @param {string} contextId ID of the Context to get Inboxes from
|
|
58
|
-
* @param {PagingQuery} pagingQuery
|
|
59
|
-
* @returns {PagingList<Inbox>}
|
|
58
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
59
|
+
* @returns {PagingList<Inbox>} containing list of Inboxes
|
|
60
60
|
*/
|
|
61
61
|
listInboxes(contextId: string, pagingQuery: PagingQuery): Promise<PagingList<Inbox>>;
|
|
62
62
|
/**
|
|
@@ -64,7 +64,7 @@ export declare class InboxApi extends BaseApi {
|
|
|
64
64
|
* You do not have to be logged in to call this function.
|
|
65
65
|
*
|
|
66
66
|
* @param {string} inboxId ID of the Inbox to get
|
|
67
|
-
* @returns {InboxPublicView}
|
|
67
|
+
* @returns {InboxPublicView} containing public accessible information about the Inbox
|
|
68
68
|
*/
|
|
69
69
|
getInboxPublicView(inboxId: string): Promise<InboxPublicView>;
|
|
70
70
|
/**
|
|
@@ -95,15 +95,15 @@ export declare class InboxApi extends BaseApi {
|
|
|
95
95
|
* Gets an entry from an Inbox.
|
|
96
96
|
*
|
|
97
97
|
* @param {string} inboxEntryId ID of an entry to read from the Inbox
|
|
98
|
-
* @returns {InboxEntry}
|
|
98
|
+
* @returns {InboxEntry} containing data of the selected entry stored in the Inbox
|
|
99
99
|
*/
|
|
100
100
|
readEntry(inboxEntryId: string): Promise<InboxEntry>;
|
|
101
101
|
/**
|
|
102
102
|
* Gets list of entries in given Inbox.
|
|
103
103
|
*
|
|
104
104
|
* @param {string} inboxId ID of the Inbox
|
|
105
|
-
* @param {PagingQuery} pagingQuery
|
|
106
|
-
* @returns {PagingList<InboxEntry>}
|
|
105
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
106
|
+
* @returns {PagingList<InboxEntry>} containing list of entries
|
|
107
107
|
*/
|
|
108
108
|
listEntries(inboxId: string, pagingQuery: PagingQuery): Promise<PagingList<InboxEntry>>;
|
|
109
109
|
/**
|
package/service/InboxApi.js
CHANGED
|
@@ -27,7 +27,7 @@ class InboxApi extends BaseApi_1.BaseApi {
|
|
|
27
27
|
* the created Inbox
|
|
28
28
|
* @param {Uint8Array} publicMeta public (unencrypted) metadata
|
|
29
29
|
* @param {Uint8Array} privateMeta private (encrypted) metadata
|
|
30
|
-
* @param {FilesConfig} filesConfig
|
|
30
|
+
* @param {FilesConfig} filesConfig to override default file configuration
|
|
31
31
|
* @param {ContainerWithoutItemPolicy} policies Inbox policies
|
|
32
32
|
* @returns {string} ID of the created Inbox
|
|
33
33
|
*/
|
|
@@ -51,7 +51,7 @@ class InboxApi extends BaseApi_1.BaseApi {
|
|
|
51
51
|
* the created Inbox
|
|
52
52
|
* @param {Uint8Array} publicMeta public (unencrypted) metadata
|
|
53
53
|
* @param {Uint8Array} privateMeta private (encrypted) metadata
|
|
54
|
-
* @param {FilesConfig} filesConfig
|
|
54
|
+
* @param {FilesConfig} filesConfig to override default files configuration
|
|
55
55
|
* @param {number} version current version of the updated Inbox
|
|
56
56
|
* @param {boolean} force force update (without checking version)
|
|
57
57
|
* @param {boolean} forceGenerateNewKey force to regenerate a key for the Inbox
|
|
@@ -75,7 +75,7 @@ class InboxApi extends BaseApi_1.BaseApi {
|
|
|
75
75
|
* Gets a single Inbox by given Inbox ID.
|
|
76
76
|
*
|
|
77
77
|
* @param {string} inboxId ID of the Inbox to get
|
|
78
|
-
* @returns {Inbox}
|
|
78
|
+
* @returns {Inbox} containing information about the Inbox
|
|
79
79
|
*/
|
|
80
80
|
async getInbox(inboxId) {
|
|
81
81
|
return this.native.getInbox(this.servicePtr, [inboxId]);
|
|
@@ -84,8 +84,8 @@ class InboxApi extends BaseApi_1.BaseApi {
|
|
|
84
84
|
* Gets s list of Inboxes in given Context.
|
|
85
85
|
*
|
|
86
86
|
* @param {string} contextId ID of the Context to get Inboxes from
|
|
87
|
-
* @param {PagingQuery} pagingQuery
|
|
88
|
-
* @returns {PagingList<Inbox>}
|
|
87
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
88
|
+
* @returns {PagingList<Inbox>} containing list of Inboxes
|
|
89
89
|
*/
|
|
90
90
|
async listInboxes(contextId, pagingQuery) {
|
|
91
91
|
return this.native.listInboxes(this.servicePtr, [contextId, pagingQuery]);
|
|
@@ -95,7 +95,7 @@ class InboxApi extends BaseApi_1.BaseApi {
|
|
|
95
95
|
* You do not have to be logged in to call this function.
|
|
96
96
|
*
|
|
97
97
|
* @param {string} inboxId ID of the Inbox to get
|
|
98
|
-
* @returns {InboxPublicView}
|
|
98
|
+
* @returns {InboxPublicView} containing public accessible information about the Inbox
|
|
99
99
|
*/
|
|
100
100
|
async getInboxPublicView(inboxId) {
|
|
101
101
|
return this.native.getInboxPublicView(this.servicePtr, [inboxId]);
|
|
@@ -139,7 +139,7 @@ class InboxApi extends BaseApi_1.BaseApi {
|
|
|
139
139
|
* Gets an entry from an Inbox.
|
|
140
140
|
*
|
|
141
141
|
* @param {string} inboxEntryId ID of an entry to read from the Inbox
|
|
142
|
-
* @returns {InboxEntry}
|
|
142
|
+
* @returns {InboxEntry} containing data of the selected entry stored in the Inbox
|
|
143
143
|
*/
|
|
144
144
|
async readEntry(inboxEntryId) {
|
|
145
145
|
return this.native.readEntry(this.servicePtr, [inboxEntryId]);
|
|
@@ -148,8 +148,8 @@ class InboxApi extends BaseApi_1.BaseApi {
|
|
|
148
148
|
* Gets list of entries in given Inbox.
|
|
149
149
|
*
|
|
150
150
|
* @param {string} inboxId ID of the Inbox
|
|
151
|
-
* @param {PagingQuery} pagingQuery
|
|
152
|
-
* @returns {PagingList<InboxEntry>}
|
|
151
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
152
|
+
* @returns {PagingList<InboxEntry>} containing list of entries
|
|
153
153
|
*/
|
|
154
154
|
async listEntries(inboxId, pagingQuery) {
|
|
155
155
|
return this.native.listEntries(this.servicePtr, [inboxId, pagingQuery]);
|