@wireapp/core 40.5.3-draft-20-cc.3 → 40.5.3-draft-20-cc.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/lib/Account.d.ts +9 -7
- package/lib/Account.d.ts.map +1 -1
- package/lib/Account.js +32 -35
- package/lib/CoreError.js +1 -1
- package/lib/broadcast/BroadcastService.d.ts +2 -11
- package/lib/broadcast/BroadcastService.d.ts.map +1 -1
- package/lib/broadcast/BroadcastService.js +5 -39
- package/lib/client/ClientDatabaseRepository.d.ts +5 -5
- package/lib/client/ClientDatabaseRepository.d.ts.map +1 -1
- package/lib/client/ClientDatabaseRepository.js +10 -17
- package/lib/client/ClientService.d.ts +5 -1
- package/lib/client/ClientService.d.ts.map +1 -1
- package/lib/client/ClientService.js +11 -9
- package/lib/connection/ConnectionService.d.ts +2 -2
- package/lib/connection/ConnectionService.d.ts.map +1 -1
- package/lib/connection/ConnectionService.js +2 -2
- package/lib/conversation/AssetTransferState.js +1 -1
- package/lib/conversation/ConversationService/ConversationService.d.ts +12 -5
- package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
- package/lib/conversation/ConversationService/ConversationService.js +26 -11
- package/lib/conversation/ConversationService/ConversationService.test.js +1 -1
- package/lib/conversation/ConversationService/ConversationService.types.d.ts +12 -11
- package/lib/conversation/ConversationService/ConversationService.types.d.ts.map +1 -1
- package/lib/conversation/ConversationService/ConversationService.types.js +1 -1
- package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.d.ts +1 -1
- package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.d.ts.map +1 -1
- package/lib/conversation/GenericMessageType.js +1 -1
- package/lib/conversation/ReactionType.d.ts +1 -4
- package/lib/conversation/ReactionType.d.ts.map +1 -1
- package/lib/conversation/ReactionType.js +0 -6
- package/lib/conversation/message/Message.types.js +1 -1
- package/lib/conversation/message/MessageBuilder.d.ts +1 -1
- package/lib/conversation/message/MessageBuilder.d.ts.map +1 -1
- package/lib/conversation/message/MessageBuilder.js +2 -2
- package/lib/conversation/message/MessageService.d.ts +6 -31
- package/lib/conversation/message/MessageService.d.ts.map +1 -1
- package/lib/conversation/message/MessageService.js +19 -162
- package/lib/conversation/message/MessageService.test.js +151 -141
- package/lib/conversation/message/PayloadBundle.js +1 -1
- package/lib/conversation/message/UserClientsUtil.d.ts +14 -10
- package/lib/conversation/message/UserClientsUtil.d.ts.map +1 -1
- package/lib/conversation/message/UserClientsUtil.js +21 -11
- package/lib/conversation/message/UserClientsUtils.test.js +5 -9
- package/lib/messagingProtocols/mls/EventHandler/EventHandler.d.ts +1 -1
- package/lib/messagingProtocols/mls/EventHandler/EventHandler.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +7 -2
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.js +2 -0
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js +3 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +20 -8
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +81 -40
- package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +9 -0
- package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.d.ts +1 -1
- package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.js +5 -5
- package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.test.js +3 -3
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.d.ts +13 -0
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.js +67 -0
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.d.ts +2 -0
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.js +72 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts +10 -5
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.js +33 -11
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.d.ts +2 -3
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.js +8 -9
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.d.ts +4 -9
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.js +10 -24
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.test.js +2 -10
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.d.ts +1 -2
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.js +3 -3
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts +2 -2
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.d.ts +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.js +2 -2
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts +14 -7
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +31 -35
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.js +2 -3
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.test.js +109 -89
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts +6 -9
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/Utility/Recipients.d.ts +4 -10
- package/lib/messagingProtocols/proteus/Utility/Recipients.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/Utility/Recipients.js +16 -16
- package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.d.ts +15 -10
- package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.js +80 -92
- package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.test.js +70 -54
- package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts +5 -14
- package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.js +3 -35
- package/lib/messagingProtocols/proteus/Utility/isClearFromMismatch.d.ts +2 -2
- package/lib/messagingProtocols/proteus/Utility/isClearFromMismatch.d.ts.map +1 -1
- package/lib/notification/NotificationDatabaseRepository.js +1 -1
- package/lib/notification/Notifications.types.js +1 -1
- package/lib/user/UserService.d.ts +6 -17
- package/lib/user/UserService.d.ts.map +1 -1
- package/lib/user/UserService.js +2 -47
- package/lib/util/TaskScheduler/TaskScheduler.d.ts +4 -1
- package/lib/util/TaskScheduler/TaskScheduler.d.ts.map +1 -1
- package/lib/util/TaskScheduler/TaskScheduler.js +24 -3
- package/lib/util/TaskScheduler/TaskScheduler.store.d.ts +7 -0
- package/lib/util/TaskScheduler/TaskScheduler.store.d.ts.map +1 -0
- package/lib/util/TaskScheduler/TaskScheduler.store.js +34 -0
- package/lib/util/TypePredicateUtil.d.ts +0 -1
- package/lib/util/TypePredicateUtil.d.ts.map +1 -1
- package/lib/util/TypePredicateUtil.js +1 -2
- package/package.json +3 -3
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/index.d.ts +0 -2
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/index.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/index.js +0 -35
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.d.ts +0 -11
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.js +0 -50
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.test.d.ts +0 -2
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.test.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.test.js +0 -39
- package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.d.ts +0 -4
- package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.js +0 -35
- package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.test.d.ts +0 -2
- package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.test.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.test.js +0 -35
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.d.ts +0 -25
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.d.ts.map +0 -1
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.js +0 -93
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.test.d.ts +0 -2
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.test.d.ts.map +0 -1
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.test.js +0 -66
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/index.d.ts +0 -2
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/index.d.ts.map +0 -1
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/index.js +0 -35
package/lib/user/UserService.js
CHANGED
|
@@ -19,16 +19,9 @@
|
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.UserService = void 0;
|
|
22
|
-
const connection_1 = require("@wireapp/api-client/lib/connection");
|
|
23
|
-
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
24
|
-
const MessageBuilder_1 = require("../conversation/message/MessageBuilder");
|
|
25
|
-
const PreKeyBundle_1 = require("../messagingProtocols/proteus/Utility/PreKeyBundle");
|
|
26
|
-
const TypePredicateUtil_1 = require("../util/TypePredicateUtil");
|
|
27
22
|
class UserService {
|
|
28
|
-
constructor(apiClient
|
|
23
|
+
constructor(apiClient) {
|
|
29
24
|
this.apiClient = apiClient;
|
|
30
|
-
this.broadcastService = broadcastService;
|
|
31
|
-
this.connectionService = connectionService;
|
|
32
25
|
}
|
|
33
26
|
getUser(userId) {
|
|
34
27
|
return this.apiClient.api.user.getUser(userId);
|
|
@@ -37,45 +30,7 @@ class UserService {
|
|
|
37
30
|
if (!userIds.length) {
|
|
38
31
|
return [];
|
|
39
32
|
}
|
|
40
|
-
return (
|
|
41
|
-
? this.apiClient.api.user.postListUsers({ qualified_ids: userIds })
|
|
42
|
-
: this.apiClient.api.user.getUsers({ ids: userIds });
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Sends a availability update to members of the same team
|
|
46
|
-
* @param teamId
|
|
47
|
-
* @param type
|
|
48
|
-
* @param options.sendAll=false will broadcast the message to all the members of the team (instead of just direct connections). Should be avoided in a big team
|
|
49
|
-
* @param options.sendAsProtobuf=false
|
|
50
|
-
*/
|
|
51
|
-
async setAvailability(teamId, type, { sendAll = false, sendAsProtobuf = false } = {}) {
|
|
52
|
-
// Get pre-key bundles for members of your own team
|
|
53
|
-
const preKeyBundlesFromTeam = await this.broadcastService.getPreKeyBundlesFromTeam(teamId, false, !sendAll);
|
|
54
|
-
// Get pre-key bundles for all of your other 1:1 connections
|
|
55
|
-
const connections = await this.connectionService.getConnections();
|
|
56
|
-
const acceptedConnections = connections.filter(connection => connection.status === connection_1.ConnectionStatus.ACCEPTED);
|
|
57
|
-
const preKeyBundlePromises = acceptedConnections.map(connection => {
|
|
58
|
-
const mappedConnection = {
|
|
59
|
-
userId: connection.to,
|
|
60
|
-
conversationId: connection.conversation,
|
|
61
|
-
};
|
|
62
|
-
return (0, PreKeyBundle_1.getPreKeyBundleMap)({
|
|
63
|
-
apiClient: this.apiClient,
|
|
64
|
-
conversationId: { id: mappedConnection.conversationId, domain: '' },
|
|
65
|
-
userIds: [mappedConnection.userId],
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
const preKeyBundlesFromConnections = await Promise.all(preKeyBundlePromises);
|
|
69
|
-
// Merge pre-key bundles
|
|
70
|
-
const allPreKeyBundles = preKeyBundlesFromConnections.reduce((accumulator, preKeyBundleMap) => {
|
|
71
|
-
return Object.assign(Object.assign({}, accumulator), preKeyBundleMap);
|
|
72
|
-
}, preKeyBundlesFromTeam);
|
|
73
|
-
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
74
|
-
availability: new protocol_messaging_1.Availability({ type }),
|
|
75
|
-
messageId: (0, MessageBuilder_1.createId)(),
|
|
76
|
-
});
|
|
77
|
-
// Broadcast availability status to your team members & external 1:1 connections
|
|
78
|
-
await this.broadcastService.broadcastGenericMessage(genericMessage, allPreKeyBundles, sendAsProtobuf);
|
|
33
|
+
return this.apiClient.api.user.postListUsers({ qualified_ids: userIds });
|
|
79
34
|
}
|
|
80
35
|
}
|
|
81
36
|
exports.UserService = UserService;
|
|
@@ -2,10 +2,13 @@ type ScheduleTaskParams = {
|
|
|
2
2
|
task: () => void;
|
|
3
3
|
firingDate: number;
|
|
4
4
|
key: string;
|
|
5
|
+
persist?: boolean;
|
|
5
6
|
};
|
|
6
7
|
export declare const TaskScheduler: {
|
|
7
|
-
addTask: ({ task, firingDate, key }: ScheduleTaskParams) => void;
|
|
8
|
+
addTask: ({ task, firingDate, key, persist }: ScheduleTaskParams) => void;
|
|
8
9
|
cancelTask: (key: string) => void;
|
|
10
|
+
continueTask: ({ key, task }: Omit<ScheduleTaskParams, 'firingDate' | 'persist'>) => void;
|
|
11
|
+
hasActiveTask: (key: string) => boolean;
|
|
9
12
|
};
|
|
10
13
|
export {};
|
|
11
14
|
//# sourceMappingURL=TaskScheduler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskScheduler.d.ts","sourceRoot":"","sources":["../../../src/util/TaskScheduler/TaskScheduler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TaskScheduler.d.ts","sourceRoot":"","sources":["../../../src/util/TaskScheduler/TaskScheduler.ts"],"names":[],"mappings":"AA4BA,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAoEF,eAAO,MAAM,aAAa;kDAzDiC,kBAAkB;sBAoCpD,MAAM;kCAcI,KAAK,kBAAkB,EAAE,YAAY,GAAG,SAAS,CAAC;;CAYpF,CAAC"}
|
|
@@ -23,6 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
exports.TaskScheduler = void 0;
|
|
25
25
|
const logdown_1 = __importDefault(require("logdown"));
|
|
26
|
+
const TaskScheduler_store_1 = require("./TaskScheduler.store");
|
|
26
27
|
const logger = (0, logdown_1.default)('@wireapp/core/TaskScheduler', {
|
|
27
28
|
logger: console,
|
|
28
29
|
markdown: false,
|
|
@@ -35,20 +36,27 @@ const activeTimeouts = {};
|
|
|
35
36
|
* @param firingDate execution date
|
|
36
37
|
* @param key unique key for the task
|
|
37
38
|
*/
|
|
38
|
-
const addTask = ({ task, firingDate, key }) => {
|
|
39
|
-
const now =
|
|
39
|
+
const addTask = ({ task, firingDate, key, persist = false }) => {
|
|
40
|
+
const now = Date.now();
|
|
40
41
|
const execute = new Date(firingDate);
|
|
41
|
-
const delay = execute.getTime() - now
|
|
42
|
+
const delay = execute.getTime() - now;
|
|
43
|
+
if (TaskScheduler_store_1.TaskSchedulerStore.has(key)) {
|
|
44
|
+
TaskScheduler_store_1.TaskSchedulerStore.remove(key);
|
|
45
|
+
}
|
|
42
46
|
if (activeTimeouts[key]) {
|
|
43
47
|
cancelTask(key);
|
|
44
48
|
}
|
|
45
49
|
const timeout = setTimeout(async () => {
|
|
46
50
|
logger.info(`Executing task with key "${key}"`);
|
|
47
51
|
delete activeTimeouts[key];
|
|
52
|
+
TaskScheduler_store_1.TaskSchedulerStore.remove(key);
|
|
48
53
|
await task();
|
|
49
54
|
}, delay > 0 ? delay : 0);
|
|
50
55
|
// add the task to the list of active tasks
|
|
51
56
|
activeTimeouts[key] = timeout;
|
|
57
|
+
if (persist) {
|
|
58
|
+
TaskScheduler_store_1.TaskSchedulerStore.add(key, firingDate);
|
|
59
|
+
}
|
|
52
60
|
logger.info(`New scheduled task to be executed at "${execute}" with key "${key}"`);
|
|
53
61
|
};
|
|
54
62
|
/**
|
|
@@ -64,7 +72,20 @@ const cancelTask = (key) => {
|
|
|
64
72
|
logger.info(`Scheduled task with key "${key}" prematurely cleared`);
|
|
65
73
|
}
|
|
66
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* Checks if a task has been scheduled in the past and reschedules it
|
|
77
|
+
* @param task function to be executed
|
|
78
|
+
* @param key unique key for the task
|
|
79
|
+
*/
|
|
80
|
+
const continueTask = ({ key, task }) => {
|
|
81
|
+
const activeTaskEndTime = TaskScheduler_store_1.TaskSchedulerStore.get(key);
|
|
82
|
+
if (activeTaskEndTime) {
|
|
83
|
+
addTask({ task, firingDate: activeTaskEndTime, key, persist: true });
|
|
84
|
+
}
|
|
85
|
+
};
|
|
67
86
|
exports.TaskScheduler = {
|
|
68
87
|
addTask,
|
|
69
88
|
cancelTask,
|
|
89
|
+
continueTask,
|
|
90
|
+
hasActiveTask: TaskScheduler_store_1.TaskSchedulerStore.has,
|
|
70
91
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskScheduler.store.d.ts","sourceRoot":"","sources":["../../../src/util/TaskScheduler/TaskScheduler.store.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,kBAAkB;eAClB,MAAM;eAON,MAAM,cAAc,MAAM;kBACvB,MAAM;eACT,MAAM;CAClB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2023 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.TaskSchedulerStore = void 0;
|
|
22
|
+
const prependKey = (key) => `TaskScheduler_${key}`;
|
|
23
|
+
exports.TaskSchedulerStore = {
|
|
24
|
+
get: (key) => {
|
|
25
|
+
const value = localStorage.getItem(prependKey(key));
|
|
26
|
+
if (value) {
|
|
27
|
+
return Number(value);
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
30
|
+
},
|
|
31
|
+
add: (key, firingDate) => localStorage.setItem(prependKey(key), String(firingDate)),
|
|
32
|
+
remove: (key) => localStorage.removeItem(prependKey(key)),
|
|
33
|
+
has: (key) => !!localStorage.getItem(prependKey(key)),
|
|
34
|
+
};
|
|
@@ -2,7 +2,6 @@ import { Conversation, QualifiedUserClients, UserClients } from '@wireapp/api-cl
|
|
|
2
2
|
import { QualifiedId } from '@wireapp/api-client/lib/user/';
|
|
3
3
|
import { MLSConversation } from '../messagingProtocols/mls/types';
|
|
4
4
|
export declare function isStringArray(obj: any): obj is string[];
|
|
5
|
-
export declare function isQualifiedId(obj: any): obj is QualifiedId;
|
|
6
5
|
export declare function isQualifiedIdArray(obj: any): obj is QualifiedId[];
|
|
7
6
|
export declare function isQualifiedUserClients(obj: any): obj is QualifiedUserClients;
|
|
8
7
|
export declare function isUserClients(obj: any): obj is UserClients;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypePredicateUtil.d.ts","sourceRoot":"","sources":["../../src/util/TypePredicateUtil.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EAEZ,oBAAoB,EACpB,WAAW,EACZ,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAEhE,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,EAAE,CAEvD;
|
|
1
|
+
{"version":3,"file":"TypePredicateUtil.d.ts","sourceRoot":"","sources":["../../src/util/TypePredicateUtil.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EAEZ,oBAAoB,EACpB,WAAW,EACZ,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAEhE,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,EAAE,CAEvD;AAMD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,WAAW,EAAE,CAEjE;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,oBAAoB,CAS5E;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,WAAW,CAM1D;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,YAAY,GAAG,YAAY,IAAI,eAAe,CAG7F"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.isMLSConversation = exports.isUserClients = exports.isQualifiedUserClients = exports.isQualifiedIdArray = exports.
|
|
21
|
+
exports.isMLSConversation = exports.isUserClients = exports.isQualifiedUserClients = exports.isQualifiedIdArray = exports.isStringArray = void 0;
|
|
22
22
|
const conversation_1 = require("@wireapp/api-client/lib/conversation/");
|
|
23
23
|
function isStringArray(obj) {
|
|
24
24
|
return Array.isArray(obj) && (obj.length === 0 || typeof obj[0] === 'string');
|
|
@@ -27,7 +27,6 @@ exports.isStringArray = isStringArray;
|
|
|
27
27
|
function isQualifiedId(obj) {
|
|
28
28
|
return typeof obj === 'object' && typeof obj['domain'] === 'string';
|
|
29
29
|
}
|
|
30
|
-
exports.isQualifiedId = isQualifiedId;
|
|
31
30
|
function isQualifiedIdArray(obj) {
|
|
32
31
|
return Array.isArray(obj) && isQualifiedId(obj[0]);
|
|
33
32
|
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"./lib/cryptography/AssetCryptography/crypto.node": "./lib/cryptography/AssetCryptography/crypto.browser.js"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@wireapp/api-client": "^24.15.
|
|
14
|
+
"@wireapp/api-client": "^24.15.6-draft-20-cc.0",
|
|
15
15
|
"@wireapp/commons": "^5.1.0",
|
|
16
16
|
"@wireapp/core-crypto": "1.0.0-pre.5",
|
|
17
17
|
"@wireapp/cryptobox": "12.8.0",
|
|
@@ -60,6 +60,6 @@
|
|
|
60
60
|
"test:coverage": "jest --coverage",
|
|
61
61
|
"watch": "tsc --watch"
|
|
62
62
|
},
|
|
63
|
-
"version": "40.5.3-draft-20-cc.
|
|
64
|
-
"gitHead": "
|
|
63
|
+
"version": "40.5.3-draft-20-cc.0",
|
|
64
|
+
"gitHead": "65797abcfc2b0c8e61c5375f7de53b983347a4b9"
|
|
65
65
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/index.ts"],"names":[],"mappings":"AAmBA,cAAc,2BAA2B,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2022 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
-
}
|
|
26
|
-
Object.defineProperty(o, k2, desc);
|
|
27
|
-
}) : (function(o, m, k, k2) {
|
|
28
|
-
if (k2 === undefined) k2 = k;
|
|
29
|
-
o[k2] = m[k];
|
|
30
|
-
}));
|
|
31
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
32
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
__exportStar(require("./keyMaterialUpdatesStore"), exports);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { CommonMLS } from '../../../types';
|
|
2
|
-
export type LastKeyMaterialUpdateParams = CommonMLS;
|
|
3
|
-
export interface KeyMaterialUpdatesStore {
|
|
4
|
-
[groupId: string]: LastKeyMaterialUpdateParams;
|
|
5
|
-
}
|
|
6
|
-
export declare const keyMaterialUpdatesStore: {
|
|
7
|
-
getAllUpdateDates: () => LastKeyMaterialUpdateParams[];
|
|
8
|
-
storeLastKeyMaterialUpdateDate: ({ groupId }: LastKeyMaterialUpdateParams) => void;
|
|
9
|
-
deleteLastKeyMaterialUpdateDate: ({ groupId }: CommonMLS) => void;
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=keyMaterialUpdatesStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keyMaterialUpdatesStore.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,MAAM,MAAM,2BAA2B,GAAG,SAAS,CAAC;AACpD,MAAM,WAAW,uBAAuB;IACtC,CAAC,OAAO,EAAE,MAAM,GAAG,2BAA2B,CAAC;CAChD;AA+BD,eAAO,MAAM,uBAAuB;6BAnBN,2BAA2B,EAAE;kDAKR,2BAA2B;mDAM1B,SAAS;CAY5D,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2022 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.keyMaterialUpdatesStore = void 0;
|
|
22
|
-
const storageKey = 'keyMaterialUpdates';
|
|
23
|
-
const getUpdateDatesMap = () => {
|
|
24
|
-
const storedState = localStorage.getItem(storageKey);
|
|
25
|
-
if (!storedState) {
|
|
26
|
-
return {};
|
|
27
|
-
}
|
|
28
|
-
return JSON.parse(storedState);
|
|
29
|
-
};
|
|
30
|
-
const getAllUpdateDates = () => {
|
|
31
|
-
const storedStateMap = getUpdateDatesMap();
|
|
32
|
-
return Object.values(storedStateMap);
|
|
33
|
-
};
|
|
34
|
-
const storeLastKeyMaterialUpdateDate = ({ groupId }) => {
|
|
35
|
-
const storedState = getUpdateDatesMap();
|
|
36
|
-
const newStoredState = Object.assign(Object.assign({}, storedState), { [groupId]: { groupId } });
|
|
37
|
-
localStorage.setItem(storageKey, JSON.stringify(newStoredState));
|
|
38
|
-
};
|
|
39
|
-
const deleteLastKeyMaterialUpdateDate = ({ groupId }) => {
|
|
40
|
-
const storedState = getUpdateDatesMap();
|
|
41
|
-
if (storedState[groupId]) {
|
|
42
|
-
delete storedState[groupId];
|
|
43
|
-
}
|
|
44
|
-
localStorage.setItem(storageKey, JSON.stringify(storedState));
|
|
45
|
-
};
|
|
46
|
-
exports.keyMaterialUpdatesStore = {
|
|
47
|
-
getAllUpdateDates,
|
|
48
|
-
storeLastKeyMaterialUpdateDate,
|
|
49
|
-
deleteLastKeyMaterialUpdateDate,
|
|
50
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keyMaterialUpdatesStore.test.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2022 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
const keyMaterialUpdatesStore_1 = require("./keyMaterialUpdatesStore");
|
|
22
|
-
const mockUpdateEntries = [{ groupId: 'group0' }, { groupId: 'group1' }];
|
|
23
|
-
describe('keyMaterialUpdatesStore', () => {
|
|
24
|
-
it('adds and retrieves items to/from dates store', () => {
|
|
25
|
-
keyMaterialUpdatesStore_1.keyMaterialUpdatesStore.storeLastKeyMaterialUpdateDate(mockUpdateEntries[0]);
|
|
26
|
-
expect(keyMaterialUpdatesStore_1.keyMaterialUpdatesStore.getAllUpdateDates()).toContainEqual(mockUpdateEntries[0]);
|
|
27
|
-
keyMaterialUpdatesStore_1.keyMaterialUpdatesStore.storeLastKeyMaterialUpdateDate(mockUpdateEntries[1]);
|
|
28
|
-
const stored = keyMaterialUpdatesStore_1.keyMaterialUpdatesStore.getAllUpdateDates();
|
|
29
|
-
expect(stored).toContainEqual(mockUpdateEntries[1]);
|
|
30
|
-
expect(stored).toContainEqual(mockUpdateEntries[0]);
|
|
31
|
-
expect(stored).toHaveLength(2);
|
|
32
|
-
});
|
|
33
|
-
it('removes items from dates store', () => {
|
|
34
|
-
keyMaterialUpdatesStore_1.keyMaterialUpdatesStore.storeLastKeyMaterialUpdateDate(mockUpdateEntries[0]);
|
|
35
|
-
expect(keyMaterialUpdatesStore_1.keyMaterialUpdatesStore.getAllUpdateDates()).toContainEqual(mockUpdateEntries[0]);
|
|
36
|
-
keyMaterialUpdatesStore_1.keyMaterialUpdatesStore.deleteLastKeyMaterialUpdateDate({ groupId: mockUpdateEntries[0].groupId });
|
|
37
|
-
expect(keyMaterialUpdatesStore_1.keyMaterialUpdatesStore.getAllUpdateDates()).not.toContainEqual(mockUpdateEntries[0]);
|
|
38
|
-
});
|
|
39
|
-
});
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { QualifiedId } from '@wireapp/api-client/lib/user';
|
|
2
|
-
export declare function storeSubconversationGroupId(parentConversation: QualifiedId, subconversation: string, subgroupId: string): void;
|
|
3
|
-
export declare function getGroupId(parentConversation: QualifiedId, subconversation: string): string | undefined;
|
|
4
|
-
//# sourceMappingURL=subconversationGroupIdMapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subconversationGroupIdMapper.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAQzD,wBAAgB,2BAA2B,CACzC,kBAAkB,EAAE,WAAW,EAC/B,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM,GACjB,IAAI,CAGN;AAED,wBAAgB,UAAU,CAAC,kBAAkB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGvG"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2023 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.getGroupId = exports.storeSubconversationGroupId = void 0;
|
|
22
|
-
const groupIdMap = new Map();
|
|
23
|
-
function generateSubconversationId(parentConversation, subconversation) {
|
|
24
|
-
return `${parentConversation.id}@${parentConversation.domain}:${subconversation}`;
|
|
25
|
-
}
|
|
26
|
-
function storeSubconversationGroupId(parentConversation, subconversation, subgroupId) {
|
|
27
|
-
const subconversationId = generateSubconversationId(parentConversation, subconversation);
|
|
28
|
-
groupIdMap.set(subconversationId, subgroupId);
|
|
29
|
-
}
|
|
30
|
-
exports.storeSubconversationGroupId = storeSubconversationGroupId;
|
|
31
|
-
function getGroupId(parentConversation, subconversation) {
|
|
32
|
-
const subconversationId = generateSubconversationId(parentConversation, subconversation);
|
|
33
|
-
return groupIdMap.get(subconversationId);
|
|
34
|
-
}
|
|
35
|
-
exports.getGroupId = getGroupId;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subconversationGroupIdMapper.test.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2018 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
const subconversationGroupIdMapper_1 = require("./subconversationGroupIdMapper");
|
|
22
|
-
describe('subconversationGroupIdMapper', () => {
|
|
23
|
-
it('returns empty groupId if conversation is not known', () => {
|
|
24
|
-
const groupId = (0, subconversationGroupIdMapper_1.getGroupId)({ domain: 'example.com', id: '123' }, 'subconversation');
|
|
25
|
-
expect(groupId).toBeUndefined();
|
|
26
|
-
});
|
|
27
|
-
it('returns the stored groupId', () => {
|
|
28
|
-
const conversationId = { domain: 'example.com', id: '123' };
|
|
29
|
-
const subconversation = 'subconversation';
|
|
30
|
-
const groupId = 'groupID';
|
|
31
|
-
(0, subconversationGroupIdMapper_1.storeSubconversationGroupId)(conversationId, subconversation, groupId);
|
|
32
|
-
const result = (0, subconversationGroupIdMapper_1.getGroupId)({ domain: 'example.com', id: '123' }, 'subconversation');
|
|
33
|
-
expect(result).toBe(groupId);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { APIClient } from '@wireapp/api-client/lib/APIClient';
|
|
2
|
-
import { QualifiedUserClients, UserClients } from '@wireapp/api-client/lib/conversation';
|
|
3
|
-
import { QualifiedId, QualifiedUserPreKeyBundleMap, UserPreKeyBundleMap } from '@wireapp/api-client/lib/user';
|
|
4
|
-
declare const preKeyBundleToUserClients: (users: UserPreKeyBundleMap) => UserClients;
|
|
5
|
-
interface GetPreKeyBundleMapParams {
|
|
6
|
-
apiClient: APIClient;
|
|
7
|
-
conversationId: QualifiedId;
|
|
8
|
-
userIds?: string[] | QualifiedId[] | UserClients;
|
|
9
|
-
}
|
|
10
|
-
declare const getPreKeyBundleMap: ({ apiClient, conversationId, userIds, }: GetPreKeyBundleMapParams) => Promise<UserPreKeyBundleMap>;
|
|
11
|
-
/**
|
|
12
|
-
* Will generate a prekey bundle for specific users.
|
|
13
|
-
* If a QualifiedId array is given the bundle will contain all the clients from those users fetched from the server.
|
|
14
|
-
* If a QualifiedUserClients is provided then only the clients in the payload will be targeted (which could generate a ClientMismatch when sending messages)
|
|
15
|
-
*
|
|
16
|
-
* @param {QualifiedId[]|QualifiedUserClients} userIds - Targeted users.
|
|
17
|
-
* @returns {Promise<QualifiedUserPreKeyBundleMap}
|
|
18
|
-
*/
|
|
19
|
-
interface GetQualifiedPreKeyBundleMapParams {
|
|
20
|
-
apiClient: APIClient;
|
|
21
|
-
userIds?: QualifiedId[] | QualifiedUserClients;
|
|
22
|
-
}
|
|
23
|
-
declare const getQualifiedPreKeyBundle: ({ apiClient, userIds, }: GetQualifiedPreKeyBundleMapParams) => Promise<QualifiedUserPreKeyBundleMap>;
|
|
24
|
-
export { getPreKeyBundleMap, getQualifiedPreKeyBundle, preKeyBundleToUserClients };
|
|
25
|
-
//# sourceMappingURL=PreKeyBundle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PreKeyBundle.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAC,oBAAoB,EAAE,WAAW,EAAC,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAC,WAAW,EAAE,4BAA4B,EAAE,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AAI5G,QAAA,MAAM,yBAAyB,UAAW,mBAAmB,KAAG,WAK/D,CAAC;AAEF,UAAU,wBAAwB;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,EAAE,WAAW,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,GAAG,WAAW,CAAC;CAClD;AACD,QAAA,MAAM,kBAAkB,4CAIrB,wBAAwB,KAAG,QAAQ,mBAAmB,CA+BxD,CAAC;AAEF;;;;;;;GAOG;AACH,UAAU,iCAAiC;IACzC,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,WAAW,EAAE,GAAG,oBAAoB,CAAC;CAChD;AACD,QAAA,MAAM,wBAAwB,4BAG3B,iCAAiC,KAAG,QAAQ,4BAA4B,CAoC1E,CAAC;AAEF,OAAO,EAAC,kBAAkB,EAAE,wBAAwB,EAAE,yBAAyB,EAAC,CAAC"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2022 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.preKeyBundleToUserClients = exports.getQualifiedPreKeyBundle = exports.getPreKeyBundleMap = void 0;
|
|
22
|
-
const util_1 = require("../../../../util");
|
|
23
|
-
const preKeyBundleToUserClients = (users) => {
|
|
24
|
-
return Object.entries(users).reduce((acc, [userId, clientsObj]) => {
|
|
25
|
-
acc[userId] = Object.keys(clientsObj);
|
|
26
|
-
return acc;
|
|
27
|
-
}, {});
|
|
28
|
-
};
|
|
29
|
-
exports.preKeyBundleToUserClients = preKeyBundleToUserClients;
|
|
30
|
-
const getPreKeyBundleMap = async ({ apiClient, conversationId, userIds = [], }) => {
|
|
31
|
-
let members = [];
|
|
32
|
-
if (userIds) {
|
|
33
|
-
if ((0, util_1.isStringArray)(userIds)) {
|
|
34
|
-
members = userIds;
|
|
35
|
-
}
|
|
36
|
-
else if ((0, util_1.isUserClients)(userIds)) {
|
|
37
|
-
members = Object.keys(userIds);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (!members.length) {
|
|
41
|
-
const conversation = await apiClient.api.conversation.getConversation(conversationId);
|
|
42
|
-
/*
|
|
43
|
-
* If you are sending a message to a conversation, you have to include
|
|
44
|
-
* yourself in the list of users if you want to sync a message also to your
|
|
45
|
-
* other clients.
|
|
46
|
-
*/
|
|
47
|
-
members = conversation.members.others.map(member => member.id).concat(conversation.members.self.id);
|
|
48
|
-
}
|
|
49
|
-
const preKeys = await Promise.all(members.map(member => apiClient.api.user.getUserPreKeys(member)));
|
|
50
|
-
return preKeys.reduce((bundleMap, bundle) => {
|
|
51
|
-
const userId = bundle.user;
|
|
52
|
-
bundleMap[userId] || (bundleMap[userId] = {});
|
|
53
|
-
for (const client of bundle.clients) {
|
|
54
|
-
bundleMap[userId][client.client] = client.prekey;
|
|
55
|
-
}
|
|
56
|
-
return bundleMap;
|
|
57
|
-
}, {});
|
|
58
|
-
};
|
|
59
|
-
exports.getPreKeyBundleMap = getPreKeyBundleMap;
|
|
60
|
-
const getQualifiedPreKeyBundle = async ({ apiClient, userIds, }) => {
|
|
61
|
-
let targets = [];
|
|
62
|
-
if (userIds) {
|
|
63
|
-
if ((0, util_1.isQualifiedIdArray)(userIds)) {
|
|
64
|
-
targets = userIds.map(id => ({ id }));
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
targets = Object.entries(userIds).reduce((accumulator, [domain, userClients]) => {
|
|
68
|
-
for (const userId in userClients) {
|
|
69
|
-
accumulator.push({ id: { id: userId, domain }, clients: userClients[userId] });
|
|
70
|
-
}
|
|
71
|
-
return accumulator;
|
|
72
|
-
}, []);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
const preKeys = await Promise.all(targets.map(async ({ id: userId, clients }) => {
|
|
76
|
-
const prekeyBundle = await apiClient.api.user.getUserPreKeys(userId);
|
|
77
|
-
// We filter the clients that should not receive the message (if a QualifiedUserClients was given as parameter)
|
|
78
|
-
const userClients = clients
|
|
79
|
-
? prekeyBundle.clients.filter(client => clients.includes(client.client))
|
|
80
|
-
: prekeyBundle.clients;
|
|
81
|
-
return { user: userId, clients: userClients };
|
|
82
|
-
}));
|
|
83
|
-
return preKeys.reduce((bundleMap, qualifiedPrekey) => {
|
|
84
|
-
var _a, _b, _c;
|
|
85
|
-
bundleMap[_a = qualifiedPrekey.user.domain] || (bundleMap[_a] = {});
|
|
86
|
-
for (const client of qualifiedPrekey.clients) {
|
|
87
|
-
(_b = bundleMap[qualifiedPrekey.user.domain])[_c = qualifiedPrekey.user.id] || (_b[_c] = {});
|
|
88
|
-
bundleMap[qualifiedPrekey.user.domain][qualifiedPrekey.user.id][client.client] = client.prekey;
|
|
89
|
-
}
|
|
90
|
-
return bundleMap;
|
|
91
|
-
}, {});
|
|
92
|
-
};
|
|
93
|
-
exports.getQualifiedPreKeyBundle = getQualifiedPreKeyBundle;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PreKeyBundle.test.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.test.ts"],"names":[],"mappings":""}
|