@wireapp/core 40.4.0 → 40.4.1
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 +5 -12
- package/lib/CoreError.js +1 -1
- package/lib/client/ClientDatabaseRepository.js +2 -2
- package/lib/conversation/AssetTransferState.js +1 -1
- package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
- package/lib/conversation/ConversationService/ConversationService.js +0 -5
- package/lib/conversation/ConversationService/ConversationService.types.js +1 -1
- package/lib/conversation/GenericMessageType.js +1 -1
- package/lib/conversation/message/Message.types.js +1 -1
- package/lib/conversation/message/PayloadBundle.js +1 -1
- package/lib/cryptography/GenericMessageMapper.js +1 -1
- 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 +6 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +25 -8
- package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +9 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.js +1 -1
- package/lib/notification/NotificationDatabaseRepository.js +1 -1
- package/lib/notification/NotificationService.js +1 -1
- package/lib/notification/Notifications.types.js +1 -1
- package/package.json +4 -4
- 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/Account.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../src/Account.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EAGZ,OAAO,EACP,MAAM,EAEN,SAAS,EACV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAuB,UAAU,EAAE,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AACnG,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AAOxD,OAAO,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAC,UAAU,EAAe,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,WAAW,CAAC;AACpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAC,YAAY,EAAE,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,UAAU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A;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
|
@@ -63,7 +63,7 @@ var EVENTS;
|
|
|
63
63
|
* An unknown client is a client we don't yet have a session with
|
|
64
64
|
*/
|
|
65
65
|
EVENTS["NEW_SESSION"] = "new_session";
|
|
66
|
-
})(EVENTS
|
|
66
|
+
})(EVENTS || (exports.EVENTS = EVENTS = {}));
|
|
67
67
|
var ConnectionState;
|
|
68
68
|
(function (ConnectionState) {
|
|
69
69
|
/** The websocket is closed and notifications stream is not being processed */
|
|
@@ -74,7 +74,7 @@ var ConnectionState;
|
|
|
74
74
|
ConnectionState["PROCESSING_NOTIFICATIONS"] = "processing_notifications";
|
|
75
75
|
/** The websocket is open and message will go through and notifications stream is fully processed */
|
|
76
76
|
ConnectionState["LIVE"] = "live";
|
|
77
|
-
})(ConnectionState
|
|
77
|
+
})(ConnectionState || (exports.ConnectionState = ConnectionState = {}));
|
|
78
78
|
const coreDefaultClient = {
|
|
79
79
|
classification: client_1.ClientClassification.DESKTOP,
|
|
80
80
|
cookieLabel: 'default',
|
|
@@ -208,8 +208,6 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
208
208
|
}
|
|
209
209
|
// initialize schedulers for pending mls proposals once client is initialized
|
|
210
210
|
await this.service.mls.checkExistingPendingProposals();
|
|
211
|
-
// initialize schedulers for renewing key materials
|
|
212
|
-
this.service.mls.checkForKeyMaterialsUpdate();
|
|
213
211
|
// initialize scheduler for syncing key packages with backend
|
|
214
212
|
this.service.mls.checkForKeyPackagesBackendSync();
|
|
215
213
|
// leave stale conference subconversations (e.g after a crash)
|
|
@@ -350,16 +348,11 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
350
348
|
try {
|
|
351
349
|
const messages = this.service.notification.handleNotification(notification, source, dryRun);
|
|
352
350
|
try {
|
|
353
|
-
for (var _d = true, messages_1 = __asyncValues(messages), messages_1_1; messages_1_1 = await messages_1.next(), _a = messages_1_1.done, !_a;) {
|
|
351
|
+
for (var _d = true, messages_1 = __asyncValues(messages), messages_1_1; messages_1_1 = await messages_1.next(), _a = messages_1_1.done, !_a; _d = true) {
|
|
354
352
|
_c = messages_1_1.value;
|
|
355
353
|
_d = false;
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
await handleEvent(message, source);
|
|
359
|
-
}
|
|
360
|
-
finally {
|
|
361
|
-
_d = true;
|
|
362
|
-
}
|
|
354
|
+
const message = _c;
|
|
355
|
+
await handleEvent(message, source);
|
|
363
356
|
}
|
|
364
357
|
}
|
|
365
358
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
package/lib/CoreError.js
CHANGED
|
@@ -23,7 +23,7 @@ const SessionHandler_1 = require("../messagingProtocols/proteus/Utility/SessionH
|
|
|
23
23
|
var DatabaseStores;
|
|
24
24
|
(function (DatabaseStores) {
|
|
25
25
|
DatabaseStores["CLIENTS"] = "clients";
|
|
26
|
-
})(DatabaseStores
|
|
26
|
+
})(DatabaseStores || (exports.DatabaseStores = DatabaseStores = {}));
|
|
27
27
|
class ClientDatabaseRepository {
|
|
28
28
|
constructor(storeEngine) {
|
|
29
29
|
this.storeEngine = storeEngine;
|
|
@@ -86,8 +86,8 @@ class ClientDatabaseRepository {
|
|
|
86
86
|
return Object.assign(Object.assign({}, client), { domain, meta: { is_verified: true, primary_key: ClientDatabaseRepository.KEYS.LOCAL_IDENTITY } });
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
+
exports.ClientDatabaseRepository = ClientDatabaseRepository;
|
|
89
90
|
ClientDatabaseRepository.STORES = DatabaseStores;
|
|
90
91
|
ClientDatabaseRepository.KEYS = {
|
|
91
92
|
LOCAL_IDENTITY: 'local_identity',
|
|
92
93
|
};
|
|
93
|
-
exports.ClientDatabaseRepository = ClientDatabaseRepository;
|
|
@@ -23,4 +23,4 @@ var AssetTransferState;
|
|
|
23
23
|
(function (AssetTransferState) {
|
|
24
24
|
AssetTransferState["NOT_UPLOADED"] = "notUploaded";
|
|
25
25
|
AssetTransferState["UPLOADED"] = "uploaded";
|
|
26
|
-
})(AssetTransferState
|
|
26
|
+
})(AssetTransferState || (exports.AssetTransferState = AssetTransferState = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationService/ConversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EACZ,2BAA2B,EAC3B,WAAW,EACX,eAAe,EACf,oBAAoB,EAEpB,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAC,4BAA4B,EAAC,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAC,GAAG,EAAC,MAAM,oCAAoC,CAAC;AAIvD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAI9C,OAAO,EAAC,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAAE,UAAU,EAAC,MAAM,6BAA6B,CAAC;AAE5G,OAAO,EAAC,YAAY,EAAuB,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAEzF,OAAO,EAAC,UAAU,EAAuB,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAkC,cAAc,EAAC,MAAM,kCAAkC,CAAC;AACjG,OAAO,EACL,mCAAmC,EACnC,wBAAwB,EACzB,MAAM,sEAAsE,CAAC;AAG9E,OAAO,EAAC,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AI,CAAC;IAI3D,cAAc,CAAC,cAAc,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjE;;OAEG;IACH,gBAAgB,IAAI,OAAO;IAIpB,0BAA0B,CAC/B,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,WAAW,EACnB,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,OAAO,CAAC,IAAI,CAAC;IAaT,yBAAyB,CAC9B,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,OAAO,EACjB,gBAAgB,GAAE,MAAM,GAAG,IAAiB,GAC3C,OAAO,CAAC,IAAI,CAAC;IAaT,yBAAyB,CAC9B,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,2BAA2B,GAAG,MAAM,GACrD,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;OAIG;IAEH;;;OAGG;IACU,qBAAqB,CAAC,gBAAgB,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;YAmC/E,cAAc;IA+B5B;;;;;;OAMG;IACU,yBAAyB,CAAC,EACrC,cAAc,EACd,OAAO,EACP,cAAc,GACf,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAcvC,8BAA8B,CAAC,EAC1C,OAAO,EACP,cAAc,EACd,gBAAgB,GACjB,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;IAoBhC,oBAAoB,CAAC,cAAc,EAAE,WAAW;IAI7D;;;;;OAKG;IACU,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAiBvD,4BAA4B,CAAC,OAAO,EAAE,MAAM;IAI5C,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"ConversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationService/ConversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YA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CAAC,gBAAgB,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;YAmC/E,cAAc;IA+B5B;;;;;;OAMG;IACU,yBAAyB,CAAC,EACrC,cAAc,EACd,OAAO,EACP,cAAc,GACf,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAcvC,8BAA8B,CAAC,EAC1C,OAAO,EACP,cAAc,EACd,gBAAgB,GACjB,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;IAoBhC,oBAAoB,CAAC,cAAc,EAAE,WAAW;IAI7D;;;;;OAKG;IACU,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAiBvD,4BAA4B,CAAC,OAAO,EAAE,MAAM;IAI5C,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAIlD,YAAY;IAYb,mBAAmB;CA2BjC"}
|
|
@@ -266,11 +266,6 @@ class ConversationService {
|
|
|
266
266
|
return this.mlsService.conversationExists(groupId);
|
|
267
267
|
}
|
|
268
268
|
async wipeMLSConversation(groupId) {
|
|
269
|
-
const isMLSConversationEstablished = await this.isMLSConversationEstablished(groupId);
|
|
270
|
-
if (!isMLSConversationEstablished) {
|
|
271
|
-
//if the mls group does not exist, we don't need to wipe it
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
269
|
return this.mlsService.wipeConversation(groupId);
|
|
275
270
|
}
|
|
276
271
|
async matchesEpoch(groupId, backendEpoch) {
|
|
@@ -24,4 +24,4 @@ var MessageTargetMode;
|
|
|
24
24
|
MessageTargetMode[MessageTargetMode["NONE"] = 0] = "NONE";
|
|
25
25
|
MessageTargetMode[MessageTargetMode["USERS"] = 1] = "USERS";
|
|
26
26
|
MessageTargetMode[MessageTargetMode["USERS_CLIENTS"] = 2] = "USERS_CLIENTS";
|
|
27
|
-
})(MessageTargetMode
|
|
27
|
+
})(MessageTargetMode || (exports.MessageTargetMode = MessageTargetMode = {}));
|
|
@@ -45,4 +45,4 @@ var GenericMessageType;
|
|
|
45
45
|
GenericMessageType["LOCATION"] = "location";
|
|
46
46
|
GenericMessageType["REACTION"] = "reaction";
|
|
47
47
|
GenericMessageType["TEXT"] = "text";
|
|
48
|
-
})(GenericMessageType
|
|
48
|
+
})(GenericMessageType || (exports.GenericMessageType = GenericMessageType = {}));
|
|
@@ -24,4 +24,4 @@ var MessageSendingState;
|
|
|
24
24
|
MessageSendingState["INCOMING"] = "INCOMING";
|
|
25
25
|
MessageSendingState["OUTGOING_SENT"] = "OUTGOING_SENT";
|
|
26
26
|
MessageSendingState["CANCELED"] = "CANCELED";
|
|
27
|
-
})(MessageSendingState
|
|
27
|
+
})(MessageSendingState || (exports.MessageSendingState = MessageSendingState = {}));
|
|
@@ -64,4 +64,4 @@ var PayloadBundleType;
|
|
|
64
64
|
PayloadBundleType["USER_LEGAL_HOLD_REQUEST"] = "PayloadBundleType.USER_LEGAL_HOLD_REQUEST";
|
|
65
65
|
PayloadBundleType["USER_PROPERTIES_SET"] = "PayloadBundleType.USER_PROPERTIES_SET";
|
|
66
66
|
PayloadBundleType["USER_UPDATE"] = "PayloadBundleType.USER_UPDATE";
|
|
67
|
-
})(PayloadBundleType
|
|
67
|
+
})(PayloadBundleType || (exports.PayloadBundleType = PayloadBundleType = {}));
|
|
@@ -152,8 +152,8 @@ class GenericMessageMapper {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
+
exports.GenericMessageMapper = GenericMessageMapper;
|
|
155
156
|
GenericMessageMapper.logger = (0, logdown_1.default)('@wireapp/core/GenericMessageMapper', {
|
|
156
157
|
logger: console,
|
|
157
158
|
markdown: false,
|
|
158
159
|
});
|
|
159
|
-
exports.GenericMessageMapper = GenericMessageMapper;
|
package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"welcomeMessage.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAE,2BAA2B,EAAqB,MAAM,+BAA+B,CAAC;AAG5G,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAE5D,QAAA,MAAM,qBAAqB,UAAW,YAAY,yCACK,CAAC;AAExD,UAAU,0BAA2B,SAAQ,kBAAkB;IAC7D,KAAK,EAAE,2BAA2B,CAAC;CACpC;AACD,QAAA,MAAM,oBAAoB,0BAA+B,0BAA0B,
|
|
1
|
+
{"version":3,"file":"welcomeMessage.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAE,2BAA2B,EAAqB,MAAM,+BAA+B,CAAC;AAG5G,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAE5D,QAAA,MAAM,qBAAqB,UAAW,YAAY,yCACK,CAAC;AAExD,UAAU,0BAA2B,SAAQ,kBAAkB;IAC7D,KAAK,EAAE,2BAA2B,CAAC;CACpC;AACD,QAAA,MAAM,oBAAoB,0BAA+B,0BAA0B,uBAYlF,CAAC;AAEF,OAAO,EAAC,qBAAqB,EAAE,oBAAoB,EAAC,CAAC"}
|
|
@@ -29,6 +29,8 @@ const handleWelcomeMessage = async ({ mlsService, event }) => {
|
|
|
29
29
|
const newGroupId = await mlsService.processWelcomeMessage(data);
|
|
30
30
|
const groupIdStr = bazinga64_1.Encoder.toBase64(newGroupId).asString;
|
|
31
31
|
// The groupId can then be sent back to the consumer
|
|
32
|
+
// After we were added to the group we need to schedule a periodic key material renewal
|
|
33
|
+
mlsService.scheduleKeyMaterialRenewal(groupIdStr);
|
|
32
34
|
return {
|
|
33
35
|
event: Object.assign(Object.assign({}, event), { data: groupIdStr }),
|
|
34
36
|
};
|
package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js
CHANGED
|
@@ -36,6 +36,7 @@ const mockParams = {
|
|
|
36
36
|
source: {},
|
|
37
37
|
mlsService: {
|
|
38
38
|
processWelcomeMessage: jest.fn().mockResolvedValue('conversationId'),
|
|
39
|
+
scheduleKeyMaterialRenewal: jest.fn(),
|
|
39
40
|
},
|
|
40
41
|
dryRun: false,
|
|
41
42
|
};
|
|
@@ -55,9 +56,10 @@ describe('MLS welcomeMessage eventHandler', () => {
|
|
|
55
56
|
});
|
|
56
57
|
});
|
|
57
58
|
describe('handleWelcomeMessage', () => {
|
|
58
|
-
it('calls processWelcomeMessage', async () => {
|
|
59
|
+
it('calls processWelcomeMessage and schedules periodic key material updates', async () => {
|
|
59
60
|
await (0, welcomeMessage_1.handleWelcomeMessage)(mockParams);
|
|
60
61
|
expect(mockParams.mlsService.processWelcomeMessage).toHaveBeenCalled();
|
|
62
|
+
expect(mockParams.mlsService.scheduleKeyMaterialRenewal).toHaveBeenCalled();
|
|
61
63
|
});
|
|
62
64
|
it('returns a eventHandlerResult', async () => {
|
|
63
65
|
const eventHandlerResult = await (0, welcomeMessage_1.handleWelcomeMessage)(mockParams);
|
|
@@ -108,6 +108,11 @@ export declare class MLSService extends TypedEventEmitter<Events> {
|
|
|
108
108
|
* @param groupId The group that should have its key material updated
|
|
109
109
|
*/
|
|
110
110
|
resetKeyMaterialRenewal(groupId: string): void;
|
|
111
|
+
/**
|
|
112
|
+
* Will cancel the renewal of the key material for a given groupId
|
|
113
|
+
* @param groupId The group that should stop having its key material updated
|
|
114
|
+
*/
|
|
115
|
+
cancelKeyMaterialRenewal(groupId: string): void;
|
|
111
116
|
/**
|
|
112
117
|
* Will schedule a task to update the key material of the conversation according to the threshold given as config
|
|
113
118
|
* @param groupId
|
|
@@ -117,7 +122,7 @@ export declare class MLSService extends TypedEventEmitter<Events> {
|
|
|
117
122
|
* Get all keying material last update dates and schedule tasks for renewal
|
|
118
123
|
* Function must only be called once, after application start
|
|
119
124
|
*/
|
|
120
|
-
|
|
125
|
+
schedulePeriodicKeyMaterialRenewals(groupIds: string[]): void;
|
|
121
126
|
/**
|
|
122
127
|
* Get date of last key packages count query and schedule a task to sync it with backend
|
|
123
128
|
* Function must only be called once, after application start
|
|
@@ -1 +1 @@
|
|
|
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,MAAM,oBAAoB,CAAC;
|
|
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,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BAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYhD,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,GAAG,kBAAkB;IAW5F;;;;;OAKG;IACU,4BAA4B,CACvC,uBAAuB,EAAE,WAAW,EACpC,iBAAiB,CAAC,EAAE,kBAAkB,GACrC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAQ9B;;;;;;;OAOG;IACU,sBAAsB,CAAC,EAAC,SAAS,EAAE,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"}
|
|
@@ -40,7 +40,6 @@ const bazinga64_1 = require("bazinga64");
|
|
|
40
40
|
const logdown_1 = __importDefault(require("logdown"));
|
|
41
41
|
const commons_1 = require("@wireapp/commons");
|
|
42
42
|
const commitBundleUtil_1 = require("./commitBundleUtil");
|
|
43
|
-
const keyMaterialUpdatesStore_1 = require("./stores/keyMaterialUpdatesStore");
|
|
44
43
|
const pendingProposalsStore_1 = require("./stores/pendingProposalsStore");
|
|
45
44
|
const subconversationGroupIdStore_1 = require("./stores/subconversationGroupIdStore/subconversationGroupIdStore");
|
|
46
45
|
const messageSender_1 = require("../../../conversation/message/messageSender");
|
|
@@ -170,10 +169,16 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
170
169
|
return { groupId: conversationId, commitBundle };
|
|
171
170
|
};
|
|
172
171
|
const { commitBundle, groupId } = await generateCommit();
|
|
173
|
-
|
|
172
|
+
const mlsResponse = await this.uploadCommitBundle(groupId, commitBundle, {
|
|
174
173
|
isExternalCommit: true,
|
|
175
174
|
regenerateCommitBundle: async () => (await generateCommit()).commitBundle,
|
|
176
175
|
});
|
|
176
|
+
if (mlsResponse) {
|
|
177
|
+
//after we've successfully joined via external commit, we schedule periodic key material renewal
|
|
178
|
+
const groupIdStr = bazinga64_1.Encoder.toBase64(groupId).asString;
|
|
179
|
+
this.scheduleKeyMaterialRenewal(groupIdStr);
|
|
180
|
+
}
|
|
181
|
+
return mlsResponse;
|
|
177
182
|
}
|
|
178
183
|
async getConferenceSubconversation(conversationId) {
|
|
179
184
|
return this.apiClient.api.conversation.getSubconversation(conversationId, conversation_1.SUBCONVERSATION_ID.CONFERENCE);
|
|
@@ -309,7 +314,7 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
309
314
|
? await this.addUsersToExistingConversation(groupIdBytes, keyPackages)
|
|
310
315
|
: // If there are no clients to add, just update the keying material
|
|
311
316
|
await this.processCommitAction(groupIdBytes, () => this.coreCryptoClient.updateKeyingMaterial(groupIdBytes));
|
|
312
|
-
// We schedule a key material renewal
|
|
317
|
+
// We schedule a periodic key material renewal
|
|
313
318
|
this.scheduleKeyMaterialRenewal(groupId);
|
|
314
319
|
return response;
|
|
315
320
|
}
|
|
@@ -345,7 +350,7 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
345
350
|
try {
|
|
346
351
|
const groupConversationExists = await this.conversationExists(groupId);
|
|
347
352
|
if (!groupConversationExists) {
|
|
348
|
-
|
|
353
|
+
this.cancelKeyMaterialRenewal(groupId);
|
|
349
354
|
return;
|
|
350
355
|
}
|
|
351
356
|
const groupIdDecodedFromBase64 = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
@@ -363,9 +368,16 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
363
368
|
* @param groupId The group that should have its key material updated
|
|
364
369
|
*/
|
|
365
370
|
resetKeyMaterialRenewal(groupId) {
|
|
366
|
-
|
|
371
|
+
this.cancelKeyMaterialRenewal(groupId);
|
|
367
372
|
this.scheduleKeyMaterialRenewal(groupId);
|
|
368
373
|
}
|
|
374
|
+
/**
|
|
375
|
+
* Will cancel the renewal of the key material for a given groupId
|
|
376
|
+
* @param groupId The group that should stop having its key material updated
|
|
377
|
+
*/
|
|
378
|
+
cancelKeyMaterialRenewal(groupId) {
|
|
379
|
+
return (0, RecurringTaskScheduler_1.cancelRecurringTask)(this.createKeyMaterialUpdateTaskSchedulerId(groupId));
|
|
380
|
+
}
|
|
369
381
|
/**
|
|
370
382
|
* Will schedule a task to update the key material of the conversation according to the threshold given as config
|
|
371
383
|
* @param groupId
|
|
@@ -382,10 +394,9 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
382
394
|
* Get all keying material last update dates and schedule tasks for renewal
|
|
383
395
|
* Function must only be called once, after application start
|
|
384
396
|
*/
|
|
385
|
-
|
|
397
|
+
schedulePeriodicKeyMaterialRenewals(groupIds) {
|
|
386
398
|
try {
|
|
387
|
-
|
|
388
|
-
keyMaterialUpdateDates.forEach(({ groupId }) => this.scheduleKeyMaterialRenewal(groupId));
|
|
399
|
+
groupIds.forEach(groupId => this.scheduleKeyMaterialRenewal(groupId));
|
|
389
400
|
}
|
|
390
401
|
catch (error) {
|
|
391
402
|
this.logger.error('Could not get last key material update dates', error);
|
|
@@ -431,6 +442,12 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
431
442
|
return this.apiClient.api.client.uploadMLSKeyPackages(clientId, keypackages.map(keypackage => btoa(bazinga64_1.Converter.arrayBufferViewToBaselineString(keypackage))));
|
|
432
443
|
}
|
|
433
444
|
async wipeConversation(groupId) {
|
|
445
|
+
const isMLSConversationEstablished = await this.conversationExists(groupId);
|
|
446
|
+
if (!isMLSConversationEstablished) {
|
|
447
|
+
//if the mls group does not exist, we don't need to wipe it
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
this.cancelKeyMaterialRenewal(groupId);
|
|
434
451
|
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
435
452
|
return this.coreCryptoClient.wipeConversation(groupIdBytes);
|
|
436
453
|
}
|
|
@@ -29,6 +29,8 @@ describe('MLSService', () => {
|
|
|
29
29
|
const apiClient = new api_client_1.APIClient();
|
|
30
30
|
const mockCoreCrypto = {
|
|
31
31
|
createConversation: jest.fn(),
|
|
32
|
+
conversationExists: jest.fn(),
|
|
33
|
+
wipeConversation: jest.fn(),
|
|
32
34
|
};
|
|
33
35
|
describe('registerConversation', () => {
|
|
34
36
|
let mlsService;
|
|
@@ -40,6 +42,7 @@ describe('MLSService', () => {
|
|
|
40
42
|
jest.spyOn(apiClient.api.client, 'claimMLSKeyPackages').mockResolvedValue({ key_packages: [] });
|
|
41
43
|
jest.spyOn(mlsService, 'scheduleKeyMaterialRenewal').mockImplementation();
|
|
42
44
|
jest.spyOn(mlsService, 'processCommitAction').mockImplementation();
|
|
45
|
+
jest.spyOn(mlsService, 'cancelKeyMaterialRenewal').mockImplementation();
|
|
43
46
|
});
|
|
44
47
|
it('creates a new mls conversation and avoid adding the selfUser', async () => {
|
|
45
48
|
const groupId = 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm3OQFc=';
|
|
@@ -56,5 +59,11 @@ describe('MLSService', () => {
|
|
|
56
59
|
await mlsService.registerConversation(groupId, [createUserId(), createUserId()]);
|
|
57
60
|
expect(mlsService.scheduleKeyMaterialRenewal).toHaveBeenCalledWith(groupId);
|
|
58
61
|
});
|
|
62
|
+
it('cancels key material timers after group is wiped', async () => {
|
|
63
|
+
const groupId = 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm4OQFc=';
|
|
64
|
+
jest.spyOn(mockCoreCrypto, 'conversationExists').mockResolvedValueOnce(true);
|
|
65
|
+
await mlsService.wipeConversation(groupId);
|
|
66
|
+
expect(mlsService.cancelKeyMaterialRenewal).toHaveBeenCalledWith(groupId);
|
|
67
|
+
});
|
|
59
68
|
});
|
|
60
69
|
});
|
|
@@ -46,7 +46,7 @@ var CryptoClientType;
|
|
|
46
46
|
(function (CryptoClientType) {
|
|
47
47
|
CryptoClientType[CryptoClientType["CORE_CRYPTO"] = 0] = "CORE_CRYPTO";
|
|
48
48
|
CryptoClientType[CryptoClientType["CRYPTOBOX"] = 1] = "CRYPTOBOX";
|
|
49
|
-
})(CryptoClientType
|
|
49
|
+
})(CryptoClientType || (exports.CryptoClientType = CryptoClientType = {}));
|
|
50
50
|
async function buildCryptoClient(clientType, { storeEngine, nbPrekeys, systemCrypto, coreCryptoWasmFilePath, onNewPrekeys }) {
|
|
51
51
|
if (clientType === CryptoClientType.CORE_CRYPTO) {
|
|
52
52
|
const { buildClient } = await Promise.resolve().then(() => __importStar(require('./CoreCryptoWrapper')));
|
|
@@ -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 = {}));
|
package/package.json
CHANGED
|
@@ -11,14 +11,14 @@
|
|
|
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.2",
|
|
15
15
|
"@wireapp/commons": "^5.1.0",
|
|
16
16
|
"@wireapp/core-crypto": "0.8.2",
|
|
17
17
|
"@wireapp/cryptobox": "12.8.0",
|
|
18
18
|
"@wireapp/promise-queue": "^2.2.0",
|
|
19
19
|
"@wireapp/protocol-messaging": "1.44.0",
|
|
20
20
|
"@wireapp/store-engine": "5.1.1",
|
|
21
|
-
"@wireapp/store-engine-dexie": "^2.1.
|
|
21
|
+
"@wireapp/store-engine-dexie": "^2.1.2",
|
|
22
22
|
"axios": "1.4.0",
|
|
23
23
|
"bazinga64": "6.1.1",
|
|
24
24
|
"deepmerge-ts": "4.3.0",
|
|
@@ -60,6 +60,6 @@
|
|
|
60
60
|
"test:coverage": "jest --coverage",
|
|
61
61
|
"watch": "tsc --watch"
|
|
62
62
|
},
|
|
63
|
-
"version": "40.4.
|
|
64
|
-
"gitHead": "
|
|
63
|
+
"version": "40.4.1",
|
|
64
|
+
"gitHead": "29c5bbbe1cc422950fd1dffe9852ff8e7f950d88"
|
|
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
|
-
});
|