@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
|
@@ -21,11 +21,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
exports.buildEncryptedPayloads = exports.deleteSession = exports.initSessions = exports.initSession = exports.constructSessionId = void 0;
|
|
22
22
|
const bazinga64_1 = require("bazinga64");
|
|
23
23
|
const UserClientsUtil_1 = require("../../../../conversation/message/UserClientsUtil");
|
|
24
|
-
const constructSessionId = ({ userId, clientId
|
|
25
|
-
const id
|
|
26
|
-
const baseDomain = typeof userId === 'string' ? domain : userId.domain;
|
|
24
|
+
const constructSessionId = ({ userId, clientId }) => {
|
|
25
|
+
const { id, domain } = userId;
|
|
27
26
|
const baseId = `${id}@${clientId}`;
|
|
28
|
-
return
|
|
27
|
+
return domain ? `${domain}@${baseId}` : baseId;
|
|
29
28
|
};
|
|
30
29
|
exports.constructSessionId = constructSessionId;
|
|
31
30
|
const isSessionId = (object) => {
|
|
@@ -43,55 +42,16 @@ const parseSessionId = (sessionId) => {
|
|
|
43
42
|
}
|
|
44
43
|
return match.groups;
|
|
45
44
|
};
|
|
46
|
-
const createLegacySessions = async ({ userClients, apiClient, cryptoClient, logger, }) => {
|
|
47
|
-
const preKeyBundleMap = await apiClient.api.user.postMultiPreKeyBundles(userClients);
|
|
48
|
-
const sessions = await createSessionsFromPreKeys({
|
|
49
|
-
preKeyBundleMap,
|
|
50
|
-
useQualifiedIds: false,
|
|
51
|
-
cryptoClient,
|
|
52
|
-
logger,
|
|
53
|
-
});
|
|
54
|
-
return sessions;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Create sessions for the qualified clients.
|
|
58
|
-
* @param {userClientMap} map of domain to (map of user IDs to client IDs)
|
|
59
|
-
*/
|
|
60
|
-
const createQualifiedSessions = async ({ userClientMap, domain, apiClient, cryptoClient, logger, }) => {
|
|
61
|
-
const prekeyBundleMap = await apiClient.api.user.postQualifiedMultiPreKeyBundles({ [domain]: userClientMap });
|
|
62
|
-
const sessions = [];
|
|
63
|
-
for (const domain in prekeyBundleMap) {
|
|
64
|
-
const domainUsers = prekeyBundleMap[domain];
|
|
65
|
-
const domainSessions = await createSessionsFromPreKeys({
|
|
66
|
-
preKeyBundleMap: domainUsers,
|
|
67
|
-
domain,
|
|
68
|
-
useQualifiedIds: true,
|
|
69
|
-
cryptoClient,
|
|
70
|
-
logger,
|
|
71
|
-
});
|
|
72
|
-
sessions.push(...domainSessions);
|
|
73
|
-
}
|
|
74
|
-
return sessions;
|
|
75
|
-
};
|
|
76
45
|
/**
|
|
77
46
|
* Will make sure the session is available in cryptoClient
|
|
78
47
|
* @param sessionId the session to init
|
|
79
48
|
*/
|
|
80
49
|
const initSession = async ({ userId, clientId, initialPrekey }, { cryptoClient, apiClient }) => {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (initialPrekey) {
|
|
87
|
-
const prekeyBuffer = bazinga64_1.Decoder.fromBase64(initialPrekey.key).asBytes;
|
|
88
|
-
await cryptoClient.sessionFromPrekey(sessionId, prekeyBuffer);
|
|
89
|
-
await cryptoClient.saveSession(sessionId);
|
|
90
|
-
return sessionId;
|
|
91
|
-
}
|
|
92
|
-
const sessions = await initSessions({
|
|
93
|
-
recipients: { [userId.id]: [clientId] },
|
|
94
|
-
domain: userId.domain,
|
|
50
|
+
const recipients = initialPrekey
|
|
51
|
+
? { [userId.domain]: { [userId.id]: { [clientId]: initialPrekey } } }
|
|
52
|
+
: { [userId.domain]: { [userId.id]: [clientId] } };
|
|
53
|
+
const { sessions } = await initSessions({
|
|
54
|
+
recipients,
|
|
95
55
|
apiClient,
|
|
96
56
|
cryptoClient,
|
|
97
57
|
});
|
|
@@ -100,51 +60,67 @@ const initSession = async ({ userId, clientId, initialPrekey }, { cryptoClient,
|
|
|
100
60
|
exports.initSession = initSession;
|
|
101
61
|
/**
|
|
102
62
|
* Create sessions for legacy/qualified clients (umberella function).
|
|
103
|
-
* Will call createQualifiedSessions or createLegacySessions based on passed userClientMap.
|
|
104
63
|
* @param {userClientMap} map of domain to (map of user IDs to client IDs) or map of user IDs containg the lists of clients
|
|
105
64
|
*/
|
|
106
|
-
const createSessions = async ({
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return await createLegacySessions({
|
|
111
|
-
userClients: userClientMap,
|
|
112
|
-
apiClient,
|
|
65
|
+
const createSessions = async ({ recipients, apiClient, cryptoClient }) => {
|
|
66
|
+
const { qualified_user_client_prekeys: prekeysBundle, failed_to_list: failed } = await apiClient.api.user.postMultiPreKeyBundles(recipients);
|
|
67
|
+
const result = await createSessionsFromPreKeys({
|
|
68
|
+
recipients: prekeysBundle,
|
|
113
69
|
cryptoClient,
|
|
114
|
-
logger,
|
|
115
70
|
});
|
|
71
|
+
return Object.assign(Object.assign({}, result), { failed: (failed === null || failed === void 0 ? void 0 : failed.length) ? failed : undefined });
|
|
116
72
|
};
|
|
117
73
|
/**
|
|
118
74
|
* Will make sure all the sessions need to encrypt for those user/clients pair are set
|
|
119
75
|
*/
|
|
120
|
-
const initSessions = async ({ recipients,
|
|
121
|
-
|
|
76
|
+
const initSessions = async ({ recipients, apiClient, cryptoClient, logger, }) => {
|
|
77
|
+
var _a, _b, _c;
|
|
78
|
+
const missingClients = {};
|
|
79
|
+
const missingClientsWithPrekeys = {};
|
|
122
80
|
const existingSessions = [];
|
|
123
|
-
const users = (0, UserClientsUtil_1.
|
|
81
|
+
const users = (0, UserClientsUtil_1.flattenUserMap)(recipients);
|
|
124
82
|
for (const user of users) {
|
|
125
83
|
const { userId, data } = user;
|
|
126
84
|
const clients = Array.isArray(data) ? data : Object.keys(data);
|
|
127
85
|
for (const clientId of clients) {
|
|
128
|
-
const sessionId = constructSessionId({ userId, clientId
|
|
86
|
+
const sessionId = constructSessionId({ userId, clientId });
|
|
129
87
|
if (await cryptoClient.sessionExists(sessionId)) {
|
|
130
88
|
existingSessions.push(sessionId);
|
|
131
89
|
continue;
|
|
132
90
|
}
|
|
133
|
-
|
|
134
|
-
|
|
91
|
+
if (!Array.isArray(data)) {
|
|
92
|
+
const domainMissingWithPrekey = (_a = missingClientsWithPrekeys[userId.domain]) !== null && _a !== void 0 ? _a : {};
|
|
93
|
+
domainMissingWithPrekey[userId.id] = (_b = domainMissingWithPrekey[userId.id]) !== null && _b !== void 0 ? _b : {};
|
|
94
|
+
domainMissingWithPrekey[userId.id][clientId] = data[clientId];
|
|
95
|
+
missingClientsWithPrekeys[userId.domain] = domainMissingWithPrekey;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const domainMissing = (_c = missingClients[userId.domain]) !== null && _c !== void 0 ? _c : {};
|
|
99
|
+
domainMissing[userId.id] = domainMissing[userId.id] || [];
|
|
100
|
+
domainMissing[userId.id].push(clientId);
|
|
101
|
+
missingClients[userId.domain] = domainMissing;
|
|
135
102
|
}
|
|
136
103
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
104
|
+
const { sessions: prekeyCreated, unknowns: prekeyUnknows } = Object.keys(missingClientsWithPrekeys).length > 0
|
|
105
|
+
? await createSessionsFromPreKeys({
|
|
106
|
+
recipients: missingClientsWithPrekeys,
|
|
107
|
+
cryptoClient,
|
|
108
|
+
})
|
|
109
|
+
: { sessions: [], unknowns: {} };
|
|
110
|
+
const { sessions: created, failed, unknowns, } = Object.keys(missingClients).length > 0
|
|
111
|
+
? await createSessions({
|
|
112
|
+
recipients: missingClients,
|
|
113
|
+
apiClient,
|
|
114
|
+
cryptoClient,
|
|
115
|
+
logger,
|
|
116
|
+
})
|
|
117
|
+
: { sessions: [], failed: undefined, unknowns: undefined };
|
|
118
|
+
const allUnknowns = Object.assign(Object.assign({}, prekeyUnknows), unknowns);
|
|
119
|
+
return {
|
|
120
|
+
sessions: [...existingSessions, ...prekeyCreated, ...created],
|
|
121
|
+
failed,
|
|
122
|
+
unknowns: Object.keys(allUnknowns).length > 0 ? allUnknowns : undefined,
|
|
123
|
+
};
|
|
148
124
|
};
|
|
149
125
|
exports.initSessions = initSessions;
|
|
150
126
|
async function deleteSession(params) {
|
|
@@ -152,34 +128,46 @@ async function deleteSession(params) {
|
|
|
152
128
|
await params.cryptoClient.deleteSession(sessionId);
|
|
153
129
|
}
|
|
154
130
|
exports.deleteSession = deleteSession;
|
|
155
|
-
const createSessionsFromPreKeys = async ({
|
|
131
|
+
const createSessionsFromPreKeys = async ({ recipients, cryptoClient, }) => {
|
|
132
|
+
var _a, _b;
|
|
156
133
|
const sessions = [];
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
for (const
|
|
160
|
-
const
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
134
|
+
const unknowns = {};
|
|
135
|
+
for (const domain in recipients) {
|
|
136
|
+
for (const userId in recipients[domain]) {
|
|
137
|
+
const userClients = recipients[domain][userId];
|
|
138
|
+
for (const clientId in userClients) {
|
|
139
|
+
const sessionId = constructSessionId({ userId: { id: userId, domain }, clientId });
|
|
140
|
+
const prekey = userClients[clientId];
|
|
141
|
+
if (!prekey) {
|
|
142
|
+
const domainUnknowns = (_a = unknowns[domain]) !== null && _a !== void 0 ? _a : {};
|
|
143
|
+
domainUnknowns[userId] = (_b = domainUnknowns[userId]) !== null && _b !== void 0 ? _b : [];
|
|
144
|
+
domainUnknowns[userId].push(clientId);
|
|
145
|
+
unknowns[domain] = domainUnknowns;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
const prekeyBuffer = bazinga64_1.Decoder.fromBase64(prekey.key).asBytes;
|
|
149
|
+
await cryptoClient.sessionFromPrekey(sessionId, prekeyBuffer);
|
|
150
|
+
await cryptoClient.saveSession(sessionId);
|
|
151
|
+
sessions.push(sessionId);
|
|
165
152
|
}
|
|
166
|
-
const prekeyBuffer = bazinga64_1.Decoder.fromBase64(prekey.key).asBytes;
|
|
167
|
-
await cryptoClient.sessionFromPrekey(sessionId, prekeyBuffer);
|
|
168
|
-
await cryptoClient.saveSession(sessionId);
|
|
169
|
-
sessions.push(sessionId);
|
|
170
153
|
}
|
|
171
154
|
}
|
|
172
|
-
return sessions;
|
|
155
|
+
return { sessions, unknowns };
|
|
173
156
|
};
|
|
174
157
|
/**
|
|
175
158
|
* creates an encrypted payload that can be sent to backend from a bunch of sessionIds/encrypted payload
|
|
176
159
|
*/
|
|
177
160
|
const buildEncryptedPayloads = (payloads) => {
|
|
178
161
|
return [...payloads].reduce((acc, [sessionId, payload]) => {
|
|
179
|
-
var _a;
|
|
180
|
-
const { userId, clientId } = parseSessionId(sessionId);
|
|
181
|
-
|
|
182
|
-
|
|
162
|
+
var _a, _b;
|
|
163
|
+
const { userId, domain, clientId } = parseSessionId(sessionId);
|
|
164
|
+
if (!domain) {
|
|
165
|
+
throw new Error('Invalid session ID');
|
|
166
|
+
}
|
|
167
|
+
const domainPayloads = (_a = acc[domain]) !== null && _a !== void 0 ? _a : {};
|
|
168
|
+
domainPayloads[userId] = (_b = domainPayloads[userId]) !== null && _b !== void 0 ? _b : {};
|
|
169
|
+
domainPayloads[userId][clientId] = payload;
|
|
170
|
+
acc[domain] = domainPayloads;
|
|
183
171
|
return acc;
|
|
184
172
|
}, {});
|
|
185
173
|
};
|
|
@@ -20,16 +20,29 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
const api_client_1 = require("@wireapp/api-client");
|
|
22
22
|
const SessionHandler_1 = require("./SessionHandler");
|
|
23
|
-
function generatePrekeys(
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
function generatePrekeys(recipients) {
|
|
24
|
+
const prekeys = {};
|
|
25
|
+
const failed = [];
|
|
26
|
+
Object.entries(recipients).forEach(([domain, userClients]) => {
|
|
27
|
+
Object.entries(userClients).forEach(([userId, clientIds]) => {
|
|
28
|
+
if (domain.startsWith('offline:')) {
|
|
29
|
+
failed.push({ id: userId, domain });
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const domainUsers = prekeys[domain] || {};
|
|
33
|
+
domainUsers[userId] = clientIds.reduce((acc, clientId, index) => {
|
|
34
|
+
const payload = clientId.startsWith('deleted:')
|
|
35
|
+
? null
|
|
36
|
+
: {
|
|
37
|
+
id: index,
|
|
38
|
+
key: 'pQABARn//wKhAFggJ1Fbpg5l6wnzKOJE+vXpRnkqUYhIvVnR5lNXEbO2o/0DoQChAFggHxZvgvtDktY/vqBcpjjo6rQnXvcNQhfwmy8AJQJKlD0E9g==',
|
|
39
|
+
};
|
|
40
|
+
return Object.assign(Object.assign({}, acc), { [clientId]: payload });
|
|
41
|
+
}, {});
|
|
42
|
+
prekeys[domain] = domainUsers;
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
return Promise.resolve({ qualified_user_client_prekeys: prekeys, failed_to_list: failed });
|
|
33
46
|
}
|
|
34
47
|
describe('SessionHandler', () => {
|
|
35
48
|
const cryptoClient = {
|
|
@@ -40,43 +53,26 @@ describe('SessionHandler', () => {
|
|
|
40
53
|
deleteSession: jest.fn(),
|
|
41
54
|
};
|
|
42
55
|
const apiClient = new api_client_1.APIClient({ urls: api_client_1.APIClient.BACKEND.STAGING });
|
|
56
|
+
beforeAll(() => {
|
|
57
|
+
jest.spyOn(apiClient.api.user, 'postMultiPreKeyBundles').mockImplementation(generatePrekeys);
|
|
58
|
+
});
|
|
43
59
|
describe('constructSessionId', () => {
|
|
44
60
|
describe('constructs a session ID', () => {
|
|
45
61
|
it('without a domain', () => {
|
|
46
|
-
const sessionId = (0, SessionHandler_1.constructSessionId)({ userId: 'user-id', clientId: 'client-id'
|
|
62
|
+
const sessionId = (0, SessionHandler_1.constructSessionId)({ userId: { id: 'user-id', domain: '' }, clientId: 'client-id' });
|
|
47
63
|
expect(sessionId).toBe('user-id@client-id');
|
|
48
64
|
});
|
|
49
65
|
it('with a domain', () => {
|
|
50
|
-
const sessionId = (0, SessionHandler_1.constructSessionId)({
|
|
51
|
-
userId: 'user-id',
|
|
52
|
-
clientId: 'client-id',
|
|
53
|
-
domain: 'domain',
|
|
54
|
-
useQualifiedIds: true,
|
|
55
|
-
});
|
|
56
|
-
expect(sessionId).toBe('domain@user-id@client-id');
|
|
57
|
-
});
|
|
58
|
-
it('with a domain and useQualifiedIds', () => {
|
|
59
|
-
const sessionId = (0, SessionHandler_1.constructSessionId)({
|
|
60
|
-
userId: 'user-id',
|
|
61
|
-
clientId: 'client-id',
|
|
62
|
-
domain: 'domain',
|
|
63
|
-
useQualifiedIds: true,
|
|
64
|
-
});
|
|
65
|
-
expect(sessionId).toBe('domain@user-id@client-id');
|
|
66
|
-
});
|
|
67
|
-
it('with a qualified ID', () => {
|
|
68
66
|
const sessionId = (0, SessionHandler_1.constructSessionId)({
|
|
69
67
|
userId: { id: 'user-id', domain: 'domain' },
|
|
70
68
|
clientId: 'client-id',
|
|
71
|
-
useQualifiedIds: true,
|
|
72
69
|
});
|
|
73
70
|
expect(sessionId).toBe('domain@user-id@client-id');
|
|
74
71
|
});
|
|
75
|
-
it('with a qualified ID
|
|
72
|
+
it('with a qualified ID', () => {
|
|
76
73
|
const sessionId = (0, SessionHandler_1.constructSessionId)({
|
|
77
74
|
userId: { id: 'user-id', domain: 'domain' },
|
|
78
75
|
clientId: 'client-id',
|
|
79
|
-
useQualifiedIds: true,
|
|
80
76
|
});
|
|
81
77
|
expect(sessionId).toBe('domain@user-id@client-id');
|
|
82
78
|
});
|
|
@@ -92,27 +88,9 @@ describe('SessionHandler', () => {
|
|
|
92
88
|
const userId = { id: 'user1', domain: 'domain' };
|
|
93
89
|
const clientId = 'client1';
|
|
94
90
|
jest.spyOn(cryptoClient, 'sessionExists').mockResolvedValue(false);
|
|
95
|
-
jest
|
|
96
|
-
.spyOn(apiClient.api.user, 'postQualifiedMultiPreKeyBundles')
|
|
97
|
-
.mockResolvedValue({ domain: generatePrekeys(userId, [clientId]) });
|
|
98
|
-
const sessionId = (0, SessionHandler_1.constructSessionId)({
|
|
99
|
-
userId,
|
|
100
|
-
clientId,
|
|
101
|
-
useQualifiedIds: true,
|
|
102
|
-
});
|
|
103
|
-
await (0, SessionHandler_1.initSession)({ userId, clientId }, { apiClient, cryptoClient });
|
|
104
|
-
expect(cryptoClient.sessionFromPrekey).toHaveBeenCalledWith(sessionId, expect.any(Object));
|
|
105
|
-
});
|
|
106
|
-
it('indicates the consumer if a session could not be created', async () => {
|
|
107
|
-
const userId = { id: 'user1', domain: 'domain' };
|
|
108
|
-
const clientId = 'client1';
|
|
109
|
-
jest
|
|
110
|
-
.spyOn(apiClient.api.user, 'postQualifiedMultiPreKeyBundles')
|
|
111
|
-
.mockResolvedValue({ domain: generatePrekeys(userId, [clientId]) });
|
|
112
91
|
const sessionId = (0, SessionHandler_1.constructSessionId)({
|
|
113
92
|
userId,
|
|
114
93
|
clientId,
|
|
115
|
-
useQualifiedIds: true,
|
|
116
94
|
});
|
|
117
95
|
await (0, SessionHandler_1.initSession)({ userId, clientId }, { apiClient, cryptoClient });
|
|
118
96
|
expect(cryptoClient.sessionFromPrekey).toHaveBeenCalledWith(sessionId, expect.any(Object));
|
|
@@ -128,19 +106,57 @@ describe('SessionHandler', () => {
|
|
|
128
106
|
'missing-user1': ['client1'],
|
|
129
107
|
'missing-user2': ['client1', 'client2'],
|
|
130
108
|
};
|
|
131
|
-
jest.spyOn(apiClient.api.user, 'postQualifiedMultiPreKeyBundles').mockResolvedValue({});
|
|
132
|
-
jest.spyOn(apiClient.api.user, 'postMultiPreKeyBundles').mockResolvedValue(Object.assign(Object.assign({}, generatePrekeys({ id: 'missing-user1', domain: '' }, ['client1'])), generatePrekeys({ id: 'missing-user2', domain: '' }, ['client1', 'client2'])));
|
|
133
109
|
jest
|
|
134
110
|
.spyOn(cryptoClient, 'sessionExists')
|
|
135
111
|
.mockImplementation(sessionId => Promise.resolve(sessionId.includes('missing')));
|
|
136
112
|
const sessionFromPrekeySpy = jest.spyOn(cryptoClient, 'sessionFromPrekey');
|
|
137
|
-
const sessions = await (0, SessionHandler_1.initSessions)({
|
|
138
|
-
recipients: Object.assign(Object.assign({}, existingUserClients), missingUserClients),
|
|
113
|
+
const { sessions } = await (0, SessionHandler_1.initSessions)({
|
|
114
|
+
recipients: { domain: Object.assign(Object.assign({}, existingUserClients), missingUserClients) },
|
|
139
115
|
apiClient,
|
|
140
116
|
cryptoClient,
|
|
141
117
|
});
|
|
142
118
|
expect(sessionFromPrekeySpy).toHaveBeenCalledTimes(3);
|
|
143
119
|
expect(sessions).toHaveLength(6);
|
|
144
120
|
});
|
|
121
|
+
it('returns the list of deleted clients (clients with null prekeys)', async () => {
|
|
122
|
+
const userClients = {
|
|
123
|
+
'existing-user1': ['client1', 'deleted:client2'],
|
|
124
|
+
};
|
|
125
|
+
const { sessions, unknowns } = await (0, SessionHandler_1.initSessions)({
|
|
126
|
+
recipients: { domain: userClients },
|
|
127
|
+
apiClient,
|
|
128
|
+
cryptoClient,
|
|
129
|
+
});
|
|
130
|
+
expect(sessions).toEqual(['domain@existing-user1@client1']);
|
|
131
|
+
expect(unknowns).toEqual({ domain: { 'existing-user1': ['deleted:client2'] } });
|
|
132
|
+
});
|
|
133
|
+
it('initializes sessions across multiple domains', async () => {
|
|
134
|
+
const userClients = {
|
|
135
|
+
domain1: { 'existing-user1': ['client11'] },
|
|
136
|
+
domain2: { 'existing-user2': ['client21'] },
|
|
137
|
+
};
|
|
138
|
+
jest.spyOn(cryptoClient, 'sessionExists').mockResolvedValue(true);
|
|
139
|
+
const { sessions, unknowns } = await (0, SessionHandler_1.initSessions)({
|
|
140
|
+
recipients: userClients,
|
|
141
|
+
apiClient,
|
|
142
|
+
cryptoClient,
|
|
143
|
+
});
|
|
144
|
+
expect(sessions).toEqual(['domain1@existing-user1@client11', 'domain2@existing-user2@client21']);
|
|
145
|
+
expect(unknowns).toBeUndefined();
|
|
146
|
+
});
|
|
147
|
+
it('returns failed session creation', async () => {
|
|
148
|
+
const recipients = {
|
|
149
|
+
domain1: { 'existing-user1': ['client1'] },
|
|
150
|
+
'offline:domain': { user2: ['client12'] },
|
|
151
|
+
};
|
|
152
|
+
jest.spyOn(cryptoClient, 'sessionExists').mockResolvedValue(false);
|
|
153
|
+
const { sessions, failed } = await (0, SessionHandler_1.initSessions)({
|
|
154
|
+
recipients,
|
|
155
|
+
apiClient,
|
|
156
|
+
cryptoClient,
|
|
157
|
+
});
|
|
158
|
+
expect(sessions).toEqual(['domain1@existing-user1@client1']);
|
|
159
|
+
expect(failed).toEqual([{ id: 'user2', domain: 'offline:domain' }]);
|
|
160
|
+
});
|
|
145
161
|
});
|
|
146
162
|
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { APIClient } from '@wireapp/api-client/lib/APIClient';
|
|
2
|
-
import { QualifiedUserClients
|
|
3
|
-
import { QualifiedId, QualifiedUserPreKeyBundleMap
|
|
2
|
+
import { QualifiedUserClients } from '@wireapp/api-client/lib/conversation';
|
|
3
|
+
import { QualifiedId, QualifiedUserPreKeyBundleMap } from '@wireapp/api-client/lib/user';
|
|
4
4
|
import { GenericMessage } from '@wireapp/protocol-messaging';
|
|
5
5
|
import { MessageSendingOptions } from '../../../conversation';
|
|
6
|
-
export type
|
|
7
|
-
federated: true;
|
|
6
|
+
export type MessageParams = {
|
|
8
7
|
sendingClientId: string;
|
|
9
8
|
recipients: QualifiedUserClients | QualifiedUserPreKeyBundleMap;
|
|
10
9
|
plainText: Uint8Array;
|
|
@@ -14,22 +13,14 @@ export type FederatedMessageParams = {
|
|
|
14
13
|
reportMissing: boolean | QualifiedId[] | undefined;
|
|
15
14
|
};
|
|
16
15
|
};
|
|
17
|
-
export type MessageParams = Omit<FederatedMessageParams, 'recipients' | 'options' | 'federated'> & {
|
|
18
|
-
federated: false;
|
|
19
|
-
recipients: UserClients | UserPreKeyBundleMap;
|
|
20
|
-
options: Omit<FederatedMessageParams['options'], 'reportMissing'> & {
|
|
21
|
-
reportMissing: boolean | string[] | undefined;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
16
|
interface GetGenericMessageParamsParams {
|
|
25
17
|
sendingClientId: string;
|
|
26
18
|
conversationId: QualifiedId;
|
|
27
19
|
genericMessage: GenericMessage;
|
|
28
20
|
options: MessageSendingOptions;
|
|
29
|
-
useQualifiedIds: boolean;
|
|
30
21
|
apiClient: APIClient;
|
|
31
22
|
}
|
|
32
|
-
type GetGenericMessageParamsReturnType = Promise<MessageParams
|
|
33
|
-
declare const getGenericMessageParams: ({ sendingClientId, conversationId, genericMessage, options: { targetMode, userIds, nativePush },
|
|
23
|
+
type GetGenericMessageParamsReturnType = Promise<MessageParams>;
|
|
24
|
+
declare const getGenericMessageParams: ({ sendingClientId, conversationId, genericMessage, options: { targetMode, userIds, nativePush }, apiClient, }: GetGenericMessageParamsParams) => GetGenericMessageParamsReturnType;
|
|
34
25
|
export { getGenericMessageParams };
|
|
35
26
|
//# sourceMappingURL=getGenericMessageParams.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getGenericMessageParams.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/Utility/getGenericMessageParams.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"getGenericMessageParams.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/Utility/getGenericMessageParams.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAC,WAAW,EAAE,4BAA4B,EAAC,MAAM,8BAA8B,CAAC;AAEvF,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAK3D,OAAO,EAAoB,qBAAqB,EAAC,MAAM,uBAAuB,CAAC;AAG/E,MAAM,MAAM,aAAa,GAAG;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,oBAAoB,GAAG,4BAA4B,CAAC;IAChE,SAAS,EAAE,UAAU,CAAC;IACtB,OAAO,EAAE;QACP,cAAc,EAAE,WAAW,CAAC;QAC5B,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;QAChC,aAAa,EAAE,OAAO,GAAG,WAAW,EAAE,GAAG,SAAS,CAAC;KACpD,CAAC;CACH,CAAC;AACF,UAAU,6BAA6B;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,WAAW,CAAC;IAC5B,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,SAAS,EAAE,SAAS,CAAC;CACtB;AACD,KAAK,iCAAiC,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAEhE,QAAA,MAAM,uBAAuB,kHAM1B,6BAA6B,sCA0B/B,CAAC;AAEF,OAAO,EAAC,uBAAuB,EAAC,CAAC"}
|
|
@@ -24,56 +24,24 @@ const Recipients_1 = require("./Recipients");
|
|
|
24
24
|
const UserIds_1 = require("./UserIds");
|
|
25
25
|
const conversation_1 = require("../../../conversation");
|
|
26
26
|
const util_1 = require("../../../util");
|
|
27
|
-
const getGenericMessageParams = async ({ sendingClientId, conversationId, genericMessage, options: { targetMode = conversation_1.MessageTargetMode.NONE, userIds, nativePush },
|
|
27
|
+
const getGenericMessageParams = async ({ sendingClientId, conversationId, genericMessage, options: { targetMode = conversation_1.MessageTargetMode.NONE, userIds, nativePush }, apiClient, }) => {
|
|
28
28
|
const plainText = protocol_messaging_1.GenericMessage.encode(genericMessage).finish();
|
|
29
29
|
if (targetMode !== conversation_1.MessageTargetMode.NONE && !userIds) {
|
|
30
30
|
throw new Error('Cannot send targetted message when no userIds are given');
|
|
31
31
|
}
|
|
32
|
-
if (conversationId.domain && useQualifiedIds) {
|
|
33
|
-
if ((0, util_1.isStringArray)(userIds) || (0, util_1.isUserClients)(userIds)) {
|
|
34
|
-
throw new Error('Invalid userIds option for sending to federated backend');
|
|
35
|
-
}
|
|
36
|
-
const recipients = await (0, Recipients_1.getQualifiedRecipientsForConversation)({ apiClient, conversationId, userIds });
|
|
37
|
-
let reportMissing;
|
|
38
|
-
if (targetMode === conversation_1.MessageTargetMode.NONE) {
|
|
39
|
-
reportMissing = (0, util_1.isQualifiedUserClients)(userIds); // we want to check mismatch in case the consumer gave an exact list of users/devices
|
|
40
|
-
}
|
|
41
|
-
else if (targetMode === conversation_1.MessageTargetMode.USERS) {
|
|
42
|
-
reportMissing = (0, UserIds_1.extractQualifiedUserIds)({ userIds });
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
// in case the message is fully targetted at user/client pairs, we do not want to report the missing clients or users at all
|
|
46
|
-
reportMissing = false;
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
federated: true,
|
|
50
|
-
sendingClientId,
|
|
51
|
-
recipients,
|
|
52
|
-
plainText,
|
|
53
|
-
options: {
|
|
54
|
-
conversationId,
|
|
55
|
-
nativePush,
|
|
56
|
-
reportMissing,
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
if ((0, util_1.isQualifiedIdArray)(userIds) || (0, util_1.isQualifiedUserClients)(userIds)) {
|
|
61
|
-
throw new Error('Invalid userIds option for sending');
|
|
62
|
-
}
|
|
63
32
|
const recipients = await (0, Recipients_1.getRecipientsForConversation)({ apiClient, conversationId, userIds });
|
|
64
33
|
let reportMissing;
|
|
65
34
|
if (targetMode === conversation_1.MessageTargetMode.NONE) {
|
|
66
|
-
reportMissing = (0, util_1.
|
|
35
|
+
reportMissing = (0, util_1.isQualifiedUserClients)(userIds); // we want to check mismatch in case the consumer gave an exact list of users/devices
|
|
67
36
|
}
|
|
68
37
|
else if (targetMode === conversation_1.MessageTargetMode.USERS) {
|
|
69
|
-
reportMissing = (0, UserIds_1.
|
|
38
|
+
reportMissing = (0, UserIds_1.extractQualifiedUserIds)({ userIds });
|
|
70
39
|
}
|
|
71
40
|
else {
|
|
72
41
|
// in case the message is fully targetted at user/client pairs, we do not want to report the missing clients or users at all
|
|
73
42
|
reportMissing = false;
|
|
74
43
|
}
|
|
75
44
|
return {
|
|
76
|
-
federated: false,
|
|
77
45
|
sendingClientId,
|
|
78
46
|
recipients,
|
|
79
47
|
plainText,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const isClearFromMismatch: (mismatch:
|
|
1
|
+
import { MessageSendingStatus } from '@wireapp/api-client/lib/conversation';
|
|
2
|
+
declare const isClearFromMismatch: (mismatch: MessageSendingStatus) => boolean;
|
|
3
3
|
export { isClearFromMismatch };
|
|
4
4
|
//# sourceMappingURL=isClearFromMismatch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isClearFromMismatch.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/Utility/isClearFromMismatch.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"isClearFromMismatch.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/Utility/isClearFromMismatch.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAE1E,QAAA,MAAM,mBAAmB,aAAc,oBAAoB,KAAG,OAM7D,CAAC;AAEF,OAAO,EAAC,mBAAmB,EAAC,CAAC"}
|
|
@@ -27,7 +27,7 @@ var DatabaseKeys;
|
|
|
27
27
|
(function (DatabaseKeys) {
|
|
28
28
|
DatabaseKeys["PRIMARY_KEY_LAST_EVENT"] = "z.storage.StorageKey.EVENT.LAST_DATE";
|
|
29
29
|
DatabaseKeys["PRIMARY_KEY_LAST_NOTIFICATION"] = "z.storage.StorageKey.NOTIFICATION.LAST_ID";
|
|
30
|
-
})(DatabaseKeys
|
|
30
|
+
})(DatabaseKeys || (exports.DatabaseKeys = DatabaseKeys = {}));
|
|
31
31
|
const STORES = {
|
|
32
32
|
AMPLIFY: 'amplify',
|
|
33
33
|
};
|
|
@@ -24,4 +24,4 @@ var NotificationSource;
|
|
|
24
24
|
NotificationSource["LOCAL"] = "LOCAL";
|
|
25
25
|
NotificationSource["NOTIFICATION_STREAM"] = "NOTIFICATION_STREAM";
|
|
26
26
|
NotificationSource["WEBSOCKET"] = "WEBSOCKET";
|
|
27
|
-
})(NotificationSource
|
|
27
|
+
})(NotificationSource || (exports.NotificationSource = NotificationSource = {}));
|
|
@@ -1,24 +1,13 @@
|
|
|
1
1
|
import { QualifiedId, User } from '@wireapp/api-client/lib/user/';
|
|
2
2
|
import { APIClient } from '@wireapp/api-client';
|
|
3
|
-
import { AvailabilityType, BroadcastService } from '../broadcast/';
|
|
4
|
-
import { ConnectionService } from '../connection';
|
|
5
3
|
export declare class UserService {
|
|
6
4
|
private readonly apiClient;
|
|
7
|
-
|
|
8
|
-
private readonly connectionService;
|
|
9
|
-
constructor(apiClient: APIClient, broadcastService: BroadcastService, connectionService: ConnectionService);
|
|
5
|
+
constructor(apiClient: APIClient);
|
|
10
6
|
getUser(userId: string | QualifiedId): Promise<User>;
|
|
11
|
-
getUsers(userIds:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* @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
|
|
17
|
-
* @param options.sendAsProtobuf=false
|
|
18
|
-
*/
|
|
19
|
-
setAvailability(teamId: string, type: AvailabilityType, { sendAll, sendAsProtobuf }?: {
|
|
20
|
-
sendAll?: boolean | undefined;
|
|
21
|
-
sendAsProtobuf?: boolean | undefined;
|
|
22
|
-
}): Promise<void>;
|
|
7
|
+
getUsers(userIds: QualifiedId[]): Promise<{
|
|
8
|
+
found: User[];
|
|
9
|
+
failed?: QualifiedId[] | undefined;
|
|
10
|
+
not_found?: QualifiedId[] | undefined;
|
|
11
|
+
} | never[]>;
|
|
23
12
|
}
|
|
24
13
|
//# sourceMappingURL=UserService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserService.d.ts","sourceRoot":"","sources":["../../src/user/UserService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UserService.d.ts","sourceRoot":"","sources":["../../src/user/UserService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAE,IAAI,EAAC,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAE1B,SAAS,EAAE,SAAS;IAIzB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE;;;;;CAM7C"}
|