@simplito/privmx-webendpoint 2.2.9 → 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/FinalizationHelper.d.ts +18 -0
- package/FinalizationHelper.js +49 -0
- package/Types.d.ts +178 -21
- package/Types.js +7 -0
- package/api/ApiStatic.d.ts +16 -0
- package/api/ApiStatic.js +26 -0
- package/api/ConnectionNative.d.ts +9 -3
- package/api/ConnectionNative.js +24 -0
- package/api/CryptoApiNative.d.ts +14 -0
- package/api/CryptoApiNative.js +30 -0
- package/api/EventApiNative.d.ts +20 -0
- package/api/EventApiNative.js +36 -0
- package/api/ExtKeyNative.d.ts +23 -0
- package/api/ExtKeyNative.js +66 -0
- 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 +139 -0
- package/extra/PrivmxClient.js +285 -0
- package/extra/PublicConnection.d.ts +70 -0
- package/extra/PublicConnection.js +118 -0
- package/extra/events.d.ts +2 -2
- package/extra/inbox.d.ts +3 -3
- package/extra/inbox.js +1 -1
- package/extra/index.d.ts +10 -8
- package/extra/index.js +6 -1
- package/index.d.ts +2 -2
- package/index.js +3 -1
- package/package.json +5 -1
- package/service/Connection.d.ts +29 -3
- package/service/Connection.js +31 -2
- package/service/CryptoApi.d.ts +48 -1
- package/service/CryptoApi.js +59 -1
- package/service/EndpointFactory.d.ts +24 -3
- package/service/EndpointFactory.js +56 -5
- package/service/EventApi.d.ts +40 -0
- package/service/EventApi.js +60 -0
- package/service/ExtKey.d.ts +103 -0
- package/service/ExtKey.js +167 -0
- 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/UserVerifierInterface.d.ts +18 -0
- package/service/UserVerifierInterface.js +2 -0
- package/service/index.d.ts +3 -1
- package/service/index.js +5 -1
- package/assets/privmx-endpoint-web.js +0 -2
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
PrivMX Web Endpoint.
|
|
3
|
+
Copyright © 2024 Simplito sp. z o.o.
|
|
4
|
+
|
|
5
|
+
This file is part of the PrivMX Platform (https://privmx.dev).
|
|
6
|
+
This software is Licensed under the PrivMX Free License.
|
|
7
|
+
|
|
8
|
+
See the License for the specific language governing permissions and
|
|
9
|
+
limitations under the License.
|
|
10
|
+
*/
|
|
11
|
+
import { BaseApi } from "./BaseApi";
|
|
12
|
+
import { KvdbApiNative } from "../api/KvdbApiNative";
|
|
13
|
+
import { PagingQuery, PagingList, UserWithPubKey, Kvdb, ContainerPolicy, KvdbEntry, DeleteEntriesResult } from "../Types";
|
|
14
|
+
export declare class KvdbApi extends BaseApi {
|
|
15
|
+
protected native: KvdbApiNative;
|
|
16
|
+
constructor(native: KvdbApiNative, ptr: number);
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new KVDB in given Context.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} contextId ID of the Context to create the KVDB in
|
|
21
|
+
* @param {UserWithPubKey[]} users array of UserWithPubKey structs which indicates who will have access to the created Kvdb
|
|
22
|
+
* @param {UserWithPubKey[]} managers array of UserWithPubKey structs which indicates who will have access (and management rights) to
|
|
23
|
+
* the created Kvdb
|
|
24
|
+
* @param {Uint8Array} publicMeta public (unencrypted) metadata
|
|
25
|
+
* @param {Uint8Array} privateMeta private (encrypted) metadata
|
|
26
|
+
* @param {ContainerPolicy} policies Kvdb's policies
|
|
27
|
+
* @returns {string} ID of the created Kvdb
|
|
28
|
+
*/
|
|
29
|
+
createKvdb(contextId: string, users: UserWithPubKey[], managers: UserWithPubKey[], publicMeta: Uint8Array, privateMeta: Uint8Array, policies?: ContainerPolicy): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Updates an existing Kvdb.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} kvdbId ID of the KVDB to update
|
|
34
|
+
* @param {UserWithPubKey[]} users array of UserWithPubKey structs which indicates who will have access to the created Kvdb
|
|
35
|
+
* @param {UserWithPubKey[]} managers array of UserWithPubKey structs which indicates who will have access (and management rights) to
|
|
36
|
+
* the created Kvdb
|
|
37
|
+
* @param {Uint8Array} publicMeta public (unencrypted) metadata
|
|
38
|
+
* @param {Uint8Array} privateMeta private (encrypted) metadata
|
|
39
|
+
* @param {number} version current version of the updated Kvdb
|
|
40
|
+
* @param {boolean} force force update (without checking version)
|
|
41
|
+
* @param {boolean} forceGenerateNewKey force to regenerate a key for the Kvdb
|
|
42
|
+
* @param {ContainerPolicy} policies Kvdb's policies
|
|
43
|
+
*/
|
|
44
|
+
updateKvdb(kvdbId: string, users: UserWithPubKey[], managers: UserWithPubKey[], publicMeta: Uint8Array, privateMeta: Uint8Array, version: number, force: boolean, forceGenerateNewKey: boolean, policies?: ContainerPolicy): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Deletes a KVDB by given KVDB ID.
|
|
47
|
+
*
|
|
48
|
+
* @param {string} kvdbId ID of the KVDB to delete
|
|
49
|
+
*/
|
|
50
|
+
deleteKvdb(kvdbId: string): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Gets a KVDB by given KVDB ID.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} kvdbId ID of KVDB to get
|
|
55
|
+
* @returns {Kvdb} containing info about the Kvdb
|
|
56
|
+
*/
|
|
57
|
+
getKvdb(kvdbId: string): Promise<Kvdb>;
|
|
58
|
+
/**
|
|
59
|
+
* Gets a list of Kvdbs in given Context.
|
|
60
|
+
*
|
|
61
|
+
* @param {string} contextId ID of the Context to get the Kvdbs from
|
|
62
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
63
|
+
* @returns {PagingList<Kvdb>} containing a list of Kvdbs
|
|
64
|
+
*/
|
|
65
|
+
listKvdbs(contextId: string, pagingQuery: PagingQuery): Promise<PagingList<Kvdb>>;
|
|
66
|
+
/**
|
|
67
|
+
* Gets a KVDB entry by given KVDB entry key and KVDB ID.
|
|
68
|
+
*
|
|
69
|
+
* @param {string} kvdbId KVDB ID of the KVDB entry to get
|
|
70
|
+
* @param {string} key key of the KVDB entry to get
|
|
71
|
+
* @returns {KvdbEntry} containing the KVDB entry
|
|
72
|
+
*/
|
|
73
|
+
getEntry(kvdbId: string, key: string): Promise<KvdbEntry>;
|
|
74
|
+
/**
|
|
75
|
+
* Check whether the KVDB entry exists.
|
|
76
|
+
*
|
|
77
|
+
* @param {string} kvdbId KVDB ID of the KVDB entry to check
|
|
78
|
+
* @param {string} key key of the KVDB entry to check
|
|
79
|
+
* @returns {boolean} 'true' if the KVDB has an entry with given key, 'false' otherwise
|
|
80
|
+
*/
|
|
81
|
+
hasEntry(kvdbId: string, key: string): Promise<boolean>;
|
|
82
|
+
/**
|
|
83
|
+
* Gets a list of KVDB entries keys from a Kvdb.
|
|
84
|
+
*
|
|
85
|
+
* @param {string} kvdbId ID of the KVDB to list KVDB entries from
|
|
86
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
87
|
+
* @returns {PagingList<string>} containing a list of KVDB entries
|
|
88
|
+
*/
|
|
89
|
+
listEntriesKeys(kvdbId: string, pagingQuery: PagingQuery): Promise<PagingList<string>>;
|
|
90
|
+
/**
|
|
91
|
+
* Gets a list of KVDB entries from a Kvdb.
|
|
92
|
+
*
|
|
93
|
+
* @param {string} kvdbId ID of the KVDB to list KVDB entries from
|
|
94
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
95
|
+
* @returns {PagingList<KvdbEntry>} containing a list of KVDB entries
|
|
96
|
+
*/
|
|
97
|
+
listEntries(kvdbId: string, pagingQuery: PagingQuery): Promise<PagingList<KvdbEntry>>;
|
|
98
|
+
/**
|
|
99
|
+
* Sets a KVDB entry in the given Kvdb.
|
|
100
|
+
* @param {string} kvdbId ID of the KVDB to set the entry to
|
|
101
|
+
* @param {string} key KVDB entry key
|
|
102
|
+
* @param {Uint8Array} publicMeta public KVDB entry metadata
|
|
103
|
+
* @param {Uint8Array} privateMeta private KVDB entry metadata
|
|
104
|
+
* @param {Uint8Array} data content of the KVDB entry
|
|
105
|
+
* @param {number} [version] KVDB entry version (when updating the entry)
|
|
106
|
+
* @returns {string} ID of the KVDB entry
|
|
107
|
+
*/
|
|
108
|
+
setEntry(kvdbId: string, key: string, publicMeta: Uint8Array, privateMeta: Uint8Array, data: Uint8Array, version?: number): Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
* Deletes a KVDB entry by given KVDB entry ID.
|
|
111
|
+
*
|
|
112
|
+
* @param {string} kvdbId KVDB ID of the KVDB entry to delete
|
|
113
|
+
* @param {string} key key of the KVDB entry to delete
|
|
114
|
+
*/
|
|
115
|
+
deleteEntry(kvdbId: string, key: string): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Deletes KVDB entries by given KVDB IDs and the list of entry keys.
|
|
118
|
+
*
|
|
119
|
+
* @param {string} kvdbId ID of the KVDB database to delete from
|
|
120
|
+
* @param {string[]} keys keys of the KVDB entries to delete
|
|
121
|
+
* @returns {Map<string, boolean>} map with the statuses of deletion for every key
|
|
122
|
+
*/
|
|
123
|
+
deleteEntries(kvdbId: string, keys: string[]): Promise<DeleteEntriesResult>;
|
|
124
|
+
/**
|
|
125
|
+
* Subscribes for the KVDB module main events.
|
|
126
|
+
*/
|
|
127
|
+
subscribeForKvdbEvents(): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Unsubscribes from the KVDB module main events.
|
|
130
|
+
*/
|
|
131
|
+
unsubscribeFromKvdbEvents(): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Subscribes for events in given Kvdb.
|
|
134
|
+
* @param {string} kvdbId ID of the KVDB to subscribe
|
|
135
|
+
*/
|
|
136
|
+
subscribeForEntryEvents(kvdbId: string): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Unsubscribes from events in given Kvdb.
|
|
139
|
+
* @param {string} kvdbId ID of the KVDB to unsubscribe
|
|
140
|
+
*/
|
|
141
|
+
unsubscribeFromEntryEvents(kvdbId: string): Promise<void>;
|
|
142
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
PrivMX Web Endpoint.
|
|
4
|
+
Copyright © 2024 Simplito sp. z o.o.
|
|
5
|
+
|
|
6
|
+
This file is part of the PrivMX Platform (https://privmx.dev).
|
|
7
|
+
This software is Licensed under the PrivMX Free License.
|
|
8
|
+
|
|
9
|
+
See the License for the specific language governing permissions and
|
|
10
|
+
limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.KvdbApi = void 0;
|
|
14
|
+
const BaseApi_1 = require("./BaseApi");
|
|
15
|
+
class KvdbApi extends BaseApi_1.BaseApi {
|
|
16
|
+
native;
|
|
17
|
+
constructor(native, ptr) {
|
|
18
|
+
super(ptr);
|
|
19
|
+
this.native = native;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new KVDB in given Context.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} contextId ID of the Context to create the KVDB in
|
|
25
|
+
* @param {UserWithPubKey[]} users array of UserWithPubKey structs which indicates who will have access to the created Kvdb
|
|
26
|
+
* @param {UserWithPubKey[]} managers array of UserWithPubKey structs which indicates who will have access (and management rights) to
|
|
27
|
+
* the created Kvdb
|
|
28
|
+
* @param {Uint8Array} publicMeta public (unencrypted) metadata
|
|
29
|
+
* @param {Uint8Array} privateMeta private (encrypted) metadata
|
|
30
|
+
* @param {ContainerPolicy} policies Kvdb's policies
|
|
31
|
+
* @returns {string} ID of the created Kvdb
|
|
32
|
+
*/
|
|
33
|
+
async createKvdb(contextId, users, managers, publicMeta, privateMeta, policies) {
|
|
34
|
+
return this.native.createKvdb(this.servicePtr, [
|
|
35
|
+
contextId,
|
|
36
|
+
users,
|
|
37
|
+
managers,
|
|
38
|
+
publicMeta,
|
|
39
|
+
privateMeta,
|
|
40
|
+
policies,
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Updates an existing Kvdb.
|
|
45
|
+
*
|
|
46
|
+
* @param {string} kvdbId ID of the KVDB to update
|
|
47
|
+
* @param {UserWithPubKey[]} users array of UserWithPubKey structs which indicates who will have access to the created Kvdb
|
|
48
|
+
* @param {UserWithPubKey[]} managers array of UserWithPubKey structs which indicates who will have access (and management rights) to
|
|
49
|
+
* the created Kvdb
|
|
50
|
+
* @param {Uint8Array} publicMeta public (unencrypted) metadata
|
|
51
|
+
* @param {Uint8Array} privateMeta private (encrypted) metadata
|
|
52
|
+
* @param {number} version current version of the updated Kvdb
|
|
53
|
+
* @param {boolean} force force update (without checking version)
|
|
54
|
+
* @param {boolean} forceGenerateNewKey force to regenerate a key for the Kvdb
|
|
55
|
+
* @param {ContainerPolicy} policies Kvdb's policies
|
|
56
|
+
*/
|
|
57
|
+
async updateKvdb(kvdbId, users, managers, publicMeta, privateMeta, version, force, forceGenerateNewKey, policies) {
|
|
58
|
+
return this.native.updateKvdb(this.servicePtr, [
|
|
59
|
+
kvdbId,
|
|
60
|
+
users,
|
|
61
|
+
managers,
|
|
62
|
+
publicMeta,
|
|
63
|
+
privateMeta,
|
|
64
|
+
version,
|
|
65
|
+
force,
|
|
66
|
+
forceGenerateNewKey,
|
|
67
|
+
policies,
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Deletes a KVDB by given KVDB ID.
|
|
72
|
+
*
|
|
73
|
+
* @param {string} kvdbId ID of the KVDB to delete
|
|
74
|
+
*/
|
|
75
|
+
async deleteKvdb(kvdbId) {
|
|
76
|
+
return this.native.deleteKvdb(this.servicePtr, [kvdbId]);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Gets a KVDB by given KVDB ID.
|
|
80
|
+
*
|
|
81
|
+
* @param {string} kvdbId ID of KVDB to get
|
|
82
|
+
* @returns {Kvdb} containing info about the Kvdb
|
|
83
|
+
*/
|
|
84
|
+
async getKvdb(kvdbId) {
|
|
85
|
+
return this.native.getKvdb(this.servicePtr, [kvdbId]);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Gets a list of Kvdbs in given Context.
|
|
89
|
+
*
|
|
90
|
+
* @param {string} contextId ID of the Context to get the Kvdbs from
|
|
91
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
92
|
+
* @returns {PagingList<Kvdb>} containing a list of Kvdbs
|
|
93
|
+
*/
|
|
94
|
+
async listKvdbs(contextId, pagingQuery) {
|
|
95
|
+
return this.native.listKvdbs(this.servicePtr, [contextId, pagingQuery]);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Gets a KVDB entry by given KVDB entry key and KVDB ID.
|
|
99
|
+
*
|
|
100
|
+
* @param {string} kvdbId KVDB ID of the KVDB entry to get
|
|
101
|
+
* @param {string} key key of the KVDB entry to get
|
|
102
|
+
* @returns {KvdbEntry} containing the KVDB entry
|
|
103
|
+
*/
|
|
104
|
+
async getEntry(kvdbId, key) {
|
|
105
|
+
return this.native.getEntry(this.servicePtr, [kvdbId, key]);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Check whether the KVDB entry exists.
|
|
109
|
+
*
|
|
110
|
+
* @param {string} kvdbId KVDB ID of the KVDB entry to check
|
|
111
|
+
* @param {string} key key of the KVDB entry to check
|
|
112
|
+
* @returns {boolean} 'true' if the KVDB has an entry with given key, 'false' otherwise
|
|
113
|
+
*/
|
|
114
|
+
async hasEntry(kvdbId, key) {
|
|
115
|
+
return this.native.hasEntry(this.servicePtr, [kvdbId, key]);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Gets a list of KVDB entries keys from a Kvdb.
|
|
119
|
+
*
|
|
120
|
+
* @param {string} kvdbId ID of the KVDB to list KVDB entries from
|
|
121
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
122
|
+
* @returns {PagingList<string>} containing a list of KVDB entries
|
|
123
|
+
*/
|
|
124
|
+
async listEntriesKeys(kvdbId, pagingQuery) {
|
|
125
|
+
return this.native.listEntriesKeys(this.servicePtr, [kvdbId, pagingQuery]);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Gets a list of KVDB entries from a Kvdb.
|
|
129
|
+
*
|
|
130
|
+
* @param {string} kvdbId ID of the KVDB to list KVDB entries from
|
|
131
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
132
|
+
* @returns {PagingList<KvdbEntry>} containing a list of KVDB entries
|
|
133
|
+
*/
|
|
134
|
+
async listEntries(kvdbId, pagingQuery) {
|
|
135
|
+
return this.native.listEntries(this.servicePtr, [kvdbId, pagingQuery]);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Sets a KVDB entry in the given Kvdb.
|
|
139
|
+
* @param {string} kvdbId ID of the KVDB to set the entry to
|
|
140
|
+
* @param {string} key KVDB entry key
|
|
141
|
+
* @param {Uint8Array} publicMeta public KVDB entry metadata
|
|
142
|
+
* @param {Uint8Array} privateMeta private KVDB entry metadata
|
|
143
|
+
* @param {Uint8Array} data content of the KVDB entry
|
|
144
|
+
* @param {number} [version] KVDB entry version (when updating the entry)
|
|
145
|
+
* @returns {string} ID of the KVDB entry
|
|
146
|
+
*/
|
|
147
|
+
async setEntry(kvdbId, key, publicMeta, privateMeta, data, version) {
|
|
148
|
+
return this.native.setEntry(this.servicePtr, [
|
|
149
|
+
kvdbId,
|
|
150
|
+
key,
|
|
151
|
+
publicMeta,
|
|
152
|
+
privateMeta,
|
|
153
|
+
data,
|
|
154
|
+
version || 0
|
|
155
|
+
]);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Deletes a KVDB entry by given KVDB entry ID.
|
|
159
|
+
*
|
|
160
|
+
* @param {string} kvdbId KVDB ID of the KVDB entry to delete
|
|
161
|
+
* @param {string} key key of the KVDB entry to delete
|
|
162
|
+
*/
|
|
163
|
+
async deleteEntry(kvdbId, key) {
|
|
164
|
+
return this.native.deleteEntry(this.servicePtr, [kvdbId, key]);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Deletes KVDB entries by given KVDB IDs and the list of entry keys.
|
|
168
|
+
*
|
|
169
|
+
* @param {string} kvdbId ID of the KVDB database to delete from
|
|
170
|
+
* @param {string[]} keys keys of the KVDB entries to delete
|
|
171
|
+
* @returns {Map<string, boolean>} map with the statuses of deletion for every key
|
|
172
|
+
*/
|
|
173
|
+
async deleteEntries(kvdbId, keys) {
|
|
174
|
+
return this.native.deleteEntries(this.servicePtr, [
|
|
175
|
+
kvdbId,
|
|
176
|
+
keys,
|
|
177
|
+
]);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Subscribes for the KVDB module main events.
|
|
181
|
+
*/
|
|
182
|
+
async subscribeForKvdbEvents() {
|
|
183
|
+
return this.native.subscribeForKvdbEvents(this.servicePtr, []);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Unsubscribes from the KVDB module main events.
|
|
187
|
+
*/
|
|
188
|
+
async unsubscribeFromKvdbEvents() {
|
|
189
|
+
return this.native.unsubscribeFromKvdbEvents(this.servicePtr, []);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Subscribes for events in given Kvdb.
|
|
193
|
+
* @param {string} kvdbId ID of the KVDB to subscribe
|
|
194
|
+
*/
|
|
195
|
+
async subscribeForEntryEvents(kvdbId) {
|
|
196
|
+
return this.native.subscribeForEntryEvents(this.servicePtr, [kvdbId]);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Unsubscribes from events in given Kvdb.
|
|
200
|
+
* @param {string} kvdbId ID of the KVDB to unsubscribe
|
|
201
|
+
*/
|
|
202
|
+
async unsubscribeFromEntryEvents(kvdbId) {
|
|
203
|
+
return this.native.unsubscribeFromEntryEvents(this.servicePtr, [
|
|
204
|
+
kvdbId,
|
|
205
|
+
]);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
exports.KvdbApi = KvdbApi;
|
package/service/StoreApi.d.ts
CHANGED
|
@@ -52,15 +52,15 @@ export declare class StoreApi extends BaseApi {
|
|
|
52
52
|
* Gets a single Store by given Store ID.
|
|
53
53
|
*
|
|
54
54
|
* @param {string} storeId ID of the Store to get
|
|
55
|
-
* @returns {Store}
|
|
55
|
+
* @returns {Store} containing information about the Store
|
|
56
56
|
*/
|
|
57
57
|
getStore(storeId: string): Promise<Store>;
|
|
58
58
|
/**
|
|
59
59
|
* Gets a list of Stores in given Context.
|
|
60
60
|
*
|
|
61
61
|
* @param {string} contextId ID of the Context to get the Stores from
|
|
62
|
-
* @param {PagingQuery} pagingQuery
|
|
63
|
-
* @returns {PagingList<Store>}
|
|
62
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
63
|
+
* @returns {PagingList<Store>} containing list of Stores
|
|
64
64
|
*/
|
|
65
65
|
listStores(contextId: string, pagingQuery: PagingQuery): Promise<PagingList<Store>>;
|
|
66
66
|
/**
|
|
@@ -108,15 +108,15 @@ export declare class StoreApi extends BaseApi {
|
|
|
108
108
|
* Gets a single file by the given file ID.
|
|
109
109
|
*
|
|
110
110
|
* @param {string} fileId ID of the file to get
|
|
111
|
-
* @returns {File}
|
|
111
|
+
* @returns {File} containing information about the file
|
|
112
112
|
*/
|
|
113
113
|
getFile(fileId: string): Promise<File>;
|
|
114
114
|
/**
|
|
115
115
|
* Gets a list of files in given Store.
|
|
116
116
|
*
|
|
117
117
|
* @param {string} storeId ID of the Store to get files from
|
|
118
|
-
* @param {PagingQuery} pagingQuery
|
|
119
|
-
* @returns {PagingList<File>}
|
|
118
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
119
|
+
* @returns {PagingList<File>} containing list of files
|
|
120
120
|
*/
|
|
121
121
|
listFiles(storeId: string, pagingQuery: PagingQuery): Promise<PagingList<File>>;
|
|
122
122
|
/**
|
package/service/StoreApi.js
CHANGED
|
@@ -79,7 +79,7 @@ class StoreApi extends BaseApi_1.BaseApi {
|
|
|
79
79
|
* Gets a single Store by given Store ID.
|
|
80
80
|
*
|
|
81
81
|
* @param {string} storeId ID of the Store to get
|
|
82
|
-
* @returns {Store}
|
|
82
|
+
* @returns {Store} containing information about the Store
|
|
83
83
|
*/
|
|
84
84
|
async getStore(storeId) {
|
|
85
85
|
return this.native.getStore(this.servicePtr, [storeId]);
|
|
@@ -88,8 +88,8 @@ class StoreApi extends BaseApi_1.BaseApi {
|
|
|
88
88
|
* Gets a list of Stores in given Context.
|
|
89
89
|
*
|
|
90
90
|
* @param {string} contextId ID of the Context to get the Stores from
|
|
91
|
-
* @param {PagingQuery} pagingQuery
|
|
92
|
-
* @returns {PagingList<Store>}
|
|
91
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
92
|
+
* @returns {PagingList<Store>} containing list of Stores
|
|
93
93
|
*/
|
|
94
94
|
async listStores(contextId, pagingQuery) {
|
|
95
95
|
return this.native.listStores(this.servicePtr, [contextId, pagingQuery]);
|
|
@@ -163,7 +163,7 @@ class StoreApi extends BaseApi_1.BaseApi {
|
|
|
163
163
|
* Gets a single file by the given file ID.
|
|
164
164
|
*
|
|
165
165
|
* @param {string} fileId ID of the file to get
|
|
166
|
-
* @returns {File}
|
|
166
|
+
* @returns {File} containing information about the file
|
|
167
167
|
*/
|
|
168
168
|
async getFile(fileId) {
|
|
169
169
|
return this.native.getFile(this.servicePtr, [fileId]);
|
|
@@ -172,8 +172,8 @@ class StoreApi extends BaseApi_1.BaseApi {
|
|
|
172
172
|
* Gets a list of files in given Store.
|
|
173
173
|
*
|
|
174
174
|
* @param {string} storeId ID of the Store to get files from
|
|
175
|
-
* @param {PagingQuery} pagingQuery
|
|
176
|
-
* @returns {PagingList<File>}
|
|
175
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
176
|
+
* @returns {PagingList<File>} containing list of files
|
|
177
177
|
*/
|
|
178
178
|
async listFiles(storeId, pagingQuery) {
|
|
179
179
|
return this.native.listFiles(this.servicePtr, [storeId, pagingQuery]);
|
package/service/ThreadApi.d.ts
CHANGED
|
@@ -52,30 +52,30 @@ export declare class ThreadApi extends BaseApi {
|
|
|
52
52
|
* Gets a Thread by given Thread ID.
|
|
53
53
|
*
|
|
54
54
|
* @param {string} threadId ID of Thread to get
|
|
55
|
-
* @returns {Thread}
|
|
55
|
+
* @returns {Thread} containing info about the Thread
|
|
56
56
|
*/
|
|
57
57
|
getThread(threadId: string): Promise<Thread>;
|
|
58
58
|
/**
|
|
59
59
|
* Gets a list of Threads in given Context.
|
|
60
60
|
*
|
|
61
61
|
* @param {string} contextId ID of the Context to get the Threads from
|
|
62
|
-
* @param {PagingQuery} pagingQuery
|
|
63
|
-
* @returns {PagingList<Thread>}
|
|
62
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
63
|
+
* @returns {PagingList<Thread>} containing a list of Threads
|
|
64
64
|
*/
|
|
65
65
|
listThreads(contextId: string, pagingQuery: PagingQuery): Promise<PagingList<Thread>>;
|
|
66
66
|
/**
|
|
67
67
|
* Gets a message by given message ID.
|
|
68
68
|
*
|
|
69
69
|
* @param {string} messageId ID of the message to get
|
|
70
|
-
* @returns {Message}
|
|
70
|
+
* @returns {Message} containing the message
|
|
71
71
|
*/
|
|
72
72
|
getMessage(messageId: string): Promise<Message>;
|
|
73
73
|
/**
|
|
74
74
|
* Gets a list of messages from a Thread.
|
|
75
75
|
*
|
|
76
76
|
* @param {string} threadId ID of the Thread to list messages from
|
|
77
|
-
* @param {PagingQuery} pagingQuery
|
|
78
|
-
* @returns {PagingList<Message>}
|
|
77
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
78
|
+
* @returns {PagingList<Message>} containing a list of messages
|
|
79
79
|
*/
|
|
80
80
|
listMessages(threadId: string, pagingQuery: PagingQuery): Promise<PagingList<Message>>;
|
|
81
81
|
/**
|
package/service/ThreadApi.js
CHANGED
|
@@ -79,7 +79,7 @@ class ThreadApi extends BaseApi_1.BaseApi {
|
|
|
79
79
|
* Gets a Thread by given Thread ID.
|
|
80
80
|
*
|
|
81
81
|
* @param {string} threadId ID of Thread to get
|
|
82
|
-
* @returns {Thread}
|
|
82
|
+
* @returns {Thread} containing info about the Thread
|
|
83
83
|
*/
|
|
84
84
|
async getThread(threadId) {
|
|
85
85
|
return this.native.getThread(this.servicePtr, [threadId]);
|
|
@@ -88,8 +88,8 @@ class ThreadApi extends BaseApi_1.BaseApi {
|
|
|
88
88
|
* Gets a list of Threads in given Context.
|
|
89
89
|
*
|
|
90
90
|
* @param {string} contextId ID of the Context to get the Threads from
|
|
91
|
-
* @param {PagingQuery} pagingQuery
|
|
92
|
-
* @returns {PagingList<Thread>}
|
|
91
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
92
|
+
* @returns {PagingList<Thread>} containing a list of Threads
|
|
93
93
|
*/
|
|
94
94
|
async listThreads(contextId, pagingQuery) {
|
|
95
95
|
return this.native.listThreads(this.servicePtr, [contextId, pagingQuery]);
|
|
@@ -98,7 +98,7 @@ class ThreadApi extends BaseApi_1.BaseApi {
|
|
|
98
98
|
* Gets a message by given message ID.
|
|
99
99
|
*
|
|
100
100
|
* @param {string} messageId ID of the message to get
|
|
101
|
-
* @returns {Message}
|
|
101
|
+
* @returns {Message} containing the message
|
|
102
102
|
*/
|
|
103
103
|
async getMessage(messageId) {
|
|
104
104
|
return this.native.getMessage(this.servicePtr, [messageId]);
|
|
@@ -107,8 +107,8 @@ class ThreadApi extends BaseApi_1.BaseApi {
|
|
|
107
107
|
* Gets a list of messages from a Thread.
|
|
108
108
|
*
|
|
109
109
|
* @param {string} threadId ID of the Thread to list messages from
|
|
110
|
-
* @param {PagingQuery} pagingQuery
|
|
111
|
-
* @returns {PagingList<Message>}
|
|
110
|
+
* @param {PagingQuery} pagingQuery with list query parameters
|
|
111
|
+
* @returns {PagingList<Message>} containing a list of messages
|
|
112
112
|
*/
|
|
113
113
|
async listMessages(threadId, pagingQuery) {
|
|
114
114
|
return this.native.listMessages(this.servicePtr, [threadId, pagingQuery]);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { VerificationRequest } from "../Types";
|
|
2
|
+
/**
|
|
3
|
+
* An interface consisting of a single verify() method, which - when implemented - should perform verification of the provided data using an external service verification
|
|
4
|
+
* should be done using an external service such as an application server or a PKI server.
|
|
5
|
+
*
|
|
6
|
+
* @type {UserVerifierInterface}
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export interface UserVerifierInterface {
|
|
10
|
+
/**
|
|
11
|
+
* Verifies whether the specified users are valid.
|
|
12
|
+
* Checks if each user belonged to the Context and if this is their key in `date` and return `true` or `false` otherwise.
|
|
13
|
+
*
|
|
14
|
+
* @param request List of user data to verification
|
|
15
|
+
* @returns List of verification results whose items correspond to the items in the input list
|
|
16
|
+
*/
|
|
17
|
+
verify(request: VerificationRequest[]): Promise<boolean[]>;
|
|
18
|
+
}
|
package/service/index.d.ts
CHANGED
|
@@ -2,8 +2,10 @@ import { EndpointFactory } from "./EndpointFactory";
|
|
|
2
2
|
import { ThreadApi } from "./ThreadApi";
|
|
3
3
|
import { StoreApi } from "./StoreApi";
|
|
4
4
|
import { InboxApi } from "./InboxApi";
|
|
5
|
+
import { KvdbApi } from "./KvdbApi";
|
|
5
6
|
import { CryptoApi } from "./CryptoApi";
|
|
6
7
|
import { Connection } from "./Connection";
|
|
7
8
|
import { EventQueue } from "./EventQueue";
|
|
8
9
|
import { BaseApi } from "./BaseApi";
|
|
9
|
-
|
|
10
|
+
import { ExtKey } from "./ExtKey";
|
|
11
|
+
export { EndpointFactory, ThreadApi, StoreApi, InboxApi, KvdbApi, CryptoApi, Connection, EventQueue, BaseApi, ExtKey };
|
package/service/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseApi = exports.EventQueue = exports.Connection = exports.CryptoApi = exports.InboxApi = exports.StoreApi = exports.ThreadApi = exports.EndpointFactory = void 0;
|
|
3
|
+
exports.ExtKey = exports.BaseApi = exports.EventQueue = exports.Connection = exports.CryptoApi = exports.KvdbApi = exports.InboxApi = exports.StoreApi = exports.ThreadApi = exports.EndpointFactory = void 0;
|
|
4
4
|
const EndpointFactory_1 = require("./EndpointFactory");
|
|
5
5
|
Object.defineProperty(exports, "EndpointFactory", { enumerable: true, get: function () { return EndpointFactory_1.EndpointFactory; } });
|
|
6
6
|
const ThreadApi_1 = require("./ThreadApi");
|
|
@@ -9,6 +9,8 @@ const StoreApi_1 = require("./StoreApi");
|
|
|
9
9
|
Object.defineProperty(exports, "StoreApi", { enumerable: true, get: function () { return StoreApi_1.StoreApi; } });
|
|
10
10
|
const InboxApi_1 = require("./InboxApi");
|
|
11
11
|
Object.defineProperty(exports, "InboxApi", { enumerable: true, get: function () { return InboxApi_1.InboxApi; } });
|
|
12
|
+
const KvdbApi_1 = require("./KvdbApi");
|
|
13
|
+
Object.defineProperty(exports, "KvdbApi", { enumerable: true, get: function () { return KvdbApi_1.KvdbApi; } });
|
|
12
14
|
const CryptoApi_1 = require("./CryptoApi");
|
|
13
15
|
Object.defineProperty(exports, "CryptoApi", { enumerable: true, get: function () { return CryptoApi_1.CryptoApi; } });
|
|
14
16
|
const Connection_1 = require("./Connection");
|
|
@@ -17,3 +19,5 @@ const EventQueue_1 = require("./EventQueue");
|
|
|
17
19
|
Object.defineProperty(exports, "EventQueue", { enumerable: true, get: function () { return EventQueue_1.EventQueue; } });
|
|
18
20
|
const BaseApi_1 = require("./BaseApi");
|
|
19
21
|
Object.defineProperty(exports, "BaseApi", { enumerable: true, get: function () { return BaseApi_1.BaseApi; } });
|
|
22
|
+
const ExtKey_1 = require("./ExtKey");
|
|
23
|
+
Object.defineProperty(exports, "ExtKey", { enumerable: true, get: function () { return ExtKey_1.ExtKey; } });
|
|
@@ -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})()));
|