@simplito/privmx-webendpoint 2.3.0 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Types.d.ts CHANGED
@@ -35,6 +35,7 @@ export interface Event {
35
35
  * @param {number} limit limit of elements to return for query
36
36
  * @param {SortOrder} sortOrder Order of elements in result. Use "asc" for ascending, "desc" for descending.
37
37
  * @param {string} [lastId] id of the element from which query results should start
38
+ * @param {string} [sortBy] field name to sort elements by
38
39
  * @param {string} [queryAsJson] extra query parameters in serialized JSON
39
40
  */
40
41
  export interface PagingQuery {
@@ -42,6 +43,7 @@ export interface PagingQuery {
42
43
  limit: number;
43
44
  sortOrder: SortOrder;
44
45
  lastId?: string;
46
+ sortBy?: string;
45
47
  queryAsJson?: string;
46
48
  }
47
49
  /**
@@ -341,6 +343,93 @@ export interface FilesConfig {
341
343
  maxFileSize: number;
342
344
  maxWholeUploadSize: number;
343
345
  }
346
+ /**
347
+ * Holds all available information about a KVDB.
348
+ *
349
+ * @type {Kvdb}
350
+ *
351
+ * @param {string} contextId ID of the Context
352
+ * @param {string} kvdbId ID ot the KVDB
353
+ * @param {number} createDate KVDB creation timestamp
354
+ * @param {string} author ID of the user who created the KVDB
355
+ * @param {number} lastModificationDate KVDB last modification timestamp
356
+ * @param {string} lastModifier ID of the user who last modified the KVDB
357
+ * @param {string[]} users list of users (their IDs) with access to the KVDB
358
+ * @param {string[]} managers list of users (their IDs) with management rights
359
+ * @param {number} version version number (changes on updates)
360
+ * @param {number} lastMsgDate timestamp of last posted message
361
+ * @param {Uint8Array} publicMeta KVDB's public meta data
362
+ * @param {Uint8Array} privateMeta KVDB's private mata data
363
+ * @param {ContainerPolicy} policy KVDB's policies
364
+ * @param {number} entries total number of entries in the KVDB
365
+ * @param {number} statusCode status code of retrival and decryption of the KVDB
366
+ * @param {number} schemaVersion Version of the KVDB data structure and how it is encoded/encrypted
367
+ */
368
+ export interface Kvdb {
369
+ contextId: string;
370
+ kvdbId: string;
371
+ createDate: number;
372
+ creator: string;
373
+ lastModificationDate: number;
374
+ lastModifier: string;
375
+ users: string[];
376
+ managers: string[];
377
+ version: number;
378
+ lastMsgDate: number;
379
+ publicMeta: Uint8Array;
380
+ privateMeta: Uint8Array;
381
+ policy: ContainerPolicy;
382
+ entries: number;
383
+ statusCode: number;
384
+ schemaVersion: number;
385
+ }
386
+ /**
387
+ * Holds information about the KvdbEntry.
388
+ *
389
+ * @type {KvdbEntry}
390
+ *
391
+ * @param {ServerKvdbEntryInfo} info KVDB entry's information created by server
392
+ * @param {Uint8Array} publicMeta KVDB entry's public meta data
393
+ * @param {Uint8Array} privateMeta KVDB entry's private mata data
394
+ * @param {Uint8Array} data KVDB entry's data
395
+ * @param {string} authorPubKey public key of an author of the KVDB entry
396
+ * @param {number} version version of the KVDB entry
397
+ * @param {number} statusCode status code of retrival and decryption of the KVDB entry
398
+ * @param {number} schemaVersion Version of the KVDB entry data structure and how it is encoded/encrypted
399
+ */
400
+ export interface KvdbEntry {
401
+ info: ServerKvdbEntryInfo;
402
+ publicMeta: Uint8Array;
403
+ privateMeta: Uint8Array;
404
+ data: Uint8Array;
405
+ authorPubKey: string;
406
+ version: number;
407
+ statusCode: number;
408
+ schemaVersion: number;
409
+ }
410
+ /**
411
+ * Holds message's information created by server
412
+ *
413
+ * @type {ServerKvdbEntryInfo}
414
+ *
415
+ * @param {string} kvdbId ID of the kvdb
416
+ * @param {string} key KVDB entry's key
417
+ * @param {number} createDate entry creation timestamp
418
+ * @param {string} author ID of the user who created the entry
419
+ *
420
+ */
421
+ export interface ServerKvdbEntryInfo {
422
+ kvdbId: string;
423
+ key: string;
424
+ createDate: number;
425
+ author: string;
426
+ }
427
+ /**
428
+ * Holds information about the entries deletion result.
429
+ *
430
+ * @type {DeleteEntriesResult}
431
+ */
432
+ export type DeleteEntriesResult = Map<string, boolean>;
344
433
  /**
345
434
  * Holds Container policies settings
346
435
  *
@@ -461,3 +550,15 @@ export interface BridgeIdentity {
461
550
  pubKey?: string;
462
551
  instanceId?: string;
463
552
  }
553
+ /**
554
+ * PKI Verification options
555
+ *
556
+ * @type {PKIVerificationOptions}
557
+ *
558
+ * @param {string} [bridgePubKey] Bridge public key
559
+ * @param {string} [bridgeInstanceId] Bridge instance Id given by PKI
560
+ */
561
+ export interface PKIVerificationOptions {
562
+ bridgePubKey?: string;
563
+ bridgeInstanceId?: string;
564
+ }
package/Types.js CHANGED
@@ -28,3 +28,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
28
28
  ;
29
29
  ;
30
30
  ;
31
+ ;
32
+ ;
33
+ ;
34
+ ;
@@ -9,7 +9,7 @@ See the License for the specific language governing permissions and
9
9
  limitations under the License.
10
10
  */
11
11
  import { UserVerifierInterface } from "../service/UserVerifierInterface";
12
- import { PagingQuery, PagingList, Context, UserInfo } from "../Types";
12
+ import { PagingQuery, PagingList, Context, UserInfo, PKIVerificationOptions } from "../Types";
13
13
  import { BaseNative } from "./BaseNative";
14
14
  export declare class ConnectionNative extends BaseNative {
15
15
  protected lastConnectionId: number;
@@ -18,8 +18,8 @@ export declare class ConnectionNative extends BaseNative {
18
18
  deleteApi(ptr: number): Promise<void>;
19
19
  newConnection(): Promise<number>;
20
20
  deleteConnection(ptr: number): Promise<void>;
21
- connect(ptr: number, args: [string, string, string]): Promise<void>;
22
- connectPublic(ptr: number, args: [string, string]): Promise<void>;
21
+ connect(ptr: number, args: [string, string, string, PKIVerificationOptions]): Promise<void>;
22
+ connectPublic(ptr: number, args: [string, string, PKIVerificationOptions]): Promise<void>;
23
23
  getConnectionId(ptr: number, args: []): Promise<number>;
24
24
  listContexts(ptr: number, args: [PagingQuery]): Promise<PagingList<Context>>;
25
25
  getContextUsers(ptr: number, args: [string]): Promise<UserInfo[]>;
@@ -0,0 +1,33 @@
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 { PagingQuery, PagingList, UserWithPubKey, Kvdb, KvdbEntry, ContainerPolicy, DeleteEntriesResult } from "../Types";
12
+ import { BaseNative } from "./BaseNative";
13
+ export declare class KvdbApiNative extends BaseNative {
14
+ newApi(connectionPtr: number): Promise<number>;
15
+ deleteApi(ptr: number): Promise<void>;
16
+ create(ptr: number, args: []): Promise<void>;
17
+ createKvdb(ptr: number, args: [string, UserWithPubKey[], UserWithPubKey[], Uint8Array, Uint8Array, ContainerPolicy | undefined]): Promise<string>;
18
+ updateKvdb(ptr: number, args: [string, UserWithPubKey[], UserWithPubKey[], Uint8Array, Uint8Array, number, boolean, boolean, ContainerPolicy | undefined]): Promise<void>;
19
+ deleteKvdb(ptr: number, args: [string]): Promise<void>;
20
+ getKvdb(ptr: number, args: [string]): Promise<Kvdb>;
21
+ listKvdbs(ptr: number, args: [string, PagingQuery]): Promise<PagingList<Kvdb>>;
22
+ hasEntry(ptr: number, args: [string, string]): Promise<boolean>;
23
+ getEntry(ptr: number, args: [string, string]): Promise<KvdbEntry>;
24
+ listEntriesKeys(ptr: number, args: [string, PagingQuery]): Promise<PagingList<string>>;
25
+ listEntries(ptr: number, args: [string, PagingQuery]): Promise<PagingList<KvdbEntry>>;
26
+ setEntry(ptr: number, args: [string, string, Uint8Array, Uint8Array, Uint8Array, number]): Promise<void>;
27
+ deleteEntry(ptr: number, args: [string, string]): Promise<void>;
28
+ deleteEntries(ptr: number, args: [string, string[]]): Promise<DeleteEntriesResult>;
29
+ subscribeForKvdbEvents(ptr: number, args: []): Promise<void>;
30
+ unsubscribeFromKvdbEvents(ptr: number, args: []): Promise<void>;
31
+ subscribeForEntryEvents(ptr: number, args: [string]): Promise<void>;
32
+ unsubscribeFromEntryEvents(ptr: number, args: [string]): Promise<void>;
33
+ }
@@ -0,0 +1,75 @@
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.KvdbApiNative = void 0;
14
+ const BaseNative_1 = require("./BaseNative");
15
+ class KvdbApiNative extends BaseNative_1.BaseNative {
16
+ async newApi(connectionPtr) {
17
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_newKvdbApi(taskId, connectionPtr));
18
+ }
19
+ async deleteApi(ptr) {
20
+ await this.runAsync((taskId) => this.api.lib.KvdbApi_deleteKvdbApi(taskId, ptr));
21
+ this.deleteApiRef();
22
+ }
23
+ async create(ptr, args) {
24
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_create(taskId, ptr, args));
25
+ }
26
+ async createKvdb(ptr, args) {
27
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_createKvdb(taskId, ptr, args));
28
+ }
29
+ async updateKvdb(ptr, args) {
30
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_updateKvdb(taskId, ptr, args));
31
+ }
32
+ async deleteKvdb(ptr, args) {
33
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_deleteKvdb(taskId, ptr, args));
34
+ }
35
+ async getKvdb(ptr, args) {
36
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_getKvdb(taskId, ptr, args));
37
+ }
38
+ async listKvdbs(ptr, args) {
39
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_listKvdbs(taskId, ptr, args));
40
+ }
41
+ async hasEntry(ptr, args) {
42
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_hasEntry(taskId, ptr, args));
43
+ }
44
+ async getEntry(ptr, args) {
45
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_getEntry(taskId, ptr, args));
46
+ }
47
+ async listEntriesKeys(ptr, args) {
48
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_listEntriesKeys(taskId, ptr, args));
49
+ }
50
+ async listEntries(ptr, args) {
51
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_listEntries(taskId, ptr, args));
52
+ }
53
+ async setEntry(ptr, args) {
54
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_setEntry(taskId, ptr, args));
55
+ }
56
+ async deleteEntry(ptr, args) {
57
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_deleteEntry(taskId, ptr, args));
58
+ }
59
+ async deleteEntries(ptr, args) {
60
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_deleteEntries(taskId, ptr, args));
61
+ }
62
+ async subscribeForKvdbEvents(ptr, args) {
63
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_subscribeForKvdbEvents(taskId, ptr, args));
64
+ }
65
+ async unsubscribeFromKvdbEvents(ptr, args) {
66
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_unsubscribeFromKvdbEvents(taskId, ptr, args));
67
+ }
68
+ async subscribeForEntryEvents(ptr, args) {
69
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_subscribeForEntryEvents(taskId, ptr, args));
70
+ }
71
+ async unsubscribeFromEntryEvents(ptr, args) {
72
+ return this.runAsync((taskId) => this.api.lib.KvdbApi_unsubscribeFromEntryEvents(taskId, ptr, args));
73
+ }
74
+ }
75
+ exports.KvdbApiNative = KvdbApiNative;