@wireapp/core 30.9.0 → 30.10.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/CHANGELOG.md +11 -0
- package/package.json +3 -2
- package/src/main/Account.js +4 -0
- package/src/main/conversation/ConversationService/ConversationService.js +15 -12
- package/src/main/conversation/message/messageSender.d.ts +4 -0
- package/src/main/conversation/message/messageSender.js +36 -0
- package/src/main/mls/MLSService/MLSService.js +17 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [30.10.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@30.9.0...@wireapp/core@30.10.0) (2022-09-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Queue message sending [FS-882] ([#4392](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4392)) ([3b29dd0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/3b29dd012ebd41debcea3460c6e0fffa2da3646e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [30.9.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@30.8.0...@wireapp/core@30.9.0) (2022-09-15)
|
|
7
18
|
|
|
8
19
|
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"@wireapp/commons": "4.3.0",
|
|
11
11
|
"@wireapp/core-crypto": "0.4.0",
|
|
12
12
|
"@wireapp/cryptobox": "12.8.0",
|
|
13
|
+
"@wireapp/promise-queue": "1.1.1",
|
|
13
14
|
"@wireapp/store-engine-dexie": "1.6.10",
|
|
14
15
|
"bazinga64": "5.10.0",
|
|
15
16
|
"hash.js": "1.1.7",
|
|
@@ -77,6 +78,6 @@
|
|
|
77
78
|
"test:node": "nyc jasmine --config=jasmine.json",
|
|
78
79
|
"watch": "tsc ---watch"
|
|
79
80
|
},
|
|
80
|
-
"version": "30.
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"version": "30.10.0",
|
|
82
|
+
"gitHead": "4baf6f355f55532d2a59967ac81f72a81f36e25b"
|
|
82
83
|
}
|
package/src/main/Account.js
CHANGED
|
@@ -73,6 +73,7 @@ const linkPreview_1 = require("./linkPreview");
|
|
|
73
73
|
const encryptedStore_1 = require("./util/encryptedStore");
|
|
74
74
|
const bazinga64_1 = require("bazinga64");
|
|
75
75
|
const mls_1 = require("./mls");
|
|
76
|
+
const messageSender_1 = require("./conversation/message/messageSender");
|
|
76
77
|
var TOPIC;
|
|
77
78
|
(function (TOPIC) {
|
|
78
79
|
TOPIC["ERROR"] = "Account.TOPIC.ERROR";
|
|
@@ -402,6 +403,9 @@ class Account extends events_1.EventEmitter {
|
|
|
402
403
|
}, onMissedNotifications, abortHandler);
|
|
403
404
|
// We can now unlock the websocket and let the new messages being handled and decrypted
|
|
404
405
|
this.apiClient.transport.ws.unlock();
|
|
406
|
+
// We need to wait for the notification stream to be fully handled before releasing the message sending queue.
|
|
407
|
+
// This is due to the nature of how message are encrypted, any change in mls epoch needs to happen before we start encrypting any kind of messages
|
|
408
|
+
(0, messageSender_1.resumeMessageSending)();
|
|
405
409
|
onConnected();
|
|
406
410
|
};
|
|
407
411
|
await this.apiClient.connect(onBeforeConnect);
|
|
@@ -32,6 +32,7 @@ const ConversationService_types_1 = require("./ConversationService.types");
|
|
|
32
32
|
const bazinga64_1 = require("bazinga64");
|
|
33
33
|
const mapQualifiedUserClientIdsToFullyQualifiedClientIds_1 = require("../../util/mapQualifiedUserClientIdsToFullyQualifiedClientIds");
|
|
34
34
|
const mls_1 = require("../../mls");
|
|
35
|
+
const messageSender_1 = require("../message/messageSender");
|
|
35
36
|
class ConversationService {
|
|
36
37
|
constructor(apiClient, cryptographyService, config, notificationService, mlsService) {
|
|
37
38
|
this.apiClient = apiClient;
|
|
@@ -716,9 +717,9 @@ class ConversationService {
|
|
|
716
717
|
// If the onStart call returns false, it means the consumer wants to cancel the message sending
|
|
717
718
|
return Object.assign(Object.assign({}, payload), { state: conversation_2.PayloadBundleState.CANCELLED });
|
|
718
719
|
}
|
|
719
|
-
return isMLS(params)
|
|
720
|
+
return (0, messageSender_1.sendMessage)(() => isMLS(params)
|
|
720
721
|
? this.sendMLSMessage(params, genericMessage, content)
|
|
721
|
-
: this.sendProteusMessage(params, genericMessage, content);
|
|
722
|
+
: this.sendProteusMessage(params, genericMessage, content));
|
|
722
723
|
}
|
|
723
724
|
sendTypingStart(conversationId) {
|
|
724
725
|
return this.apiClient.api.conversation.postTyping(conversationId, { status: data_1.CONVERSATION_TYPING.STARTED });
|
|
@@ -916,16 +917,18 @@ class ConversationService {
|
|
|
916
917
|
* @param epoch The current epoch of the local conversation
|
|
917
918
|
*/
|
|
918
919
|
async sendExternalJoinProposal(conversationGroupId, epoch) {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
920
|
+
return (0, messageSender_1.sendMessage)(async () => {
|
|
921
|
+
const groupIdDecodedFromBase64 = bazinga64_1.Decoder.fromBase64(conversationGroupId).asBytes;
|
|
922
|
+
const externalProposal = await this.mlsService.newExternalProposal(0 /* Add */, {
|
|
923
|
+
epoch,
|
|
924
|
+
conversationId: groupIdDecodedFromBase64,
|
|
925
|
+
});
|
|
926
|
+
await this.apiClient.api.conversation.postMlsMessage(
|
|
927
|
+
//@todo: it's temporary - we wait for core-crypto fix to return the actual Uint8Array instead of regular array
|
|
928
|
+
(0, mls_1.optionalToUint8Array)(externalProposal));
|
|
929
|
+
//We store the info when user was added (and key material was created), so we will know when to renew it
|
|
930
|
+
await this.storeLastKeyMaterialUpdateDateWithCurrentTime(conversationGroupId);
|
|
931
|
+
});
|
|
929
932
|
}
|
|
930
933
|
async isMLSConversationEstablished(conversationGroupId) {
|
|
931
934
|
const groupIdDecodedFromBase64 = bazinga64_1.Decoder.fromBase64(conversationGroupId).asBytes;
|
|
@@ -0,0 +1,36 @@
|
|
|
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.pauseMessageSending = exports.resumeMessageSending = exports.sendMessage = void 0;
|
|
22
|
+
const promise_queue_1 = require("@wireapp/promise-queue");
|
|
23
|
+
const sendingQueue = new promise_queue_1.PromiseQueue({ name: 'message-sender', paused: true });
|
|
24
|
+
function sendMessage(sendingFunction) {
|
|
25
|
+
return sendingQueue.push(sendingFunction);
|
|
26
|
+
}
|
|
27
|
+
exports.sendMessage = sendMessage;
|
|
28
|
+
function resumeMessageSending() {
|
|
29
|
+
sendingQueue.pause(false);
|
|
30
|
+
}
|
|
31
|
+
exports.resumeMessageSending = resumeMessageSending;
|
|
32
|
+
function pauseMessageSending() {
|
|
33
|
+
sendingQueue.pause(true);
|
|
34
|
+
}
|
|
35
|
+
exports.pauseMessageSending = pauseMessageSending;
|
|
36
|
+
//# sourceMappingURL=messageSender.js.map
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.MLSService = exports.optionalToUint8Array = void 0;
|
|
22
22
|
const bazinga64_1 = require("bazinga64");
|
|
23
|
+
const messageSender_1 = require("../../conversation/message/messageSender");
|
|
23
24
|
//@todo: this function is temporary, we wait for the update from core-crypto side
|
|
24
25
|
//they are returning regular array instead of Uint8Array for commit and welcome messages
|
|
25
26
|
const optionalToUint8Array = (array) => {
|
|
@@ -60,10 +61,12 @@ class MLSService {
|
|
|
60
61
|
}
|
|
61
62
|
return null;
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
addUsersToExistingConversation(groupId, invitee) {
|
|
65
|
+
return (0, messageSender_1.sendMessage)(async () => {
|
|
66
|
+
const coreCryptoClient = this.getCoreCryptoClient();
|
|
67
|
+
const memberAddedMessages = await coreCryptoClient.addClientsToConversation(groupId, invitee);
|
|
68
|
+
return this.uploadCommitBundle(groupId, memberAddedMessages);
|
|
69
|
+
});
|
|
67
70
|
}
|
|
68
71
|
async getKeyPackagesPayload(qualifiedUsers) {
|
|
69
72
|
/**
|
|
@@ -104,16 +107,20 @@ class MLSService {
|
|
|
104
107
|
async encryptMessage(conversationId, message) {
|
|
105
108
|
return this.getCoreCryptoClient().encryptMessage(conversationId, message);
|
|
106
109
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
updateKeyingMaterial(conversationId) {
|
|
111
|
+
return (0, messageSender_1.sendMessage)(async () => {
|
|
112
|
+
const commitBundle = await this.getCoreCryptoClient().updateKeyingMaterial(conversationId);
|
|
113
|
+
return this.uploadCommitBundle(conversationId, commitBundle);
|
|
114
|
+
});
|
|
110
115
|
}
|
|
111
116
|
async createConversation(conversationId, configuration) {
|
|
112
117
|
return this.getCoreCryptoClient().createConversation(conversationId, configuration);
|
|
113
118
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
119
|
+
removeClientsFromConversation(conversationId, clientIds) {
|
|
120
|
+
return (0, messageSender_1.sendMessage)(async () => {
|
|
121
|
+
const commitBundle = await this.getCoreCryptoClient().removeClientsFromConversation(conversationId, clientIds);
|
|
122
|
+
return this.uploadCommitBundle(conversationId, commitBundle);
|
|
123
|
+
});
|
|
117
124
|
}
|
|
118
125
|
async commitPendingProposals(conversationId) {
|
|
119
126
|
return this.getCoreCryptoClient().commitPendingProposals(conversationId);
|