@simplito/privmx-webendpoint 2.5.1 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Types.d.ts +98 -2
- package/Types.js +102 -15
- package/api/ConnectionNative.d.ts +18 -2
- package/api/ConnectionNative.js +26 -7
- package/api/EventApiNative.d.ts +4 -3
- package/api/EventApiNative.js +7 -4
- package/api/InboxApiNative.d.ts +4 -5
- package/api/InboxApiNative.js +6 -9
- package/api/KvdbApiNative.d.ts +5 -5
- package/api/KvdbApiNative.js +8 -8
- package/api/StoreApiNative.d.ts +6 -7
- package/api/StoreApiNative.js +6 -9
- package/api/ThreadApiNative.d.ts +4 -5
- package/api/ThreadApiNative.js +6 -9
- package/assets/driver-web-context.js +1 -1
- package/assets/e2ee-worker.js +1 -0
- package/assets/endpoint-wasm-module.js +2 -19
- package/assets/endpoint-wasm-module.wasm +0 -0
- package/assets/privmx-endpoint-web.js +2 -0
- package/bundle/privmx-endpoint-web.js +1 -1
- package/extra/PrivmxClient.d.ts +9 -2
- package/extra/PrivmxClient.js +15 -1
- package/extra/__mocks__/constants.d.ts +63 -0
- package/extra/__mocks__/constants.js +51 -0
- package/extra/__mocks__/mockContainerSubscriber.d.ts +8 -0
- package/extra/__mocks__/mockContainerSubscriber.js +26 -0
- package/extra/{__tests__/__mocks__ → __mocks__}/mockEventQueue.d.ts +1 -3
- package/extra/{__tests__/__mocks__ → __mocks__}/mockEventQueue.js +6 -8
- package/extra/{__tests__/__mocks__ → __mocks__}/utils.d.ts +1 -1
- package/extra/{__tests__/__mocks__ → __mocks__}/utils.js +4 -5
- package/extra/__tests__/eventsManager.test.js +38 -27
- package/extra/__tests__/inboxEventManager.js +79 -0
- package/extra/__tests__/storeEventManager.test.js +48 -28
- package/extra/__tests__/threadEventManager.test.js +49 -29
- package/extra/events.d.ts +4 -217
- package/extra/events.js +25 -213
- package/extra/files.d.ts +2 -2
- package/extra/files.js +2 -2
- package/extra/inbox.js +1 -2
- package/extra/index.d.ts +3 -3
- package/extra/index.js +9 -10
- package/extra/managers.d.ts +98 -0
- package/extra/managers.js +157 -0
- package/extra/subscriptions.d.ts +165 -0
- package/extra/subscriptions.js +51 -0
- package/extra/utils.js +4 -5
- package/index.d.ts +2 -2
- package/index.js +2 -1
- package/package.json +12 -13
- package/service/Connection.d.ts +21 -2
- package/service/Connection.js +27 -2
- package/service/CryptoApi.d.ts +1 -1
- package/service/CryptoApi.js +1 -1
- package/service/EventApi.d.ts +14 -9
- package/service/EventApi.js +35 -10
- package/service/InboxApi.d.ts +14 -13
- package/service/InboxApi.js +42 -17
- package/service/KvdbApi.d.ts +33 -25
- package/service/KvdbApi.js +65 -31
- package/service/StoreApi.d.ts +18 -15
- package/service/StoreApi.js +48 -20
- package/service/ThreadApi.d.ts +14 -13
- package/service/ThreadApi.js +44 -19
- package/service/index.d.ts +2 -1
- package/service/index.js +3 -1
- package/extra/__tests__/__mocks__/constants.d.ts +0 -36
- package/extra/__tests__/__mocks__/constants.js +0 -42
- package/extra/__tests__/__mocks__/mockContainerSubscriber.d.ts +0 -12
- package/extra/__tests__/__mocks__/mockContainerSubscriber.js +0 -25
- package/extra/__tests__/__mocks__/mockEventAPIs.d.ts +0 -30
- package/extra/__tests__/__mocks__/mockEventAPIs.js +0 -70
- package/extra/__tests__/inboxEventManager.test.js +0 -56
- /package/extra/__tests__/{inboxEventManager.test.d.ts → inboxEventManager.d.ts} +0 -0
package/Types.d.ts
CHANGED
|
@@ -25,6 +25,9 @@ export interface Event {
|
|
|
25
25
|
channel: string;
|
|
26
26
|
connectionId: number;
|
|
27
27
|
data?: unknown;
|
|
28
|
+
subscriptions: string[];
|
|
29
|
+
version: number;
|
|
30
|
+
timestamp: number;
|
|
28
31
|
}
|
|
29
32
|
/**
|
|
30
33
|
* Contains query parameters for methods returning lists (PagingList)
|
|
@@ -86,17 +89,31 @@ export interface UserWithPubKey {
|
|
|
86
89
|
pubKey: string;
|
|
87
90
|
}
|
|
88
91
|
/**
|
|
89
|
-
* Contains
|
|
92
|
+
* Contains information about the change of user status.
|
|
93
|
+
*
|
|
94
|
+
* @type {UserStatusChange}
|
|
95
|
+
*
|
|
96
|
+
* @param {string} action User status change action, which can be "login" or "logout"
|
|
97
|
+
* @param {string} timestamp Timestamp of the change
|
|
98
|
+
*/
|
|
99
|
+
export interface UserStatusChange {
|
|
100
|
+
action: string;
|
|
101
|
+
timestamp: number;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Contains Information about user, their status, and the last status change.
|
|
90
105
|
*
|
|
91
106
|
* @type {UserInfo}
|
|
92
107
|
*
|
|
93
108
|
* @param {UserWithPubKey} user User publicKey and userId
|
|
94
109
|
* @param {boolean} isActive is user connected to the Bridge
|
|
110
|
+
* @param {UserStatusChange} lastStatusChange User last status change or no value if they have never logged in
|
|
95
111
|
*
|
|
96
112
|
*/
|
|
97
113
|
export interface UserInfo {
|
|
98
114
|
user: UserWithPubKey;
|
|
99
115
|
isActive: boolean;
|
|
116
|
+
lastStatusChange?: UserStatusChange;
|
|
100
117
|
}
|
|
101
118
|
/**
|
|
102
119
|
* Holds all available information about a Thread.
|
|
@@ -361,7 +378,7 @@ export interface FilesConfig {
|
|
|
361
378
|
* @param {Uint8Array} publicMeta KVDB's public meta data
|
|
362
379
|
* @param {Uint8Array} privateMeta KVDB's private mata data
|
|
363
380
|
* @param {ContainerPolicy} policy KVDB's policies
|
|
364
|
-
* @param {number} entries total number of
|
|
381
|
+
* @param {number} entries total number of entries in the KVDB
|
|
365
382
|
* @param {number} statusCode status code of retrival and decryption of the KVDB
|
|
366
383
|
* @param {number} schemaVersion Version of the KVDB data structure and how it is encoded/encrypted
|
|
367
384
|
*/
|
|
@@ -562,3 +579,82 @@ export interface PKIVerificationOptions {
|
|
|
562
579
|
bridgePubKey?: string;
|
|
563
580
|
bridgeInstanceId?: string;
|
|
564
581
|
}
|
|
582
|
+
export declare enum ConnectionEventType {
|
|
583
|
+
USER_ADD = 0,
|
|
584
|
+
USER_REMOVE = 1,
|
|
585
|
+
USER_STATUS = 2
|
|
586
|
+
}
|
|
587
|
+
export declare enum ConnectionEventSelectorType {
|
|
588
|
+
CONTEXT_ID = 0
|
|
589
|
+
}
|
|
590
|
+
export declare enum StoreEventType {
|
|
591
|
+
STORE_CREATE = 0,
|
|
592
|
+
STORE_UPDATE = 1,
|
|
593
|
+
STORE_DELETE = 2,
|
|
594
|
+
STORE_STATS = 3,
|
|
595
|
+
FILE_CREATE = 4,
|
|
596
|
+
FILE_UPDATE = 5,
|
|
597
|
+
FILE_DELETE = 6,
|
|
598
|
+
COLLECTION_CHANGE = 7
|
|
599
|
+
}
|
|
600
|
+
export declare enum StoreEventSelectorType {
|
|
601
|
+
CONTEXT_ID = 0,
|
|
602
|
+
STORE_ID = 1,
|
|
603
|
+
FILE_ID = 2
|
|
604
|
+
}
|
|
605
|
+
export declare enum ThreadEventType {
|
|
606
|
+
THREAD_CREATE = 0,
|
|
607
|
+
THREAD_UPDATE = 1,
|
|
608
|
+
THREAD_DELETE = 2,
|
|
609
|
+
THREAD_STATS = 3,
|
|
610
|
+
MESSAGE_CREATE = 4,
|
|
611
|
+
MESSAGE_UPDATE = 5,
|
|
612
|
+
MESSAGE_DELETE = 6,
|
|
613
|
+
COLLECTION_CHANGE = 7
|
|
614
|
+
}
|
|
615
|
+
export declare enum ThreadEventSelectorType {
|
|
616
|
+
CONTEXT_ID = 0,
|
|
617
|
+
THREAD_ID = 1,
|
|
618
|
+
MESSAGE_ID = 2
|
|
619
|
+
}
|
|
620
|
+
export declare enum InboxEventType {
|
|
621
|
+
INBOX_CREATE = 0,
|
|
622
|
+
INBOX_UPDATE = 1,
|
|
623
|
+
INBOX_DELETE = 2,
|
|
624
|
+
ENTRY_CREATE = 3,
|
|
625
|
+
ENTRY_DELETE = 4,
|
|
626
|
+
COLLECTION_CHANGE = 5
|
|
627
|
+
}
|
|
628
|
+
export declare enum InboxEventSelectorType {
|
|
629
|
+
CONTEXT_ID = 0,
|
|
630
|
+
INBOX_ID = 1,
|
|
631
|
+
ENTRY_ID = 2
|
|
632
|
+
}
|
|
633
|
+
export declare enum KvdbEventType {
|
|
634
|
+
KVDB_CREATE = 0,
|
|
635
|
+
KVDB_UPDATE = 1,
|
|
636
|
+
KVDB_DELETE = 2,
|
|
637
|
+
KVDB_STATS = 3,
|
|
638
|
+
ENTRY_CREATE = 4,
|
|
639
|
+
ENTRY_UPDATE = 5,
|
|
640
|
+
ENTRY_DELETE = 6,
|
|
641
|
+
COLLECTION_CHANGE = 7
|
|
642
|
+
}
|
|
643
|
+
export declare enum KvdbEventSelectorType {
|
|
644
|
+
CONTEXT_ID = 0,
|
|
645
|
+
KVDB_ID = 1,
|
|
646
|
+
ENTRY_ID = 2
|
|
647
|
+
}
|
|
648
|
+
export declare enum EventsEventSelectorType {
|
|
649
|
+
CONTEXT_ID = 0
|
|
650
|
+
}
|
|
651
|
+
export type CollectionItemChange = {
|
|
652
|
+
itemId: string;
|
|
653
|
+
action: string;
|
|
654
|
+
};
|
|
655
|
+
export type CollectionChangedEventData = {
|
|
656
|
+
moduleType: string;
|
|
657
|
+
moduleId: string;
|
|
658
|
+
affectedItemsCount: number;
|
|
659
|
+
items: CollectionItemChange;
|
|
660
|
+
};
|
package/Types.js
CHANGED
|
@@ -10,25 +10,112 @@ 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.EventsEventSelectorType = exports.KvdbEventSelectorType = exports.KvdbEventType = exports.InboxEventSelectorType = exports.InboxEventType = exports.ThreadEventSelectorType = exports.ThreadEventType = exports.StoreEventSelectorType = exports.StoreEventType = exports.ConnectionEventSelectorType = exports.ConnectionEventType = void 0;
|
|
13
14
|
;
|
|
14
15
|
;
|
|
15
16
|
;
|
|
16
17
|
;
|
|
17
18
|
;
|
|
18
19
|
;
|
|
19
|
-
;
|
|
20
|
-
;
|
|
21
|
-
;
|
|
22
|
-
;
|
|
23
|
-
;
|
|
24
|
-
;
|
|
25
|
-
;
|
|
26
|
-
;
|
|
27
|
-
;
|
|
28
|
-
;
|
|
29
|
-
;
|
|
30
|
-
;
|
|
31
|
-
;
|
|
32
|
-
;
|
|
33
|
-
;
|
|
20
|
+
;
|
|
21
|
+
;
|
|
22
|
+
;
|
|
23
|
+
;
|
|
24
|
+
;
|
|
25
|
+
;
|
|
26
|
+
;
|
|
27
|
+
;
|
|
28
|
+
;
|
|
29
|
+
;
|
|
30
|
+
;
|
|
31
|
+
;
|
|
32
|
+
;
|
|
33
|
+
;
|
|
34
|
+
;
|
|
35
|
+
;
|
|
36
|
+
// Enums
|
|
37
|
+
var ConnectionEventType;
|
|
38
|
+
(function (ConnectionEventType) {
|
|
39
|
+
ConnectionEventType[ConnectionEventType["USER_ADD"] = 0] = "USER_ADD";
|
|
40
|
+
ConnectionEventType[ConnectionEventType["USER_REMOVE"] = 1] = "USER_REMOVE";
|
|
41
|
+
ConnectionEventType[ConnectionEventType["USER_STATUS"] = 2] = "USER_STATUS";
|
|
42
|
+
})(ConnectionEventType || (exports.ConnectionEventType = ConnectionEventType = {}));
|
|
43
|
+
var ConnectionEventSelectorType;
|
|
44
|
+
(function (ConnectionEventSelectorType) {
|
|
45
|
+
ConnectionEventSelectorType[ConnectionEventSelectorType["CONTEXT_ID"] = 0] = "CONTEXT_ID";
|
|
46
|
+
})(ConnectionEventSelectorType || (exports.ConnectionEventSelectorType = ConnectionEventSelectorType = {}));
|
|
47
|
+
var StoreEventType;
|
|
48
|
+
(function (StoreEventType) {
|
|
49
|
+
StoreEventType[StoreEventType["STORE_CREATE"] = 0] = "STORE_CREATE";
|
|
50
|
+
StoreEventType[StoreEventType["STORE_UPDATE"] = 1] = "STORE_UPDATE";
|
|
51
|
+
StoreEventType[StoreEventType["STORE_DELETE"] = 2] = "STORE_DELETE";
|
|
52
|
+
StoreEventType[StoreEventType["STORE_STATS"] = 3] = "STORE_STATS";
|
|
53
|
+
StoreEventType[StoreEventType["FILE_CREATE"] = 4] = "FILE_CREATE";
|
|
54
|
+
StoreEventType[StoreEventType["FILE_UPDATE"] = 5] = "FILE_UPDATE";
|
|
55
|
+
StoreEventType[StoreEventType["FILE_DELETE"] = 6] = "FILE_DELETE";
|
|
56
|
+
StoreEventType[StoreEventType["COLLECTION_CHANGE"] = 7] = "COLLECTION_CHANGE";
|
|
57
|
+
})(StoreEventType || (exports.StoreEventType = StoreEventType = {}));
|
|
58
|
+
var StoreEventSelectorType;
|
|
59
|
+
(function (StoreEventSelectorType) {
|
|
60
|
+
StoreEventSelectorType[StoreEventSelectorType["CONTEXT_ID"] = 0] = "CONTEXT_ID";
|
|
61
|
+
StoreEventSelectorType[StoreEventSelectorType["STORE_ID"] = 1] = "STORE_ID";
|
|
62
|
+
StoreEventSelectorType[StoreEventSelectorType["FILE_ID"] = 2] = "FILE_ID";
|
|
63
|
+
})(StoreEventSelectorType || (exports.StoreEventSelectorType = StoreEventSelectorType = {}));
|
|
64
|
+
var ThreadEventType;
|
|
65
|
+
(function (ThreadEventType) {
|
|
66
|
+
ThreadEventType[ThreadEventType["THREAD_CREATE"] = 0] = "THREAD_CREATE";
|
|
67
|
+
ThreadEventType[ThreadEventType["THREAD_UPDATE"] = 1] = "THREAD_UPDATE";
|
|
68
|
+
ThreadEventType[ThreadEventType["THREAD_DELETE"] = 2] = "THREAD_DELETE";
|
|
69
|
+
ThreadEventType[ThreadEventType["THREAD_STATS"] = 3] = "THREAD_STATS";
|
|
70
|
+
ThreadEventType[ThreadEventType["MESSAGE_CREATE"] = 4] = "MESSAGE_CREATE";
|
|
71
|
+
ThreadEventType[ThreadEventType["MESSAGE_UPDATE"] = 5] = "MESSAGE_UPDATE";
|
|
72
|
+
ThreadEventType[ThreadEventType["MESSAGE_DELETE"] = 6] = "MESSAGE_DELETE";
|
|
73
|
+
ThreadEventType[ThreadEventType["COLLECTION_CHANGE"] = 7] = "COLLECTION_CHANGE";
|
|
74
|
+
})(ThreadEventType || (exports.ThreadEventType = ThreadEventType = {}));
|
|
75
|
+
var ThreadEventSelectorType;
|
|
76
|
+
(function (ThreadEventSelectorType) {
|
|
77
|
+
ThreadEventSelectorType[ThreadEventSelectorType["CONTEXT_ID"] = 0] = "CONTEXT_ID";
|
|
78
|
+
ThreadEventSelectorType[ThreadEventSelectorType["THREAD_ID"] = 1] = "THREAD_ID";
|
|
79
|
+
ThreadEventSelectorType[ThreadEventSelectorType["MESSAGE_ID"] = 2] = "MESSAGE_ID";
|
|
80
|
+
})(ThreadEventSelectorType || (exports.ThreadEventSelectorType = ThreadEventSelectorType = {}));
|
|
81
|
+
var InboxEventType;
|
|
82
|
+
(function (InboxEventType) {
|
|
83
|
+
InboxEventType[InboxEventType["INBOX_CREATE"] = 0] = "INBOX_CREATE";
|
|
84
|
+
InboxEventType[InboxEventType["INBOX_UPDATE"] = 1] = "INBOX_UPDATE";
|
|
85
|
+
InboxEventType[InboxEventType["INBOX_DELETE"] = 2] = "INBOX_DELETE";
|
|
86
|
+
InboxEventType[InboxEventType["ENTRY_CREATE"] = 3] = "ENTRY_CREATE";
|
|
87
|
+
InboxEventType[InboxEventType["ENTRY_DELETE"] = 4] = "ENTRY_DELETE";
|
|
88
|
+
InboxEventType[InboxEventType["COLLECTION_CHANGE"] = 5] = "COLLECTION_CHANGE";
|
|
89
|
+
})(InboxEventType || (exports.InboxEventType = InboxEventType = {}));
|
|
90
|
+
;
|
|
91
|
+
var InboxEventSelectorType;
|
|
92
|
+
(function (InboxEventSelectorType) {
|
|
93
|
+
InboxEventSelectorType[InboxEventSelectorType["CONTEXT_ID"] = 0] = "CONTEXT_ID";
|
|
94
|
+
InboxEventSelectorType[InboxEventSelectorType["INBOX_ID"] = 1] = "INBOX_ID";
|
|
95
|
+
InboxEventSelectorType[InboxEventSelectorType["ENTRY_ID"] = 2] = "ENTRY_ID";
|
|
96
|
+
})(InboxEventSelectorType || (exports.InboxEventSelectorType = InboxEventSelectorType = {}));
|
|
97
|
+
;
|
|
98
|
+
var KvdbEventType;
|
|
99
|
+
(function (KvdbEventType) {
|
|
100
|
+
KvdbEventType[KvdbEventType["KVDB_CREATE"] = 0] = "KVDB_CREATE";
|
|
101
|
+
KvdbEventType[KvdbEventType["KVDB_UPDATE"] = 1] = "KVDB_UPDATE";
|
|
102
|
+
KvdbEventType[KvdbEventType["KVDB_DELETE"] = 2] = "KVDB_DELETE";
|
|
103
|
+
KvdbEventType[KvdbEventType["KVDB_STATS"] = 3] = "KVDB_STATS";
|
|
104
|
+
KvdbEventType[KvdbEventType["ENTRY_CREATE"] = 4] = "ENTRY_CREATE";
|
|
105
|
+
KvdbEventType[KvdbEventType["ENTRY_UPDATE"] = 5] = "ENTRY_UPDATE";
|
|
106
|
+
KvdbEventType[KvdbEventType["ENTRY_DELETE"] = 6] = "ENTRY_DELETE";
|
|
107
|
+
KvdbEventType[KvdbEventType["COLLECTION_CHANGE"] = 7] = "COLLECTION_CHANGE";
|
|
108
|
+
})(KvdbEventType || (exports.KvdbEventType = KvdbEventType = {}));
|
|
109
|
+
;
|
|
110
|
+
var KvdbEventSelectorType;
|
|
111
|
+
(function (KvdbEventSelectorType) {
|
|
112
|
+
KvdbEventSelectorType[KvdbEventSelectorType["CONTEXT_ID"] = 0] = "CONTEXT_ID";
|
|
113
|
+
KvdbEventSelectorType[KvdbEventSelectorType["KVDB_ID"] = 1] = "KVDB_ID";
|
|
114
|
+
KvdbEventSelectorType[KvdbEventSelectorType["ENTRY_ID"] = 2] = "ENTRY_ID";
|
|
115
|
+
})(KvdbEventSelectorType || (exports.KvdbEventSelectorType = KvdbEventSelectorType = {}));
|
|
116
|
+
;
|
|
117
|
+
var EventsEventSelectorType;
|
|
118
|
+
(function (EventsEventSelectorType) {
|
|
119
|
+
EventsEventSelectorType[EventsEventSelectorType["CONTEXT_ID"] = 0] = "CONTEXT_ID";
|
|
120
|
+
})(EventsEventSelectorType || (exports.EventsEventSelectorType = EventsEventSelectorType = {}));
|
|
34
121
|
;
|
|
@@ -9,11 +9,23 @@ 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, PKIVerificationOptions } from "../Types";
|
|
12
|
+
import { PagingQuery, PagingList, Context, UserInfo, VerificationRequest, PKIVerificationOptions, ConnectionEventType, ConnectionEventSelectorType } from "../Types";
|
|
13
13
|
import { BaseNative } from "./BaseNative";
|
|
14
|
+
type UserVierifierVerifyFunc = (request: VerificationRequest[]) => Promise<boolean[]>;
|
|
15
|
+
declare global {
|
|
16
|
+
interface Window {
|
|
17
|
+
userVerifierBinder?: {
|
|
18
|
+
[id: number]: {
|
|
19
|
+
userVierifier_verify: UserVierifierVerifyFunc;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
14
24
|
export declare class ConnectionNative extends BaseNative {
|
|
15
25
|
protected lastConnectionId: number;
|
|
16
26
|
protected userVerifierPtr: number;
|
|
27
|
+
protected static verifierBindingId: number;
|
|
28
|
+
protected static getVerifierBindingId(): number;
|
|
17
29
|
protected newApi(_connectionPtr: number): Promise<number>;
|
|
18
30
|
deleteApi(ptr: number): Promise<void>;
|
|
19
31
|
newConnection(): Promise<number>;
|
|
@@ -22,9 +34,13 @@ export declare class ConnectionNative extends BaseNative {
|
|
|
22
34
|
connectPublic(ptr: number, args: [string, string, PKIVerificationOptions]): Promise<void>;
|
|
23
35
|
getConnectionId(ptr: number, args: []): Promise<number>;
|
|
24
36
|
listContexts(ptr: number, args: [PagingQuery]): Promise<PagingList<Context>>;
|
|
25
|
-
|
|
37
|
+
listContextUsers(ptr: number, args: [string, PagingQuery]): Promise<PagingList<UserInfo>>;
|
|
38
|
+
subscribeFor(ptr: number, args: [string[]]): Promise<string[]>;
|
|
39
|
+
unsubscribeFrom(ptr: number, args: [string[]]): Promise<void>;
|
|
40
|
+
buildSubscriptionQuery(ptr: number, args: [ConnectionEventType, ConnectionEventSelectorType, string]): Promise<string>;
|
|
26
41
|
disconnect(ptr: number, args: []): Promise<void>;
|
|
27
42
|
setUserVerifier(_ptr: number, args: [number, UserVerifierInterface]): Promise<void>;
|
|
28
43
|
protected newUserVerifierInterface(connectionPtr: number): Promise<number>;
|
|
29
44
|
protected deleteUserVerifierInterface(ptr: number): Promise<void>;
|
|
30
45
|
}
|
|
46
|
+
export {};
|
package/api/ConnectionNative.js
CHANGED
|
@@ -15,6 +15,10 @@ const BaseNative_1 = require("./BaseNative");
|
|
|
15
15
|
class ConnectionNative extends BaseNative_1.BaseNative {
|
|
16
16
|
lastConnectionId = -1;
|
|
17
17
|
userVerifierPtr = -1;
|
|
18
|
+
static verifierBindingId = -1;
|
|
19
|
+
static getVerifierBindingId() {
|
|
20
|
+
return ++this.verifierBindingId;
|
|
21
|
+
}
|
|
18
22
|
async newApi(_connectionPtr) {
|
|
19
23
|
throw new Error("Use the newConnection() - specialized version of method instead.");
|
|
20
24
|
}
|
|
@@ -45,8 +49,17 @@ class ConnectionNative extends BaseNative_1.BaseNative {
|
|
|
45
49
|
async listContexts(ptr, args) {
|
|
46
50
|
return this.runAsync((taskId) => this.api.lib.Connection_listContexts(taskId, ptr, args));
|
|
47
51
|
}
|
|
48
|
-
async
|
|
49
|
-
return this.runAsync((taskId) => this.api.lib.
|
|
52
|
+
async listContextUsers(ptr, args) {
|
|
53
|
+
return this.runAsync((taskId) => this.api.lib.Connection_listContextUsers(taskId, ptr, args));
|
|
54
|
+
}
|
|
55
|
+
async subscribeFor(ptr, args) {
|
|
56
|
+
return this.runAsync((taskId) => this.api.lib.Connection_subscribeFor(taskId, ptr, args));
|
|
57
|
+
}
|
|
58
|
+
async unsubscribeFrom(ptr, args) {
|
|
59
|
+
return this.runAsync((taskId) => this.api.lib.Connection_unsubscribeFrom(taskId, ptr, args));
|
|
60
|
+
}
|
|
61
|
+
async buildSubscriptionQuery(ptr, args) {
|
|
62
|
+
return this.runAsync((taskId) => this.api.lib.Connection_buildSubscriptionQuery(taskId, ptr, args));
|
|
50
63
|
}
|
|
51
64
|
async disconnect(ptr, args) {
|
|
52
65
|
await this.runAsync((taskId) => this.api.lib.Connection_disconnect(taskId, ptr, args));
|
|
@@ -57,13 +70,19 @@ class ConnectionNative extends BaseNative_1.BaseNative {
|
|
|
57
70
|
this.userVerifierPtr = -1;
|
|
58
71
|
}
|
|
59
72
|
const [connectionPtr, verifierInterface] = args;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
73
|
+
const bindingId = ConnectionNative.getVerifierBindingId();
|
|
74
|
+
if (!window.userVerifierBinder) {
|
|
75
|
+
window.userVerifierBinder = {};
|
|
76
|
+
}
|
|
77
|
+
window.userVerifierBinder[bindingId] = {
|
|
78
|
+
userVierifier_verify: async (request) => {
|
|
79
|
+
if (verifierInterface && typeof verifierInterface.verify === "function") {
|
|
80
|
+
return verifierInterface.verify(request);
|
|
81
|
+
}
|
|
82
|
+
throw new Error("Call on UserVerifierInterface with missing implementation");
|
|
63
83
|
}
|
|
64
|
-
throw new Error("Call on UserVerifierInterface with missing implementation");
|
|
65
84
|
};
|
|
66
|
-
this.userVerifierPtr = await this.runAsync((taskId) => this.api.lib.Connection_newUserVerifierInterface(taskId, connectionPtr));
|
|
85
|
+
this.userVerifierPtr = await this.runAsync((taskId) => this.api.lib.Connection_newUserVerifierInterface(taskId, connectionPtr, bindingId));
|
|
67
86
|
}
|
|
68
87
|
async newUserVerifierInterface(connectionPtr) {
|
|
69
88
|
return this.runAsync((taskId) => this.api.lib.Connection_newUserVerifierInterface(taskId, connectionPtr));
|
package/api/EventApiNative.d.ts
CHANGED
|
@@ -8,13 +8,14 @@ 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 { UserWithPubKey } from "../Types";
|
|
11
|
+
import { EventsEventSelectorType, UserWithPubKey } from "../Types";
|
|
12
12
|
import { BaseNative } from "./BaseNative";
|
|
13
13
|
export declare class EventApiNative extends BaseNative {
|
|
14
14
|
newApi(connectionPtr: number): Promise<number>;
|
|
15
15
|
deleteApi(ptr: number): Promise<void>;
|
|
16
16
|
create(ptr: number, args: []): Promise<void>;
|
|
17
17
|
emitEvent(ptr: number, args: [string, string, Uint8Array, UserWithPubKey[]]): Promise<void>;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
subscribeFor(ptr: number, args: [string[]]): Promise<string[]>;
|
|
19
|
+
unsubscribeFrom(ptr: number, args: [string[]]): Promise<void>;
|
|
20
|
+
buildSubscriptionQuery(ptr: number, args: [string, EventsEventSelectorType, string]): Promise<string>;
|
|
20
21
|
}
|
package/api/EventApiNative.js
CHANGED
|
@@ -26,11 +26,14 @@ class EventApiNative extends BaseNative_1.BaseNative {
|
|
|
26
26
|
async emitEvent(ptr, args) {
|
|
27
27
|
return this.runAsync((taskId) => this.api.lib.EventApi_emitEvent(taskId, ptr, args));
|
|
28
28
|
}
|
|
29
|
-
async
|
|
30
|
-
return this.runAsync((taskId) => this.api.lib.
|
|
29
|
+
async subscribeFor(ptr, args) {
|
|
30
|
+
return this.runAsync((taskId) => this.api.lib.EventApi_subscribeFor(taskId, ptr, args));
|
|
31
31
|
}
|
|
32
|
-
async
|
|
33
|
-
return this.runAsync((taskId) => this.api.lib.
|
|
32
|
+
async unsubscribeFrom(ptr, args) {
|
|
33
|
+
return this.runAsync((taskId) => this.api.lib.EventApi_unsubscribeFrom(taskId, ptr, args));
|
|
34
|
+
}
|
|
35
|
+
async buildSubscriptionQuery(ptr, args) {
|
|
36
|
+
return this.runAsync((taskId) => this.api.lib.EventApi_buildSubscriptionQuery(taskId, ptr, args));
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
39
|
exports.EventApiNative = EventApiNative;
|
package/api/InboxApiNative.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ 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 { PagingQuery, PagingList, UserWithPubKey, Inbox, InboxPublicView, InboxEntry, FilesConfig, ContainerWithoutItemPolicy } from "../Types";
|
|
11
|
+
import { PagingQuery, PagingList, UserWithPubKey, Inbox, InboxPublicView, InboxEntry, FilesConfig, ContainerWithoutItemPolicy, InboxEventType, InboxEventSelectorType } from "../Types";
|
|
12
12
|
import { BaseNative } from "./BaseNative";
|
|
13
13
|
export declare class InboxApiNative extends BaseNative {
|
|
14
14
|
newApi(connectionPtr: number, threadApiPtr: number, storeApiPtr: number): Promise<number>;
|
|
@@ -31,8 +31,7 @@ export declare class InboxApiNative extends BaseNative {
|
|
|
31
31
|
readFromFile(ptr: number, args: [number, number]): Promise<Uint8Array>;
|
|
32
32
|
seekInFile(ptr: number, args: [number, number]): Promise<void>;
|
|
33
33
|
closeFile(ptr: number, args: [number]): Promise<string>;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
unsubscribeFromEntryEvents(ptr: number, args: [string]): Promise<void>;
|
|
34
|
+
subscribeFor(ptr: number, args: [string[]]): Promise<string[]>;
|
|
35
|
+
unsubscribeFrom(ptr: number, args: [string[]]): Promise<void>;
|
|
36
|
+
buildSubscriptionQuery(ptr: number, args: [InboxEventType, InboxEventSelectorType, string]): Promise<string>;
|
|
38
37
|
}
|
package/api/InboxApiNative.js
CHANGED
|
@@ -74,17 +74,14 @@ class InboxApiNative extends BaseNative_1.BaseNative {
|
|
|
74
74
|
async closeFile(ptr, args) {
|
|
75
75
|
return this.runAsync((taskId) => this.api.lib.InboxApi_closeFile(taskId, ptr, args));
|
|
76
76
|
}
|
|
77
|
-
async
|
|
78
|
-
return this.runAsync((taskId) => this.api.lib.
|
|
77
|
+
async subscribeFor(ptr, args) {
|
|
78
|
+
return this.runAsync((taskId) => this.api.lib.InboxApi_subscribeFor(taskId, ptr, args));
|
|
79
79
|
}
|
|
80
|
-
async
|
|
81
|
-
return this.runAsync((taskId) => this.api.lib.
|
|
80
|
+
async unsubscribeFrom(ptr, args) {
|
|
81
|
+
return this.runAsync((taskId) => this.api.lib.InboxApi_unsubscribeFrom(taskId, ptr, args));
|
|
82
82
|
}
|
|
83
|
-
async
|
|
84
|
-
return this.runAsync((taskId) => this.api.lib.
|
|
85
|
-
}
|
|
86
|
-
async unsubscribeFromEntryEvents(ptr, args) {
|
|
87
|
-
return this.runAsync((taskId) => this.api.lib.InboxApi_unsubscribeFromEntryEvents(taskId, ptr, args));
|
|
83
|
+
async buildSubscriptionQuery(ptr, args) {
|
|
84
|
+
return this.runAsync((taskId) => this.api.lib.InboxApi_buildSubscriptionQuery(taskId, ptr, args));
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
87
|
exports.InboxApiNative = InboxApiNative;
|
package/api/KvdbApiNative.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ 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 { PagingQuery, PagingList, UserWithPubKey, Kvdb, KvdbEntry, ContainerPolicy, DeleteEntriesResult } from "../Types";
|
|
11
|
+
import { PagingQuery, PagingList, UserWithPubKey, Kvdb, KvdbEntry, ContainerPolicy, DeleteEntriesResult, KvdbEventSelectorType, KvdbEventType } from "../Types";
|
|
12
12
|
import { BaseNative } from "./BaseNative";
|
|
13
13
|
export declare class KvdbApiNative extends BaseNative {
|
|
14
14
|
newApi(connectionPtr: number): Promise<number>;
|
|
@@ -26,8 +26,8 @@ export declare class KvdbApiNative extends BaseNative {
|
|
|
26
26
|
setEntry(ptr: number, args: [string, string, Uint8Array, Uint8Array, Uint8Array, number]): Promise<void>;
|
|
27
27
|
deleteEntry(ptr: number, args: [string, string]): Promise<void>;
|
|
28
28
|
deleteEntries(ptr: number, args: [string, string[]]): Promise<DeleteEntriesResult>;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
subscribeFor(ptr: number, args: [string[]]): Promise<string[]>;
|
|
30
|
+
unsubscribeFrom(ptr: number, args: [string[]]): Promise<void>;
|
|
31
|
+
buildSubscriptionQuery(ptr: number, args: [KvdbEventType, KvdbEventSelectorType, string]): Promise<string>;
|
|
32
|
+
buildSubscriptionQueryForSelectedEntry(ptr: number, args: [KvdbEventType, string, string]): Promise<string>;
|
|
33
33
|
}
|
package/api/KvdbApiNative.js
CHANGED
|
@@ -59,17 +59,17 @@ class KvdbApiNative extends BaseNative_1.BaseNative {
|
|
|
59
59
|
async deleteEntries(ptr, args) {
|
|
60
60
|
return this.runAsync((taskId) => this.api.lib.KvdbApi_deleteEntries(taskId, ptr, args));
|
|
61
61
|
}
|
|
62
|
-
async
|
|
63
|
-
return this.runAsync((taskId) => this.api.lib.
|
|
62
|
+
async subscribeFor(ptr, args) {
|
|
63
|
+
return this.runAsync((taskId) => this.api.lib.KvdbApi_subscribeFor(taskId, ptr, args));
|
|
64
64
|
}
|
|
65
|
-
async
|
|
66
|
-
return this.runAsync((taskId) => this.api.lib.
|
|
65
|
+
async unsubscribeFrom(ptr, args) {
|
|
66
|
+
return this.runAsync((taskId) => this.api.lib.KvdbApi_unsubscribeFrom(taskId, ptr, args));
|
|
67
67
|
}
|
|
68
|
-
async
|
|
69
|
-
return this.runAsync((taskId) => this.api.lib.
|
|
68
|
+
async buildSubscriptionQuery(ptr, args) {
|
|
69
|
+
return this.runAsync((taskId) => this.api.lib.KvdbApi_buildSubscriptionQuery(taskId, ptr, args));
|
|
70
70
|
}
|
|
71
|
-
async
|
|
72
|
-
return this.runAsync((taskId) => this.api.lib.
|
|
71
|
+
async buildSubscriptionQueryForSelectedEntry(ptr, args) {
|
|
72
|
+
return this.runAsync((taskId) => this.api.lib.KvdbApi_buildSubscriptionQueryForSelectedEntry(taskId, ptr, args));
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
exports.KvdbApiNative = KvdbApiNative;
|
package/api/StoreApiNative.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ 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 { PagingQuery, PagingList, UserWithPubKey, Store, File, ContainerPolicy } from "../Types";
|
|
11
|
+
import { PagingQuery, PagingList, UserWithPubKey, Store, File, ContainerPolicy, StoreEventSelectorType, StoreEventType } from "../Types";
|
|
12
12
|
import { BaseNative } from "./BaseNative";
|
|
13
13
|
export declare class StoreApiNative extends BaseNative {
|
|
14
14
|
newApi(connectionPtr: number): Promise<number>;
|
|
@@ -19,10 +19,10 @@ export declare class StoreApiNative extends BaseNative {
|
|
|
19
19
|
deleteStore(ptr: number, args: [string]): Promise<void>;
|
|
20
20
|
getStore(ptr: number, args: [string]): Promise<Store>;
|
|
21
21
|
listStores(ptr: number, args: [string, PagingQuery]): Promise<PagingList<Store>>;
|
|
22
|
-
createFile(ptr: number, args: [string, Uint8Array, Uint8Array, number]): Promise<number>;
|
|
22
|
+
createFile(ptr: number, args: [string, Uint8Array, Uint8Array, number, boolean]): Promise<number>;
|
|
23
23
|
updateFile(ptr: number, args: [string, Uint8Array, Uint8Array, number]): Promise<number>;
|
|
24
24
|
updateFileMeta(ptr: number, args: [string, Uint8Array, Uint8Array]): Promise<void>;
|
|
25
|
-
writeToFile(ptr: number, args: [number, Uint8Array]): Promise<void>;
|
|
25
|
+
writeToFile(ptr: number, args: [number, Uint8Array, boolean]): Promise<void>;
|
|
26
26
|
deleteFile(ptr: number, args: [string]): Promise<void>;
|
|
27
27
|
getFile(ptr: number, args: [string]): Promise<File>;
|
|
28
28
|
listFiles(ptr: number, args: [string, PagingQuery]): Promise<PagingList<File>>;
|
|
@@ -30,8 +30,7 @@ export declare class StoreApiNative extends BaseNative {
|
|
|
30
30
|
readFromFile(ptr: number, args: [number, number]): Promise<Uint8Array>;
|
|
31
31
|
seekInFile(ptr: number, args: [number, number]): Promise<void>;
|
|
32
32
|
closeFile(ptr: number, args: [number]): Promise<string>;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
unsubscribeFromFileEvents(ptr: number, args: [string]): Promise<void>;
|
|
33
|
+
subscribeFor(ptr: number, args: [string[]]): Promise<string[]>;
|
|
34
|
+
unsubscribeFrom(ptr: number, args: [string[]]): Promise<void>;
|
|
35
|
+
buildSubscriptionQuery(ptr: number, args: [StoreEventType, StoreEventSelectorType, string]): Promise<string>;
|
|
37
36
|
}
|
package/api/StoreApiNative.js
CHANGED
|
@@ -71,17 +71,14 @@ class StoreApiNative extends BaseNative_1.BaseNative {
|
|
|
71
71
|
async closeFile(ptr, args) {
|
|
72
72
|
return this.runAsync((taskId) => this.api.lib.StoreApi_closeFile(taskId, ptr, args));
|
|
73
73
|
}
|
|
74
|
-
async
|
|
75
|
-
return this.runAsync((taskId) => this.api.lib.
|
|
74
|
+
async subscribeFor(ptr, args) {
|
|
75
|
+
return this.runAsync((taskId) => this.api.lib.StoreApi_subscribeFor(taskId, ptr, args));
|
|
76
76
|
}
|
|
77
|
-
async
|
|
78
|
-
return this.runAsync((taskId) => this.api.lib.
|
|
77
|
+
async unsubscribeFrom(ptr, args) {
|
|
78
|
+
return this.runAsync((taskId) => this.api.lib.StoreApi_unsubscribeFrom(taskId, ptr, args));
|
|
79
79
|
}
|
|
80
|
-
async
|
|
81
|
-
return this.runAsync((taskId) => this.api.lib.
|
|
82
|
-
}
|
|
83
|
-
async unsubscribeFromFileEvents(ptr, args) {
|
|
84
|
-
return this.runAsync((taskId) => this.api.lib.StoreApi_unsubscribeFromFileEvents(taskId, ptr, args));
|
|
80
|
+
async buildSubscriptionQuery(ptr, args) {
|
|
81
|
+
return this.runAsync((taskId) => this.api.lib.StoreApi_buildSubscriptionQuery(taskId, ptr, args));
|
|
85
82
|
}
|
|
86
83
|
}
|
|
87
84
|
exports.StoreApiNative = StoreApiNative;
|
package/api/ThreadApiNative.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ 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 { PagingQuery, PagingList, UserWithPubKey, Thread, Message, ContainerPolicy } from "../Types";
|
|
11
|
+
import { PagingQuery, PagingList, UserWithPubKey, Thread, Message, ContainerPolicy, ThreadEventSelectorType, ThreadEventType } from "../Types";
|
|
12
12
|
import { BaseNative } from "./BaseNative";
|
|
13
13
|
export declare class ThreadApiNative extends BaseNative {
|
|
14
14
|
newApi(connectionPtr: number): Promise<number>;
|
|
@@ -24,8 +24,7 @@ export declare class ThreadApiNative extends BaseNative {
|
|
|
24
24
|
sendMessage(ptr: number, args: [string, Uint8Array, Uint8Array, Uint8Array]): Promise<string>;
|
|
25
25
|
deleteMessage(ptr: number, args: [string]): Promise<void>;
|
|
26
26
|
updateMessage(ptr: number, args: [string, Uint8Array, Uint8Array, Uint8Array]): Promise<void>;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
unsubscribeFromMessageEvents(ptr: number, args: [string]): Promise<void>;
|
|
27
|
+
subscribeFor(ptr: number, args: [string[]]): Promise<string[]>;
|
|
28
|
+
unsubscribeFrom(ptr: number, args: [string[]]): Promise<void>;
|
|
29
|
+
buildSubscriptionQuery(ptr: number, args: [ThreadEventType, ThreadEventSelectorType, string]): Promise<string>;
|
|
31
30
|
}
|
package/api/ThreadApiNative.js
CHANGED
|
@@ -53,17 +53,14 @@ class ThreadApiNative extends BaseNative_1.BaseNative {
|
|
|
53
53
|
async updateMessage(ptr, args) {
|
|
54
54
|
return this.runAsync((taskId) => this.api.lib.ThreadApi_updateMessage(taskId, ptr, args));
|
|
55
55
|
}
|
|
56
|
-
async
|
|
57
|
-
return this.runAsync((taskId) => this.api.lib.
|
|
56
|
+
async subscribeFor(ptr, args) {
|
|
57
|
+
return this.runAsync((taskId) => this.api.lib.ThreadApi_subscribeFor(taskId, ptr, args));
|
|
58
58
|
}
|
|
59
|
-
async
|
|
60
|
-
return this.runAsync((taskId) => this.api.lib.
|
|
59
|
+
async unsubscribeFrom(ptr, args) {
|
|
60
|
+
return this.runAsync((taskId) => this.api.lib.ThreadApi_unsubscribeFrom(taskId, ptr, args));
|
|
61
61
|
}
|
|
62
|
-
async
|
|
63
|
-
return this.runAsync((taskId) => this.api.lib.
|
|
64
|
-
}
|
|
65
|
-
async unsubscribeFromMessageEvents(ptr, args) {
|
|
66
|
-
return this.runAsync((taskId) => this.api.lib.ThreadApi_unsubscribeFromMessageEvents(taskId, ptr, args));
|
|
62
|
+
async buildSubscriptionQuery(ptr, args) {
|
|
63
|
+
return this.runAsync((taskId) => this.api.lib.ThreadApi_buildSubscriptionQuery(taskId, ptr, args));
|
|
67
64
|
}
|
|
68
65
|
}
|
|
69
66
|
exports.ThreadApiNative = ThreadApiNative;
|