@wireapp/core 38.14.3 → 38.15.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.map +1 -1
- package/lib/Account.js +2 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +6 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +8 -2
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +26 -9
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.d.ts +18 -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/package.json +3 -3
- 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/Account.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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B,GAAG,SAAS,CAAC;YAoC3E,iBAAiB;IAoB/B;;;;;;OAMG;IACH,qBAAqB,CAAC,YAAY,EAAE,YAAY;IAInC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAwD1D,OAAO,CAAC,YAAY;IAKpB;;;OAGG;IACU,MAAM,CAAC,SAAS,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAS9D;;OAEG;YACW,IAAI;IAOlB;;;;;;OAMG;IACI,MAAM,CAAC,EACZ,OAAkB,EAClB,wBAAmC,EACnC,4BAAuC,EACvC,qBAAgC,EAChC,MAAc,GACf,GAAE;QACD;;;;WAIG;QACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;QAE7E;;WAEG;QACH,4BAA4B,CAAC,EAAE,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,EAAE;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAC,KAAK,IAAI,CAAC;QAEtF;;WAEG;QACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;QAE5D;;;;;;WAMG;QACH,qBAAqB,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;QAEzD;;WAEG;QACH,MAAM,CAAC,EAAE,OAAO,CAAC;KACb,GAAG,MAAM,IAAI;IA2FnB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,kBAAkB;YAIZ,UAAU;CAqBzB"}
|
package/lib/Account.js
CHANGED
|
@@ -215,6 +215,8 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
215
215
|
this.service.mls.checkForKeyMaterialsUpdate();
|
|
216
216
|
// initialize scheduler for syncing key packages with backend
|
|
217
217
|
this.service.mls.checkForKeyPackagesBackendSync();
|
|
218
|
+
// leave stale conference subconversations (e.g after a crash)
|
|
219
|
+
await this.service.mls.leaveStaleConferenceSubconversations();
|
|
218
220
|
}
|
|
219
221
|
return validClient;
|
|
220
222
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageAdd.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAE,8BAA8B,EAAqB,MAAM,+BAA+B,CAAC;AAK/G,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAE5D,QAAA,MAAM,oBAAoB,UAAW,YAAY,4CACE,CAAC;AAEpD,UAAU,yBAA0B,SAAQ,kBAAkB;IAC5D,KAAK,EAAE,8BAA8B,CAAC;CACvC;AACD,QAAA,MAAM,mBAAmB,0BACF,yBAAyB,4BACpB,MAAM,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"messageAdd.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAE,8BAA8B,EAAqB,MAAM,+BAA+B,CAAC;AAK/G,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAE5D,QAAA,MAAM,oBAAoB,UAAW,YAAY,4CACE,CAAC;AAEpD,UAAU,yBAA0B,SAAQ,kBAAkB;IAC5D,KAAK,EAAE,8BAA8B,CAAC;CACvC;AACD,QAAA,MAAM,mBAAmB,0BACF,yBAAyB,4BACpB,MAAM,KAAK,IAAI,uBA8C1C,CAAC;AAEF,OAAO,EAAC,oBAAoB,EAAE,mBAAmB,EAAC,CAAC"}
|
|
@@ -28,7 +28,12 @@ exports.isMLSMessageAddEvent = isMLSMessageAddEvent;
|
|
|
28
28
|
const handleMLSMessageAdd = async ({ mlsService, event }, onEpochChanged) => {
|
|
29
29
|
var _a;
|
|
30
30
|
const encryptedData = bazinga64_1.Decoder.fromBase64(event.data).asBytes;
|
|
31
|
-
const
|
|
31
|
+
const qualifiedConversationId = (_a = event.qualified_conversation) !== null && _a !== void 0 ? _a : { id: event.conversation, domain: '' };
|
|
32
|
+
const groupId = await mlsService.getGroupIdFromConversationId(qualifiedConversationId, event.subconv);
|
|
33
|
+
// We should not receive a message for a group the client is not aware of
|
|
34
|
+
if (!groupId) {
|
|
35
|
+
throw new Error(`Could not find a group_id for conversation ${qualifiedConversationId.id}@${qualifiedConversationId.domain}`);
|
|
36
|
+
}
|
|
32
37
|
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
33
38
|
const { proposals, commitDelay, message, senderClientId: encodedSenderClientId, hasEpochChanged, } = await mlsService.decryptMessage(groupIdBytes, encryptedData);
|
|
34
39
|
if (encodedSenderClientId) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PostMlsMessageResponse } from '@wireapp/api-client/lib/conversation';
|
|
1
|
+
import { PostMlsMessageResponse, SUBCONVERSATION_ID } from '@wireapp/api-client/lib/conversation';
|
|
2
2
|
import { Subconversation } from '@wireapp/api-client/lib/conversation/Subconversation';
|
|
3
3
|
import { QualifiedId } from '@wireapp/api-client/lib/user';
|
|
4
4
|
import logdown from 'logdown';
|
|
@@ -42,7 +42,13 @@ export declare class MLSService extends TypedEventEmitter<Events> {
|
|
|
42
42
|
joinByExternalCommit(getGroupInfo: () => Promise<Uint8Array>): Promise<PostMlsMessageResponse | null>;
|
|
43
43
|
getConferenceSubconversation(conversationId: QualifiedId): Promise<Subconversation>;
|
|
44
44
|
private deleteConferenceSubconversation;
|
|
45
|
+
/**
|
|
46
|
+
* Will leave conference subconversation if it's known by client and established.
|
|
47
|
+
*
|
|
48
|
+
* @param conversationId Id of the parent conversation which subconversation we want to leave
|
|
49
|
+
*/
|
|
45
50
|
leaveConferenceSubconversation(conversationId: QualifiedId): Promise<void>;
|
|
51
|
+
leaveStaleConferenceSubconversations(): Promise<void>;
|
|
46
52
|
/**
|
|
47
53
|
* Will join or register an mls subconversation for conference calls.
|
|
48
54
|
* Will return the secret key derived from the subconversation
|
|
@@ -134,7 +140,7 @@ export declare class MLSService extends TypedEventEmitter<Events> {
|
|
|
134
140
|
*
|
|
135
141
|
* @param conversationQualifiedId
|
|
136
142
|
*/
|
|
137
|
-
getGroupIdFromConversationId(conversationQualifiedId: QualifiedId, subconversationId?:
|
|
143
|
+
getGroupIdFromConversationId(conversationQualifiedId: QualifiedId, subconversationId?: SUBCONVERSATION_ID): Promise<string | undefined>;
|
|
138
144
|
/**
|
|
139
145
|
* If there are pending proposals, we need to either process them,
|
|
140
146
|
* or save them in the database for later processing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,sBAAsB,EAAE,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AAChG,OAAO,EAAC,eAAe,EAAC,MAAM,sDAAsD,CAAC;AACrF,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAIzD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EACL,eAAe,EAGf,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B,EAC1B,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAC,gBAAgB,EAAsB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,OAAO,EAAE,SAAS,EAAC,EAAE,4BAA4B;IAoBjG;;;;;OAKG;IACU,sBAAsB,CAAC,EAAC,OAAO,EAAE,UAAkB,EAAC,EAAE,4BAA4B;IAa/F;;;;OAIG;IACU,6BAA6B;IAiB1C;;;;OAIG;IACU,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;CAW1G"}
|
|
@@ -42,7 +42,7 @@ const commons_1 = require("@wireapp/commons");
|
|
|
42
42
|
const commitBundleUtil_1 = require("./commitBundleUtil");
|
|
43
43
|
const keyMaterialUpdatesStore_1 = require("./stores/keyMaterialUpdatesStore");
|
|
44
44
|
const pendingProposalsStore_1 = require("./stores/pendingProposalsStore");
|
|
45
|
-
const
|
|
45
|
+
const subconversationGroupIdStore_1 = require("./stores/subconversationGroupIdStore/subconversationGroupIdStore");
|
|
46
46
|
const messageSender_1 = require("../../../conversation/message/messageSender");
|
|
47
47
|
const fullyQualifiedClientIdUtils_1 = require("../../../util/fullyQualifiedClientIdUtils");
|
|
48
48
|
const RecurringTaskScheduler_1 = require("../../../util/RecurringTaskScheduler");
|
|
@@ -181,14 +181,35 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
181
181
|
async deleteConferenceSubconversation(conversationId, data) {
|
|
182
182
|
return this.apiClient.api.conversation.deleteSubconversation(conversationId, conversation_1.SUBCONVERSATION_ID.CONFERENCE, data);
|
|
183
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Will leave conference subconversation if it's known by client and established.
|
|
186
|
+
*
|
|
187
|
+
* @param conversationId Id of the parent conversation which subconversation we want to leave
|
|
188
|
+
*/
|
|
184
189
|
async leaveConferenceSubconversation(conversationId) {
|
|
185
190
|
const subconversationGroupId = await this.getGroupIdFromConversationId(conversationId, conversation_1.SUBCONVERSATION_ID.CONFERENCE);
|
|
191
|
+
if (!subconversationGroupId) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
186
194
|
const isSubconversationEstablished = await this.conversationExists(subconversationGroupId);
|
|
187
195
|
if (!isSubconversationEstablished) {
|
|
188
196
|
return;
|
|
189
197
|
}
|
|
190
|
-
|
|
191
|
-
|
|
198
|
+
try {
|
|
199
|
+
await this.apiClient.api.conversation.deleteSubconversationSelf(conversationId, conversation_1.SUBCONVERSATION_ID.CONFERENCE);
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
this.logger.error(`Failed to leave conference subconversation:`, error);
|
|
203
|
+
}
|
|
204
|
+
await this.wipeConversation(subconversationGroupId);
|
|
205
|
+
// once we've left the subconversation, we can remove it from the store
|
|
206
|
+
subconversationGroupIdStore_1.subconversationGroupIdStore.removeGroupId(conversationId, conversation_1.SUBCONVERSATION_ID.CONFERENCE);
|
|
207
|
+
}
|
|
208
|
+
async leaveStaleConferenceSubconversations() {
|
|
209
|
+
const conversationIds = subconversationGroupIdStore_1.subconversationGroupIdStore.getAllGroupIdsBySubconversationId(conversation_1.SUBCONVERSATION_ID.CONFERENCE);
|
|
210
|
+
for (const { parentConversation } of conversationIds) {
|
|
211
|
+
await this.leaveConferenceSubconversation(parentConversation);
|
|
212
|
+
}
|
|
192
213
|
}
|
|
193
214
|
/**
|
|
194
215
|
* Will join or register an mls subconversation for conference calls.
|
|
@@ -218,7 +239,7 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
218
239
|
}
|
|
219
240
|
const epoch = Number(await this.getEpoch(subconversation.group_id));
|
|
220
241
|
// We store the mapping between the subconversation and the parent conversation
|
|
221
|
-
|
|
242
|
+
subconversationGroupIdStore_1.subconversationGroupIdStore.storeGroupId(conversationId, subconversation.subconv_id, subconversation.group_id);
|
|
222
243
|
return { groupId: subconversation.group_id, epoch };
|
|
223
244
|
}
|
|
224
245
|
async exportSecretKey(groupId, keyLength) {
|
|
@@ -426,13 +447,9 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
426
447
|
*/
|
|
427
448
|
async getGroupIdFromConversationId(conversationQualifiedId, subconversationId) {
|
|
428
449
|
var _a;
|
|
429
|
-
const { id: conversationId, domain: conversationDomain } = conversationQualifiedId;
|
|
430
450
|
const groupId = subconversationId
|
|
431
|
-
?
|
|
451
|
+
? subconversationGroupIdStore_1.subconversationGroupIdStore.getGroupId(conversationQualifiedId, subconversationId)
|
|
432
452
|
: await ((_a = this.groupIdFromConversationId) === null || _a === void 0 ? void 0 : _a.call(this, conversationQualifiedId));
|
|
433
|
-
if (!groupId) {
|
|
434
|
-
throw new Error(`Could not find a group_id for conversation ${conversationId}@${conversationDomain}`);
|
|
435
|
-
}
|
|
436
453
|
return groupId;
|
|
437
454
|
}
|
|
438
455
|
/**
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SUBCONVERSATION_ID } from '@wireapp/api-client/lib/conversation';
|
|
2
|
+
import { QualifiedId } from '@wireapp/api-client/lib/user';
|
|
3
|
+
declare function storeGroupId(parentConversation: QualifiedId, subconversation: SUBCONVERSATION_ID, subgroupId: string): void;
|
|
4
|
+
declare function getGroupId(parentConversation: QualifiedId, subconversation: SUBCONVERSATION_ID): string | undefined;
|
|
5
|
+
declare function getAllGroupIdsBySubconversationId(subconversationId: SUBCONVERSATION_ID): {
|
|
6
|
+
subconversationGroupId: string;
|
|
7
|
+
parentConversation: QualifiedId;
|
|
8
|
+
subconversation: string;
|
|
9
|
+
}[];
|
|
10
|
+
declare function removeGroupId(parentConversation: QualifiedId, subconversation: SUBCONVERSATION_ID): void;
|
|
11
|
+
export declare const subconversationGroupIdStore: {
|
|
12
|
+
storeGroupId: typeof storeGroupId;
|
|
13
|
+
getGroupId: typeof getGroupId;
|
|
14
|
+
removeGroupId: typeof removeGroupId;
|
|
15
|
+
getAllGroupIdsBySubconversationId: typeof getAllGroupIdsBySubconversationId;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=subconversationGroupIdStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subconversationGroupIdStore.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAkCzD,iBAAS,YAAY,CAAC,kBAAkB,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAGpH;AAED,iBAAS,UAAU,CAAC,kBAAkB,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,GAAG,MAAM,GAAG,SAAS,CAG5G;AAED,iBAAS,iCAAiC,CAAC,iBAAiB,EAAE,kBAAkB;;;;IAO/E;AAED,iBAAS,aAAa,CAAC,kBAAkB,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,QAG1F;AAED,eAAO,MAAM,2BAA2B;;;;;CAKvC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
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.subconversationGroupIdStore = void 0;
|
|
22
|
+
const storageKey = 'subconversationGroupIdStore';
|
|
23
|
+
function generateSubconversationId(parentConversation, subconversation) {
|
|
24
|
+
return `${parentConversation.id}@${parentConversation.domain}:${subconversation}`;
|
|
25
|
+
}
|
|
26
|
+
function parseSubconversationId(subconversationId) {
|
|
27
|
+
const [parentConversationId, subconversation] = subconversationId.split(':');
|
|
28
|
+
const [id, domain] = parentConversationId.split('@');
|
|
29
|
+
return { parentConversation: { domain, id }, subconversation };
|
|
30
|
+
}
|
|
31
|
+
const getCurrentMap = () => {
|
|
32
|
+
const storedEntry = localStorage.getItem(storageKey);
|
|
33
|
+
return storedEntry ? new Map(JSON.parse(storedEntry)) : new Map();
|
|
34
|
+
};
|
|
35
|
+
const addItemToMap = (subconversationId, subgroupId) => {
|
|
36
|
+
const currentMap = getCurrentMap();
|
|
37
|
+
currentMap.set(subconversationId, subgroupId);
|
|
38
|
+
localStorage.setItem(storageKey, JSON.stringify(Array.from(currentMap.entries())));
|
|
39
|
+
};
|
|
40
|
+
const removeItemFromMap = (subconversationId) => {
|
|
41
|
+
const currentMap = getCurrentMap();
|
|
42
|
+
currentMap.delete(subconversationId);
|
|
43
|
+
localStorage.setItem(storageKey, JSON.stringify(Array.from(currentMap.entries())));
|
|
44
|
+
};
|
|
45
|
+
function storeGroupId(parentConversation, subconversation, subgroupId) {
|
|
46
|
+
const subconversationId = generateSubconversationId(parentConversation, subconversation);
|
|
47
|
+
addItemToMap(subconversationId, subgroupId);
|
|
48
|
+
}
|
|
49
|
+
function getGroupId(parentConversation, subconversation) {
|
|
50
|
+
const subconversationId = generateSubconversationId(parentConversation, subconversation);
|
|
51
|
+
return getCurrentMap().get(subconversationId);
|
|
52
|
+
}
|
|
53
|
+
function getAllGroupIdsBySubconversationId(subconversationId) {
|
|
54
|
+
return Array.from(getCurrentMap().entries())
|
|
55
|
+
.map(([subconversationId, subconversationGroupId]) => (Object.assign(Object.assign({}, parseSubconversationId(subconversationId)), { subconversationGroupId })))
|
|
56
|
+
.filter(({ subconversation }) => subconversation === subconversationId);
|
|
57
|
+
}
|
|
58
|
+
function removeGroupId(parentConversation, subconversation) {
|
|
59
|
+
const subconversationId = generateSubconversationId(parentConversation, subconversation);
|
|
60
|
+
return removeItemFromMap(subconversationId);
|
|
61
|
+
}
|
|
62
|
+
exports.subconversationGroupIdStore = {
|
|
63
|
+
storeGroupId,
|
|
64
|
+
getGroupId,
|
|
65
|
+
removeGroupId,
|
|
66
|
+
getAllGroupIdsBySubconversationId,
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subconversationGroupIdStore.test.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,72 @@
|
|
|
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 conversation_1 = require("@wireapp/api-client/lib/conversation");
|
|
22
|
+
const subconversationGroupIdStore_1 = require("./subconversationGroupIdStore");
|
|
23
|
+
describe('subconversationGroupIdMapper', () => {
|
|
24
|
+
it('returns empty groupId if conversation is not known', () => {
|
|
25
|
+
const groupId = subconversationGroupIdStore_1.subconversationGroupIdStore.getGroupId({ domain: 'example.com', id: '123' }, conversation_1.SUBCONVERSATION_ID.CONFERENCE);
|
|
26
|
+
expect(groupId).toBeUndefined();
|
|
27
|
+
});
|
|
28
|
+
it('returns the stored groupId', () => {
|
|
29
|
+
const conversationId = { domain: 'example.com', id: '123' };
|
|
30
|
+
const subconversation = conversation_1.SUBCONVERSATION_ID.CONFERENCE;
|
|
31
|
+
const groupId = 'groupID';
|
|
32
|
+
subconversationGroupIdStore_1.subconversationGroupIdStore.storeGroupId(conversationId, subconversation, groupId);
|
|
33
|
+
const result = subconversationGroupIdStore_1.subconversationGroupIdStore.getGroupId(conversationId, subconversation);
|
|
34
|
+
expect(result).toBe(groupId);
|
|
35
|
+
});
|
|
36
|
+
it('removes groupId from the store', () => {
|
|
37
|
+
const conversationId = { domain: 'example.com', id: '123' };
|
|
38
|
+
const subconversation = conversation_1.SUBCONVERSATION_ID.CONFERENCE;
|
|
39
|
+
const groupId = 'groupID';
|
|
40
|
+
subconversationGroupIdStore_1.subconversationGroupIdStore.storeGroupId(conversationId, subconversation, groupId);
|
|
41
|
+
expect(subconversationGroupIdStore_1.subconversationGroupIdStore.getGroupId(conversationId, subconversation)).toEqual(groupId);
|
|
42
|
+
subconversationGroupIdStore_1.subconversationGroupIdStore.removeGroupId(conversationId, subconversation);
|
|
43
|
+
expect(subconversationGroupIdStore_1.subconversationGroupIdStore.getGroupId(conversationId, subconversation)).toBeUndefined();
|
|
44
|
+
});
|
|
45
|
+
it('retrieves all entries from the store by subconversation id', () => {
|
|
46
|
+
const conversationId = { domain: 'example.com', id: '123' };
|
|
47
|
+
const subconversation = conversation_1.SUBCONVERSATION_ID.CONFERENCE;
|
|
48
|
+
const groupId = 'groupID';
|
|
49
|
+
const conversationId2 = { domain: 'example2.com', id: '1234' };
|
|
50
|
+
const subconversation2 = conversation_1.SUBCONVERSATION_ID.CONFERENCE;
|
|
51
|
+
const groupId2 = 'groupID2';
|
|
52
|
+
const conversationId3 = { domain: 'example3.com', id: '12345' };
|
|
53
|
+
const subconversation3 = 'none';
|
|
54
|
+
const groupId3 = 'groupID3';
|
|
55
|
+
subconversationGroupIdStore_1.subconversationGroupIdStore.storeGroupId(conversationId, subconversation, groupId);
|
|
56
|
+
subconversationGroupIdStore_1.subconversationGroupIdStore.storeGroupId(conversationId2, subconversation2, groupId2);
|
|
57
|
+
subconversationGroupIdStore_1.subconversationGroupIdStore.storeGroupId(conversationId3, subconversation3, groupId3);
|
|
58
|
+
const result = subconversationGroupIdStore_1.subconversationGroupIdStore.getAllGroupIdsBySubconversationId(conversation_1.SUBCONVERSATION_ID.CONFERENCE);
|
|
59
|
+
expect(result).toEqual([
|
|
60
|
+
{
|
|
61
|
+
parentConversation: conversationId,
|
|
62
|
+
subconversation: subconversation,
|
|
63
|
+
subconversationGroupId: groupId,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
parentConversation: conversationId2,
|
|
67
|
+
subconversation: subconversation2,
|
|
68
|
+
subconversationGroupId: groupId2,
|
|
69
|
+
},
|
|
70
|
+
]);
|
|
71
|
+
});
|
|
72
|
+
});
|
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": "^22.
|
|
14
|
+
"@wireapp/api-client": "^22.17.0",
|
|
15
15
|
"@wireapp/commons": "^5.0.4",
|
|
16
16
|
"@wireapp/core-crypto": "0.6.2",
|
|
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": "38.
|
|
64
|
-
"gitHead": "
|
|
63
|
+
"version": "38.15.0",
|
|
64
|
+
"gitHead": "fecbe29ae0f1962a04e978cd0e9a96cf60fa4f30"
|
|
65
65
|
}
|
|
@@ -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
|
-
});
|