@wireapp/core 46.0.19 → 46.1.0-hotfix-1.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.js +56 -43
- package/lib/account/AccountService.js +0 -1
- package/lib/broadcast/BroadcastService.js +0 -3
- package/lib/client/ClientBackendRepository.js +0 -1
- package/lib/client/ClientDatabaseRepository.js +7 -16
- package/lib/client/ClientService.d.ts.map +1 -1
- package/lib/client/ClientService.js +13 -14
- package/lib/connection/ConnectionService.js +0 -1
- package/lib/conversation/AssetService/AssetService.d.ts +1 -0
- package/lib/conversation/AssetService/AssetService.d.ts.map +1 -1
- package/lib/conversation/AssetService/AssetService.js +6 -13
- package/lib/conversation/AssetService/AssetService.test.js +1 -1
- package/lib/conversation/ConversationService/ConversationService.d.ts +1 -1
- package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
- package/lib/conversation/ConversationService/ConversationService.js +87 -91
- package/lib/conversation/ConversationService/ConversationService.test.js +7 -14
- package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.d.ts.map +1 -1
- package/lib/conversation/MessageTimer/MessageTimer.js +0 -2
- package/lib/conversation/SubconversationService/SubconversationService.d.ts.map +1 -1
- package/lib/conversation/SubconversationService/SubconversationService.js +17 -23
- package/lib/conversation/content/AssetContent.d.ts +1 -0
- package/lib/conversation/content/AssetContent.d.ts.map +1 -1
- package/lib/conversation/content/ContentType.js +19 -18
- package/lib/conversation/content/FileContent.d.ts +1 -0
- package/lib/conversation/content/FileContent.d.ts.map +1 -1
- package/lib/conversation/content/ImageContent.d.ts +1 -0
- package/lib/conversation/content/ImageContent.d.ts.map +1 -1
- package/lib/conversation/message/MessageBuilder.js +23 -22
- package/lib/conversation/message/MessageService.js +4 -5
- package/lib/conversation/message/MessageService.test.js +9 -20
- package/lib/conversation/message/MessageToProtoMapper.js +2 -2
- package/lib/conversation/message/RecipientsHelper.js +2 -1
- package/lib/conversation/message/TextContentBuilder.js +2 -3
- package/lib/conversation/message/UserClientsUtil.js +3 -2
- package/lib/conversation/message/messageSender.js +6 -5
- package/lib/cryptography/AssetCryptography/AssetCryptography.d.ts.map +1 -1
- package/lib/cryptography/GenericMessageMapper.js +22 -74
- package/lib/cryptography/MessageHashService.d.ts +1 -0
- package/lib/cryptography/MessageHashService.d.ts.map +1 -1
- package/lib/cryptography/MessageHashService.js +0 -2
- package/lib/errors/DecryptionError.js +0 -2
- package/lib/errors/FederatedBackendsError.js +2 -3
- package/lib/giphy/GiphyService.js +0 -1
- package/lib/linkPreview/LinkPreviewService.js +12 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.d.ts +4 -4
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.js +8 -9
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/schema.d.ts +8 -8
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +3 -33
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.test.js +11 -11
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +5 -15
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.js +0 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Account.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Account.js +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.d.ts +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.js +3 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Certificate.js +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Order.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Order.js +2 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.js +2 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.schema.d.ts +4 -4
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.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 +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js +3 -7
- package/lib/messagingProtocols/mls/MLSService/ClientMLSError.js +0 -1
- package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +3 -3
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +120 -114
- package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +9 -31
- package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.js +2 -1
- package/lib/messagingProtocols/mls/conversationRejoinQueue.js +4 -3
- package/lib/messagingProtocols/mls/utils/MLSId.js +3 -2
- package/lib/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.js +2 -6
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.js +0 -3
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.js +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.js +4 -5
- package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.js +2 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +16 -20
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts +7 -4
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.test.js +15 -15
- package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.js +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/identityClearer.js +2 -1
- package/lib/messagingProtocols/proteus/ProteusService/sessionIdMigrator.js +3 -2
- package/lib/messagingProtocols/proteus/ProteusService/userDomainFilters.js +2 -1
- package/lib/messagingProtocols/proteus/Utility/Recipients.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.js +14 -14
- package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.test.js +2 -5
- package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts.map +1 -1
- package/lib/notification/NotificationBackendRepository.d.ts +1 -1
- package/lib/notification/NotificationBackendRepository.js +0 -1
- package/lib/notification/NotificationDatabaseRepository.js +0 -1
- package/lib/notification/NotificationService.js +49 -38
- package/lib/secretStore/encryptedStore.js +22 -10
- package/lib/secretStore/secretKeyGenerator.js +2 -2
- package/lib/secretStore/secretKeyGenerator.test.js +1 -1
- package/lib/self/SelfService.js +1 -2
- package/lib/storage/CoreDB.js +3 -2
- package/lib/team/TeamService.js +0 -1
- package/lib/test/PayloadHelper.js +4 -3
- package/lib/testUtils/index.js +3 -2
- package/lib/user/UserService.d.ts +2 -2
- package/lib/user/UserService.js +0 -1
- package/lib/util/LocalStorageStore/index.d.ts.map +1 -1
- package/lib/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.js +6 -4
- package/lib/util/RecurringTaskScheduler/RecurringTaskScheduler.d.ts.map +1 -1
- package/lib/util/RecurringTaskScheduler/RecurringTaskScheduler.js +33 -34
- package/lib/util/TaskScheduler/TaskScheduler.d.ts +1 -1
- package/lib/util/TaskScheduler/TaskScheduler.d.ts.map +1 -1
- package/lib/util/TypePredicateUtil.js +10 -7
- package/lib/util/fullyQualifiedClientIdUtils.js +2 -1
- package/package.json +9 -9
- package/LICENSE +0 -674
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RegisteredClient } from '@wireapp/api-client/lib/client';
|
|
1
|
+
import type { MLSPublicKeyRecord, RegisteredClient } from '@wireapp/api-client/lib/client';
|
|
2
2
|
import { PostMlsMessageResponse, SUBCONVERSATION_ID } from '@wireapp/api-client/lib/conversation';
|
|
3
3
|
import { ConversationMLSMessageAddEvent, ConversationMLSWelcomeEvent } from '@wireapp/api-client/lib/event';
|
|
4
4
|
import { QualifiedId } from '@wireapp/api-client/lib/user';
|
|
@@ -109,7 +109,7 @@ export declare class MLSService extends TypedEventEmitter<Events> {
|
|
|
109
109
|
* @param groupId the id of the group to create inside of coreCrypto
|
|
110
110
|
* @param parentGroupId in case the conversation is a subconversation, the id of the parent conversation
|
|
111
111
|
*/
|
|
112
|
-
registerEmptyConversation(groupId: string, parentGroupId?: string): Promise<void>;
|
|
112
|
+
registerEmptyConversation(groupId: string, parentGroupId?: string, removalKeyFor1to1Signature?: MLSPublicKeyRecord): Promise<void>;
|
|
113
113
|
/**
|
|
114
114
|
* Will create a conversation inside of coreCrypto, add users to it or update the keying material if empty key packages list is provided.
|
|
115
115
|
* @param groupId the id of the group to create inside of coreCrypto
|
|
@@ -135,7 +135,7 @@ export declare class MLSService extends TypedEventEmitter<Events> {
|
|
|
135
135
|
register1to1Conversation(groupId: string, userId: QualifiedId, selfUser: {
|
|
136
136
|
user: QualifiedId;
|
|
137
137
|
client: string;
|
|
138
|
-
}): Promise<PostMlsMessageResponse & {
|
|
138
|
+
}, removalKeyFor1to1Signature?: MLSPublicKeyRecord): Promise<PostMlsMessageResponse & {
|
|
139
139
|
failures: AddUsersFailure[];
|
|
140
140
|
}>;
|
|
141
141
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAqB,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAqB,kBAAkB,EAAE,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AAC7G,OAAO,EAAC,sBAAsB,EAAE,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AAChG,OAAO,EAAC,8BAA8B,EAAE,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAE1G,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAGzD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAW,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,eAAe,EACf,WAAW,EAGX,cAAc,EACd,UAAU,EAEV,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAO9B,OAAO,EAAC,eAAe,EAA0B,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAEnG,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAC,sBAAsB,EAAC,MAAM,sCAAsC,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IAY9F,wBAAwB,CACnC,KAAK,EAAE,8BAA8B,EACrC,yBAAyB,EAAE,CACzB,cAAc,EAAE,WAAW,EAC3B,iBAAiB,CAAC,EAAE,kBAAkB,KACnC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAgBrB,4BAA4B,CAAC,KAAK,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM;IAc9F;;;;;;;;OAQG;IACU,UAAU,CACrB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,gBAAgB,GAC9B,OAAO,CAAC,IAAI,CAAC;CAyCjB"}
|
|
@@ -17,6 +17,17 @@
|
|
|
17
17
|
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
21
|
+
var t = {};
|
|
22
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
23
|
+
t[p] = s[p];
|
|
24
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
25
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
26
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
27
|
+
t[p[i]] = s[p[i]];
|
|
28
|
+
}
|
|
29
|
+
return t;
|
|
30
|
+
};
|
|
20
31
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
32
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
33
|
};
|
|
@@ -52,26 +63,99 @@ const defaultConfig = {
|
|
|
52
63
|
nbKeyPackages: 100,
|
|
53
64
|
};
|
|
54
65
|
class MLSService extends commons_1.TypedEventEmitter {
|
|
55
|
-
apiClient;
|
|
56
|
-
coreCryptoClient;
|
|
57
|
-
coreDatabase;
|
|
58
|
-
recurringTaskScheduler;
|
|
59
|
-
logger = (0, logdown_1.default)('@wireapp/core/MLSService');
|
|
60
|
-
_config;
|
|
61
|
-
textEncoder = new TextEncoder();
|
|
62
|
-
textDecoder = new TextDecoder();
|
|
63
|
-
conflictBackoffQueue = new priority_queue_1.PriorityQueue({
|
|
64
|
-
maxRetries: 10,
|
|
65
|
-
retryDelay: 500,
|
|
66
|
-
maxRetryDelay: TimeUtil_1.TimeInMillis.SECOND * 32,
|
|
67
|
-
shouldRetry: error => error instanceof http_1.BackendError && error.code === http_1.StatusCode.CONFLICT,
|
|
68
|
-
});
|
|
69
66
|
constructor(apiClient, coreCryptoClient, coreDatabase, recurringTaskScheduler) {
|
|
70
67
|
super();
|
|
71
68
|
this.apiClient = apiClient;
|
|
72
69
|
this.coreCryptoClient = coreCryptoClient;
|
|
73
70
|
this.coreDatabase = coreDatabase;
|
|
74
71
|
this.recurringTaskScheduler = recurringTaskScheduler;
|
|
72
|
+
this.logger = (0, logdown_1.default)('@wireapp/core/MLSService');
|
|
73
|
+
this.textEncoder = new TextEncoder();
|
|
74
|
+
this.textDecoder = new TextDecoder();
|
|
75
|
+
this.conflictBackoffQueue = new priority_queue_1.PriorityQueue({
|
|
76
|
+
maxRetries: 10,
|
|
77
|
+
retryDelay: 500,
|
|
78
|
+
maxRetryDelay: TimeUtil_1.TimeInMillis.SECOND * 32,
|
|
79
|
+
shouldRetry: error => error instanceof http_1.BackendError && error.code === http_1.StatusCode.CONFLICT,
|
|
80
|
+
});
|
|
81
|
+
/**
|
|
82
|
+
* returns true if the client has a valid MLS identity in regard of the default ciphersuite set
|
|
83
|
+
* @param client the client to check
|
|
84
|
+
*/
|
|
85
|
+
this.isInitializedMLSClient = (client) => (0, Helper_1.isMLSDevice)(client, this.config.defaultCiphersuite);
|
|
86
|
+
this.uploadCommitBundle = async (groupId, commitBundle, { isExternalCommit = false, regenerateCommitBundle } = {}) => {
|
|
87
|
+
try {
|
|
88
|
+
return await this._uploadCommitBundle(groupId, async () => commitBundle, isExternalCommit);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
if (error instanceof http_1.BackendError && error.code === http_1.StatusCode.CONFLICT && regenerateCommitBundle) {
|
|
92
|
+
return this.conflictBackoffQueue.add(async () => this._uploadCommitBundle(groupId, regenerateCommitBundle, isExternalCommit));
|
|
93
|
+
}
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
this._uploadCommitBundle = async (groupId, generateCommitBundle, isExternalCommit) => {
|
|
98
|
+
const groupIdStr = bazinga64_1.Encoder.toBase64(groupId).asString;
|
|
99
|
+
// We need to lock the incoming mls messages queue while we are uploading the commit bundle
|
|
100
|
+
// it's possible that we will be sent some mls messages before we receive the response from backend and accept a commit locally.
|
|
101
|
+
return (0, messageAdd_1.withLockedMLSMessagesQueue)(groupIdStr, async () => {
|
|
102
|
+
const { commit, groupInfo, welcome } = await generateCommitBundle();
|
|
103
|
+
const bundlePayload = new Uint8Array([...commit, ...groupInfo.payload, ...(welcome || [])]);
|
|
104
|
+
try {
|
|
105
|
+
const response = await this.apiClient.api.conversation.postMlsCommitBundle(bundlePayload);
|
|
106
|
+
if (isExternalCommit) {
|
|
107
|
+
await this.coreCryptoClient.mergePendingGroupFromExternalCommit(groupId);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
await this.coreCryptoClient.commitAccepted(groupId);
|
|
111
|
+
}
|
|
112
|
+
const newEpoch = await this.getEpoch(groupId);
|
|
113
|
+
this.emit('newEpoch', { epoch: newEpoch, groupId: groupIdStr });
|
|
114
|
+
return response;
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
if (isExternalCommit) {
|
|
118
|
+
await this.coreCryptoClient.clearPendingGroupFromExternalCommit(groupId);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
await this.coreCryptoClient.clearPendingCommit(groupId);
|
|
122
|
+
}
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Will try to register mls group and send an empty commit to establish it.
|
|
129
|
+
*
|
|
130
|
+
* @param groupId - id of the MLS group
|
|
131
|
+
* @returns true if the client has successfully established the group, false otherwise
|
|
132
|
+
*/
|
|
133
|
+
this.tryEstablishingMLSGroup = async (groupId) => {
|
|
134
|
+
this.logger.info(`Trying to establish a MLS group with id ${groupId}.`);
|
|
135
|
+
// Before trying to register a group, check if the group is already established locally.
|
|
136
|
+
// We could have received a welcome message in the meantime.
|
|
137
|
+
const doesMLSGroupExistLocally = await this.conversationExists(groupId);
|
|
138
|
+
if (doesMLSGroupExistLocally) {
|
|
139
|
+
this.logger.info(`MLS Group with id ${groupId} already exists, skipping the initialisation.`);
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
await this.registerConversation(groupId, []);
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
// If conversation already existed, locally, nothing more to do, we've received a welcome message.
|
|
148
|
+
if ((0, CoreCryptoMLSError_1.isCoreCryptoMLSConversationAlreadyExistsError)(error)) {
|
|
149
|
+
this.logger.info(`MLS Group with id ${groupId} already exists, skipping the initialisation.`);
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
this.logger.info(`MLS Group with id ${groupId} was not established succesfully, wiping the group locally...`);
|
|
153
|
+
// Otherwise it's a backend error. Somebody else might have created the group in the meantime.
|
|
154
|
+
// We should wipe the group locally, wait for the welcome message or join later via external commit.
|
|
155
|
+
await this.wipeConversation(groupId);
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
};
|
|
75
159
|
}
|
|
76
160
|
/**
|
|
77
161
|
* return true if the MLS service if configured and ready to be used
|
|
@@ -94,13 +178,11 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
94
178
|
* @param client id of the client to initialize
|
|
95
179
|
* @param skipInitIdentity avoid registering the client's identity to the backend (needed for e2eidentity as the identity will be uploaded and signed only when enrollment is successful)
|
|
96
180
|
*/
|
|
97
|
-
async initClient(userId, client,
|
|
181
|
+
async initClient(userId, client, _a) {
|
|
182
|
+
var { skipInitIdentity } = _a, mlsConfig = __rest(_a, ["skipInitIdentity"]);
|
|
98
183
|
// filter out undefined values from mlsConfig
|
|
99
184
|
const filteredMLSConfig = Object.fromEntries(Object.entries(mlsConfig).filter(([_, value]) => value !== undefined));
|
|
100
|
-
this._config = {
|
|
101
|
-
...defaultConfig,
|
|
102
|
-
...filteredMLSConfig,
|
|
103
|
-
};
|
|
185
|
+
this._config = Object.assign(Object.assign({}, defaultConfig), filteredMLSConfig);
|
|
104
186
|
await this.coreCryptoClient.mlsInit((0, MLSId_1.generateMLSDeviceId)(userId, client.id), this.config.ciphersuites, this.config.nbKeyPackages);
|
|
105
187
|
await this.coreCryptoClient.registerCallbacks({
|
|
106
188
|
// All authorization/membership rules are enforced on backend
|
|
@@ -121,57 +203,11 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
121
203
|
this.logger.info(`Blocked initial key package upload for client ${client.id} as E2EI is enabled`);
|
|
122
204
|
}
|
|
123
205
|
}
|
|
124
|
-
/**
|
|
125
|
-
* returns true if the client has a valid MLS identity in regard of the default ciphersuite set
|
|
126
|
-
* @param client the client to check
|
|
127
|
-
*/
|
|
128
|
-
isInitializedMLSClient = (client) => (0, Helper_1.isMLSDevice)(client, this.config.defaultCiphersuite);
|
|
129
206
|
async getCredentialType() {
|
|
130
207
|
return (await this.coreCryptoClient.e2eiIsEnabled(this.config.defaultCiphersuite))
|
|
131
208
|
? core_crypto_1.CredentialType.X509
|
|
132
209
|
: core_crypto_1.CredentialType.Basic;
|
|
133
210
|
}
|
|
134
|
-
uploadCommitBundle = async (groupId, commitBundle, { isExternalCommit = false, regenerateCommitBundle } = {}) => {
|
|
135
|
-
try {
|
|
136
|
-
return await this._uploadCommitBundle(groupId, async () => commitBundle, isExternalCommit);
|
|
137
|
-
}
|
|
138
|
-
catch (error) {
|
|
139
|
-
if (error instanceof http_1.BackendError && error.code === http_1.StatusCode.CONFLICT && regenerateCommitBundle) {
|
|
140
|
-
return this.conflictBackoffQueue.add(async () => this._uploadCommitBundle(groupId, regenerateCommitBundle, isExternalCommit));
|
|
141
|
-
}
|
|
142
|
-
throw error;
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
_uploadCommitBundle = async (groupId, generateCommitBundle, isExternalCommit) => {
|
|
146
|
-
const groupIdStr = bazinga64_1.Encoder.toBase64(groupId).asString;
|
|
147
|
-
// We need to lock the incoming mls messages queue while we are uploading the commit bundle
|
|
148
|
-
// it's possible that we will be sent some mls messages before we receive the response from backend and accept a commit locally.
|
|
149
|
-
return (0, messageAdd_1.withLockedMLSMessagesQueue)(groupIdStr, async () => {
|
|
150
|
-
const { commit, groupInfo, welcome } = await generateCommitBundle();
|
|
151
|
-
const bundlePayload = new Uint8Array([...commit, ...groupInfo.payload, ...(welcome || [])]);
|
|
152
|
-
try {
|
|
153
|
-
const response = await this.apiClient.api.conversation.postMlsCommitBundle(bundlePayload);
|
|
154
|
-
if (isExternalCommit) {
|
|
155
|
-
await this.coreCryptoClient.mergePendingGroupFromExternalCommit(groupId);
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
await this.coreCryptoClient.commitAccepted(groupId);
|
|
159
|
-
}
|
|
160
|
-
const newEpoch = await this.getEpoch(groupId);
|
|
161
|
-
this.emit('newEpoch', { epoch: newEpoch, groupId: groupIdStr });
|
|
162
|
-
return response;
|
|
163
|
-
}
|
|
164
|
-
catch (error) {
|
|
165
|
-
if (isExternalCommit) {
|
|
166
|
-
await this.coreCryptoClient.clearPendingGroupFromExternalCommit(groupId);
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
await this.coreCryptoClient.clearPendingCommit(groupId);
|
|
170
|
-
}
|
|
171
|
-
throw error;
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
211
|
/**
|
|
176
212
|
* Will add users to an existing MLS group and send a commit bundle to backend.
|
|
177
213
|
* Cannot be called with an empty array of keys.
|
|
@@ -200,7 +236,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
200
236
|
},
|
|
201
237
|
]
|
|
202
238
|
: [];
|
|
203
|
-
return {
|
|
239
|
+
return Object.assign(Object.assign({}, response), { failures });
|
|
204
240
|
}
|
|
205
241
|
async getKeyPackagesPayload(qualifiedUsers) {
|
|
206
242
|
/**
|
|
@@ -273,7 +309,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
273
309
|
const groupInfo = await getGroupInfo();
|
|
274
310
|
const joinRequest = await this.coreCryptoClient.joinByExternalCommit(groupInfo, credentialType);
|
|
275
311
|
this.dispatchNewCrlDistributionPoints(joinRequest);
|
|
276
|
-
const { conversationId,
|
|
312
|
+
const { conversationId } = joinRequest, commitBundle = __rest(joinRequest, ["conversationId"]);
|
|
277
313
|
return { groupId: conversationId, commitBundle };
|
|
278
314
|
};
|
|
279
315
|
const { commitBundle, groupId } = await generateCommit();
|
|
@@ -352,7 +388,8 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
352
388
|
* @param groupId the id of the group to create inside of coreCrypto
|
|
353
389
|
* @param parentGroupId in case the conversation is a subconversation, the id of the parent conversation
|
|
354
390
|
*/
|
|
355
|
-
async registerEmptyConversation(groupId, parentGroupId) {
|
|
391
|
+
async registerEmptyConversation(groupId, parentGroupId, removalKeyFor1to1Signature) {
|
|
392
|
+
var _a;
|
|
356
393
|
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
357
394
|
let externalSenders = [];
|
|
358
395
|
if (parentGroupId) {
|
|
@@ -362,7 +399,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
362
399
|
else {
|
|
363
400
|
const mlsKeys = (await this.apiClient.api.client.getPublicKeys()).removal;
|
|
364
401
|
const ciphersuiteSignature = (0, Helper_1.getSignatureAlgorithmForCiphersuite)(this.config.defaultCiphersuite);
|
|
365
|
-
const removalKeyForSignature = mlsKeys[ciphersuiteSignature];
|
|
402
|
+
const removalKeyForSignature = (_a = removalKeyFor1to1Signature === null || removalKeyFor1to1Signature === void 0 ? void 0 : removalKeyFor1to1Signature[ciphersuiteSignature]) !== null && _a !== void 0 ? _a : mlsKeys[ciphersuiteSignature];
|
|
366
403
|
if (!removalKeyForSignature) {
|
|
367
404
|
throw new Error(`Cannot create conversation: No backend removal key found for the signature ${ciphersuiteSignature}`);
|
|
368
405
|
}
|
|
@@ -383,15 +420,15 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
383
420
|
* @param options.parentGroupId in case the conversation is a subconversation, the id of the parent conversation
|
|
384
421
|
*/
|
|
385
422
|
async registerConversation(groupId, users, options) {
|
|
386
|
-
await this.registerEmptyConversation(groupId, options
|
|
387
|
-
const creator = options
|
|
423
|
+
await this.registerEmptyConversation(groupId, options === null || options === void 0 ? void 0 : options.parentGroupId);
|
|
424
|
+
const creator = options === null || options === void 0 ? void 0 : options.creator;
|
|
388
425
|
const { keyPackages, failures: keysClaimingFailures } = await this.getKeyPackagesPayload(users.map(user => {
|
|
389
|
-
if (user.id === creator
|
|
426
|
+
if (user.id === (creator === null || creator === void 0 ? void 0 : creator.user.id)) {
|
|
390
427
|
/**
|
|
391
428
|
* we should skip fetching key packages for current self client,
|
|
392
429
|
* it's already added by the backend on the group creation time
|
|
393
430
|
*/
|
|
394
|
-
return {
|
|
431
|
+
return Object.assign(Object.assign({}, creator.user), { skipOwnClientId: creator.client });
|
|
395
432
|
}
|
|
396
433
|
return user;
|
|
397
434
|
}));
|
|
@@ -399,7 +436,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
399
436
|
// If there are no clients to add, just update the keying material
|
|
400
437
|
const response = await this.updateKeyingMaterial(groupId);
|
|
401
438
|
await this.scheduleKeyMaterialRenewal(groupId);
|
|
402
|
-
return {
|
|
439
|
+
return Object.assign(Object.assign({}, response), { failures: keysClaimingFailures });
|
|
403
440
|
}
|
|
404
441
|
const response = await this.addUsersToExistingConversation(groupId, keyPackages);
|
|
405
442
|
// We schedule a periodic key material renewal
|
|
@@ -417,9 +454,9 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
417
454
|
* @param userId the id of the user to register the conversation with
|
|
418
455
|
* @param selfUser the self user that is creating the 1:1 conversation (user and client ids)
|
|
419
456
|
*/
|
|
420
|
-
async register1to1Conversation(groupId, userId, selfUser) {
|
|
457
|
+
async register1to1Conversation(groupId, userId, selfUser, removalKeyFor1to1Signature) {
|
|
421
458
|
try {
|
|
422
|
-
await this.registerEmptyConversation(groupId);
|
|
459
|
+
await this.registerEmptyConversation(groupId, undefined, removalKeyFor1to1Signature);
|
|
423
460
|
// We fist fetch key packages for the user we want to add
|
|
424
461
|
const { keyPackages: otherUserKeyPackages, failures: otherUserKeysClaimingFailures } = await this.getKeyPackagesPayload([userId]);
|
|
425
462
|
// If we're missing key packages for the user we want to add, we can't register the conversation
|
|
@@ -430,7 +467,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
430
467
|
}
|
|
431
468
|
}
|
|
432
469
|
const { keyPackages: selfKeyPackages, failures: selfKeysClaimingFailures } = await this.getKeyPackagesPayload([
|
|
433
|
-
{
|
|
470
|
+
Object.assign(Object.assign({}, selfUser.user), { skipOwnClientId: selfUser.client }),
|
|
434
471
|
]);
|
|
435
472
|
const response = await this.addUsersToExistingConversation(groupId, [
|
|
436
473
|
...otherUserKeyPackages,
|
|
@@ -446,38 +483,6 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
446
483
|
throw error;
|
|
447
484
|
}
|
|
448
485
|
}
|
|
449
|
-
/**
|
|
450
|
-
* Will try to register mls group and send an empty commit to establish it.
|
|
451
|
-
*
|
|
452
|
-
* @param groupId - id of the MLS group
|
|
453
|
-
* @returns true if the client has successfully established the group, false otherwise
|
|
454
|
-
*/
|
|
455
|
-
tryEstablishingMLSGroup = async (groupId) => {
|
|
456
|
-
this.logger.debug(`Trying to establish a MLS group with id ${groupId}.`);
|
|
457
|
-
// Before trying to register a group, check if the group is already established locally.
|
|
458
|
-
// We could have received a welcome message in the meantime.
|
|
459
|
-
const doesMLSGroupExistLocally = await this.conversationExists(groupId);
|
|
460
|
-
if (doesMLSGroupExistLocally) {
|
|
461
|
-
this.logger.debug(`MLS Group with id ${groupId} already exists, skipping the initialisation.`);
|
|
462
|
-
return false;
|
|
463
|
-
}
|
|
464
|
-
try {
|
|
465
|
-
await this.registerConversation(groupId, []);
|
|
466
|
-
return true;
|
|
467
|
-
}
|
|
468
|
-
catch (error) {
|
|
469
|
-
// If conversation already existed, locally, nothing more to do, we've received a welcome message.
|
|
470
|
-
if ((0, CoreCryptoMLSError_1.isCoreCryptoMLSConversationAlreadyExistsError)(error)) {
|
|
471
|
-
this.logger.debug(`MLS Group with id ${groupId} already exists, skipping the initialisation.`);
|
|
472
|
-
return false;
|
|
473
|
-
}
|
|
474
|
-
this.logger.warn(`MLS Group with id ${groupId} was not established succesfully, wiping the group locally...`);
|
|
475
|
-
// Otherwise it's a backend error. Somebody else might have created the group in the meantime.
|
|
476
|
-
// We should wipe the group locally, wait for the welcome message or join later via external commit.
|
|
477
|
-
await this.wipeConversation(groupId);
|
|
478
|
-
return false;
|
|
479
|
-
}
|
|
480
|
-
};
|
|
481
486
|
/**
|
|
482
487
|
* Will send a removal commit for given clients
|
|
483
488
|
* @param groupId groupId of the conversation
|
|
@@ -623,7 +628,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
623
628
|
});
|
|
624
629
|
}
|
|
625
630
|
async replaceKeyPackages(clientId, keyPackages) {
|
|
626
|
-
return this.apiClient.api.client.replaceMLSKeyPackages(clientId, keyPackages.map(keyPackage => btoa(bazinga64_1.Converter.arrayBufferViewToBaselineString(keyPackage))));
|
|
631
|
+
return this.apiClient.api.client.replaceMLSKeyPackages(clientId, keyPackages.map(keyPackage => btoa(bazinga64_1.Converter.arrayBufferViewToBaselineString(keyPackage))), (0, numberToHex_1.numberToHex)(this.config.defaultCiphersuite));
|
|
627
632
|
}
|
|
628
633
|
async uploadMLSKeyPackages(clientId, keyPackages) {
|
|
629
634
|
return this.apiClient.api.client.uploadMLSKeyPackages(clientId, keyPackages.map(keyPackage => btoa(bazinga64_1.Converter.arrayBufferViewToBaselineString(keyPackage))));
|
|
@@ -735,7 +740,8 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
735
740
|
return clientIds;
|
|
736
741
|
}
|
|
737
742
|
async handleMLSMessageAddEvent(event, groupIdFromConversationId) {
|
|
738
|
-
|
|
743
|
+
var _a;
|
|
744
|
+
const qualifiedConversationId = (_a = event.qualified_conversation) !== null && _a !== void 0 ? _a : { id: event.conversation, domain: '' };
|
|
739
745
|
const groupId = await groupIdFromConversationId(qualifiedConversationId, event.subconv);
|
|
740
746
|
// We should not receive a message for a group the client is not aware of
|
|
741
747
|
if (!groupId) {
|
|
@@ -751,7 +757,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
751
757
|
try {
|
|
752
758
|
await this.verifyLocalMLSKeyPackagesAmount(clientId);
|
|
753
759
|
}
|
|
754
|
-
catch {
|
|
760
|
+
catch (_a) {
|
|
755
761
|
this.logger.error('Failed to verify the amount of MLS key packages');
|
|
756
762
|
}
|
|
757
763
|
return (0, events_1.handleMLSWelcomeMessage)({ event, mlsService: this });
|
|
@@ -786,8 +792,8 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
786
792
|
const newCommitBundle = {
|
|
787
793
|
commit: commitBundle.commit,
|
|
788
794
|
// @ts-ignore
|
|
789
|
-
groupInfo: commitBundle
|
|
790
|
-
welcome: commitBundle
|
|
795
|
+
groupInfo: (commitBundle === null || commitBundle === void 0 ? void 0 : commitBundle.group_info) || commitBundle.groupInfo,
|
|
796
|
+
welcome: commitBundle === null || commitBundle === void 0 ? void 0 : commitBundle.welcome,
|
|
791
797
|
};
|
|
792
798
|
await this.uploadCommitBundle(groupIdAsBytes, newCommitBundle);
|
|
793
799
|
}
|
|
@@ -62,13 +62,13 @@ const createMLSService = async () => {
|
|
|
62
62
|
const mockedDb = await (0, CoreDB_1.openDB)('core-test-db');
|
|
63
63
|
const recurringTaskScheduler = new RecurringTaskScheduler_1.RecurringTaskScheduler({
|
|
64
64
|
delete: key => mockedDb.delete('recurringTasks', key),
|
|
65
|
-
get: async (key) => (await mockedDb.get('recurringTasks', key))
|
|
65
|
+
get: async (key) => { var _a; return (_a = (await mockedDb.get('recurringTasks', key))) === null || _a === void 0 ? void 0 : _a.firingDate; },
|
|
66
66
|
set: async (key, timestamp) => {
|
|
67
67
|
await mockedDb.put('recurringTasks', { key, firingDate: timestamp }, key);
|
|
68
68
|
},
|
|
69
69
|
});
|
|
70
70
|
const mlsService = new MLSService_1.MLSService(apiClient, mockCoreCrypto, mockedDb, recurringTaskScheduler);
|
|
71
|
-
mlsService['_config'] = {
|
|
71
|
+
mlsService['_config'] = Object.assign(Object.assign({}, defaultMLSInitConfig), { nbKeyPackages: 100, keyingMaterialUpdateThreshold: 1 });
|
|
72
72
|
return [mlsService, { apiClient, coreCrypto: mockCoreCrypto, recurringTaskScheduler }];
|
|
73
73
|
};
|
|
74
74
|
describe('MLSService', () => {
|
|
@@ -214,16 +214,10 @@ describe('MLSService', () => {
|
|
|
214
214
|
[core_crypto_1.Ciphersuite.MLS_256_DHKEMP521_AES256GCM_SHA512_P521],
|
|
215
215
|
[core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448],
|
|
216
216
|
[core_crypto_1.Ciphersuite.MLS_256_DHKEMP384_AES256GCM_SHA384_P384],
|
|
217
|
-
[core_crypto_1.Ciphersuite.MLS_128_X25519KYBER768DRAFT00_AES128GCM_SHA256_Ed25519],
|
|
218
217
|
])('always return false for empty mls_public_keys (%d)', async (ciphersuite) => {
|
|
219
218
|
const [mlsService] = await createMLSService();
|
|
220
219
|
const mockClient = { mls_public_keys: {} };
|
|
221
|
-
mlsService['_config'] = {
|
|
222
|
-
...defaultMLSInitConfig,
|
|
223
|
-
defaultCiphersuite: ciphersuite,
|
|
224
|
-
nbKeyPackages: 100,
|
|
225
|
-
keyingMaterialUpdateThreshold: 1,
|
|
226
|
-
};
|
|
220
|
+
mlsService['_config'] = Object.assign(Object.assign({}, defaultMLSInitConfig), { defaultCiphersuite: ciphersuite, nbKeyPackages: 100, keyingMaterialUpdateThreshold: 1 });
|
|
227
221
|
const isInitialized = mlsService.isInitializedMLSClient(mockClient);
|
|
228
222
|
expect(isInitialized).toBe(false);
|
|
229
223
|
});
|
|
@@ -235,16 +229,10 @@ describe('MLSService', () => {
|
|
|
235
229
|
[core_crypto_1.Ciphersuite.MLS_256_DHKEMP521_AES256GCM_SHA512_P521, 'ecdsa_secp521r1_sha512'],
|
|
236
230
|
[core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448, 'ed448'],
|
|
237
231
|
[core_crypto_1.Ciphersuite.MLS_256_DHKEMP384_AES256GCM_SHA384_P384, 'ecdsa_secp384r1_sha384'],
|
|
238
|
-
[core_crypto_1.Ciphersuite.MLS_128_X25519KYBER768DRAFT00_AES128GCM_SHA256_Ed25519, 'ed25519'],
|
|
239
232
|
])('returns true if there is a signature corresponding to the ciphersuite used (%d, %s)', async (ciphersuite, signatureAlgo) => {
|
|
240
233
|
const [mlsService] = await createMLSService();
|
|
241
234
|
const mockClient = { mls_public_keys: { [signatureAlgo]: 'signature' } };
|
|
242
|
-
mlsService['_config'] = {
|
|
243
|
-
...defaultMLSInitConfig,
|
|
244
|
-
defaultCiphersuite: ciphersuite,
|
|
245
|
-
nbKeyPackages: 100,
|
|
246
|
-
keyingMaterialUpdateThreshold: 1,
|
|
247
|
-
};
|
|
235
|
+
mlsService['_config'] = Object.assign(Object.assign({}, defaultMLSInitConfig), { defaultCiphersuite: ciphersuite, nbKeyPackages: 100, keyingMaterialUpdateThreshold: 1 });
|
|
248
236
|
const isInitialized = mlsService.isInitializedMLSClient(mockClient);
|
|
249
237
|
expect(isInitialized).toBe(true);
|
|
250
238
|
});
|
|
@@ -256,16 +244,10 @@ describe('MLSService', () => {
|
|
|
256
244
|
[core_crypto_1.Ciphersuite.MLS_256_DHKEMP521_AES256GCM_SHA512_P521, 'ed448'],
|
|
257
245
|
[core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448, 'p256'],
|
|
258
246
|
[core_crypto_1.Ciphersuite.MLS_256_DHKEMP384_AES256GCM_SHA384_P384, 'p256'],
|
|
259
|
-
[core_crypto_1.Ciphersuite.MLS_128_X25519KYBER768DRAFT00_AES128GCM_SHA256_Ed25519, 'p384'],
|
|
260
247
|
])('returns false if there is a signature not corresponding to the ciphersuite used (%d, %s)', async (ciphersuite, signatureAlgo) => {
|
|
261
248
|
const [mlsService] = await createMLSService();
|
|
262
249
|
const mockClient = { mls_public_keys: { [signatureAlgo]: 'signature' } };
|
|
263
|
-
mlsService['_config'] = {
|
|
264
|
-
...defaultMLSInitConfig,
|
|
265
|
-
defaultCiphersuite: ciphersuite,
|
|
266
|
-
nbKeyPackages: 100,
|
|
267
|
-
keyingMaterialUpdateThreshold: 1,
|
|
268
|
-
};
|
|
250
|
+
mlsService['_config'] = Object.assign(Object.assign({}, defaultMLSInitConfig), { defaultCiphersuite: ciphersuite, nbKeyPackages: 100, keyingMaterialUpdateThreshold: 1 });
|
|
269
251
|
const isInitialized = mlsService.isInitializedMLSClient(mockClient);
|
|
270
252
|
expect(isInitialized).toBe(false);
|
|
271
253
|
});
|
|
@@ -281,7 +263,7 @@ describe('MLSService', () => {
|
|
|
281
263
|
jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValueOnce(mockedClientPublicKey);
|
|
282
264
|
jest.spyOn(apiClient.api.client, 'putClient').mockResolvedValueOnce(undefined);
|
|
283
265
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
|
|
284
|
-
const config = {
|
|
266
|
+
const config = Object.assign({}, defaultMLSInitConfig);
|
|
285
267
|
await mlsService.initClient(mockUserId, mockClient, config);
|
|
286
268
|
expect(coreCrypto.mlsInit).toHaveBeenCalledWith(expect.any(Uint8Array), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], 100);
|
|
287
269
|
expect(mlsService.config.nbKeyPackages).toEqual(100);
|
|
@@ -296,7 +278,7 @@ describe('MLSService', () => {
|
|
|
296
278
|
jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValueOnce(mockedClientPublicKey);
|
|
297
279
|
jest.spyOn(apiClient.api.client, 'putClient').mockResolvedValueOnce(undefined);
|
|
298
280
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
|
|
299
|
-
const config = {
|
|
281
|
+
const config = Object.assign(Object.assign({}, defaultMLSInitConfig), { nbKeyPackages: 40, keyingMaterialUpdateThreshold: TimeUtil_1.TimeInMillis.DAY });
|
|
300
282
|
await mlsService.initClient(mockUserId, mockClient, config);
|
|
301
283
|
expect(coreCrypto.mlsInit).toHaveBeenCalledWith(expect.any(Uint8Array), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], config.nbKeyPackages);
|
|
302
284
|
expect(mlsService.config).toEqual(config);
|
|
@@ -311,14 +293,10 @@ describe('MLSService', () => {
|
|
|
311
293
|
jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValueOnce(mockedClientPublicKey);
|
|
312
294
|
jest.spyOn(apiClient.api.client, 'putClient').mockResolvedValueOnce(undefined);
|
|
313
295
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
|
|
314
|
-
const config = {
|
|
315
|
-
...defaultMLSInitConfig,
|
|
316
|
-
nbKeyPackages: undefined,
|
|
317
|
-
keyingMaterialUpdateThreshold: TimeUtil_1.TimeInMillis.DAY,
|
|
318
|
-
};
|
|
296
|
+
const config = Object.assign(Object.assign({}, defaultMLSInitConfig), { nbKeyPackages: undefined, keyingMaterialUpdateThreshold: TimeUtil_1.TimeInMillis.DAY });
|
|
319
297
|
await mlsService.initClient(mockUserId, mockClient, config);
|
|
320
298
|
expect(coreCrypto.mlsInit).toHaveBeenCalledWith(expect.any(Uint8Array), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], 100);
|
|
321
|
-
expect(mlsService.config).toEqual({
|
|
299
|
+
expect(mlsService.config).toEqual(Object.assign(Object.assign({}, config), { nbKeyPackages: 100 }));
|
|
322
300
|
});
|
|
323
301
|
it('uploads public key only if it was not yet defined on client entity', async () => {
|
|
324
302
|
const [mlsService, { apiClient, coreCrypto }] = await createMLSService();
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.toProtobufCommitBundle =
|
|
21
|
+
exports.toProtobufCommitBundle = void 0;
|
|
22
22
|
const mls_1 = require("@wireapp/protocol-messaging/web/mls");
|
|
23
23
|
const core_crypto_1 = require("@wireapp/core-crypto");
|
|
24
24
|
const ratchetTreeMapping = {
|
|
@@ -47,3 +47,4 @@ function toProtobufCommitBundle({ commit, welcome, groupInfo }) {
|
|
|
47
47
|
welcome,
|
|
48
48
|
}).finish();
|
|
49
49
|
}
|
|
50
|
+
exports.toProtobufCommitBundle = toProtobufCommitBundle;
|
|
@@ -18,9 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.queueConversationRejoin =
|
|
22
|
-
exports.resumeRejoiningMLSConversations = resumeRejoiningMLSConversations;
|
|
23
|
-
exports.pauseRejoiningMLSConversations = pauseRejoiningMLSConversations;
|
|
21
|
+
exports.pauseRejoiningMLSConversations = exports.resumeRejoiningMLSConversations = exports.queueConversationRejoin = void 0;
|
|
24
22
|
const promise_queue_1 = require("@wireapp/promise-queue");
|
|
25
23
|
const sendingQueue = new promise_queue_1.PromiseQueue({ name: 'mls-conversation-rejoin', paused: false });
|
|
26
24
|
const queuedJobs = new Set();
|
|
@@ -37,9 +35,12 @@ async function queueConversationRejoin(groupId, rejoinFn) {
|
|
|
37
35
|
return result;
|
|
38
36
|
}
|
|
39
37
|
}
|
|
38
|
+
exports.queueConversationRejoin = queueConversationRejoin;
|
|
40
39
|
function resumeRejoiningMLSConversations() {
|
|
41
40
|
sendingQueue.pause(false);
|
|
42
41
|
}
|
|
42
|
+
exports.resumeRejoiningMLSConversations = resumeRejoiningMLSConversations;
|
|
43
43
|
function pauseRejoiningMLSConversations() {
|
|
44
44
|
sendingQueue.pause(true);
|
|
45
45
|
}
|
|
46
|
+
exports.pauseRejoiningMLSConversations = pauseRejoiningMLSConversations;
|
|
@@ -18,14 +18,15 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.generateMLSUserId =
|
|
22
|
-
exports.generateMLSDeviceId = generateMLSDeviceId;
|
|
21
|
+
exports.generateMLSDeviceId = exports.generateMLSUserId = void 0;
|
|
23
22
|
const fullyQualifiedClientIdUtils_1 = require("../../../util/fullyQualifiedClientIdUtils");
|
|
24
23
|
const textEncoder = new TextEncoder();
|
|
25
24
|
function generateMLSUserId({ id, domain }) {
|
|
26
25
|
return textEncoder.encode(`${id}@${domain}`);
|
|
27
26
|
}
|
|
27
|
+
exports.generateMLSUserId = generateMLSUserId;
|
|
28
28
|
function generateMLSDeviceId({ id, domain }, clientId) {
|
|
29
29
|
const fullyQualifiedClientId = (0, fullyQualifiedClientIdUtils_1.constructFullyQualifiedClientId)(id, clientId, domain);
|
|
30
30
|
return textEncoder.encode(fullyQualifiedClientId);
|
|
31
31
|
}
|
|
32
|
+
exports.generateMLSDeviceId = generateMLSDeviceId;
|
package/lib/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otrMessageAdd.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAO7E,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAEvD,UAAU,yBAAyB;IACjC,KAAK,EAAE,8BAA8B,CAAC;IACtC,cAAc,EAAE,cAAc,CAAC;CAChC;AAED,eAAO,MAAM,mBAAmB,+BAG7B,yBAAyB,KAAG,
|
|
1
|
+
{"version":3,"file":"otrMessageAdd.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAO7E,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAEvD,UAAU,yBAAyB;IACjC,KAAK,EAAE,8BAA8B,CAAC;IACtC,cAAc,EAAE,cAAc,CAAC;CAChC;AAED,eAAO,MAAM,mBAAmB,+BAG7B,yBAAyB,KAAG,QAAQ,mBAAmB,CA6BzD,CAAC"}
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.CoreCryptoWrapper = void 0;
|
|
22
|
-
exports.buildClient = buildClient;
|
|
21
|
+
exports.CoreCryptoWrapper = exports.buildClient = void 0;
|
|
23
22
|
const bazinga64_1 = require("bazinga64");
|
|
24
23
|
const idb_1 = require("idb");
|
|
25
24
|
const core_crypto_1 = require("@wireapp/core-crypto");
|
|
@@ -49,11 +48,8 @@ async function buildClient(storeEngine, { wasmFilePath, generateSecretKey, nbPre
|
|
|
49
48
|
});
|
|
50
49
|
return new CoreCryptoWrapper(coreCrypto, { nbPrekeys, onNewPrekeys, onWipe: key.deleteKey });
|
|
51
50
|
}
|
|
51
|
+
exports.buildClient = buildClient;
|
|
52
52
|
class CoreCryptoWrapper {
|
|
53
|
-
coreCrypto;
|
|
54
|
-
config;
|
|
55
|
-
prekeyTracker;
|
|
56
|
-
version;
|
|
57
53
|
constructor(coreCrypto, config) {
|
|
58
54
|
this.coreCrypto = coreCrypto;
|
|
59
55
|
this.config = config;
|
|
@@ -21,9 +21,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
exports.PrekeyTracker = void 0;
|
|
22
22
|
const PrekeysTracker_store_1 = require("./PrekeysTracker.store");
|
|
23
23
|
class PrekeyTracker {
|
|
24
|
-
generator;
|
|
25
|
-
config;
|
|
26
|
-
prekeyState;
|
|
27
24
|
constructor(generator, config) {
|
|
28
25
|
this.generator = generator;
|
|
29
26
|
this.config = config;
|
|
@@ -23,7 +23,7 @@ let state = { nbPrekeys: 0 };
|
|
|
23
23
|
class PrekeysTrackerStore {
|
|
24
24
|
setNbPrekeys(delta) {
|
|
25
25
|
const newNbPrekeys = state.nbPrekeys + delta;
|
|
26
|
-
state = {
|
|
26
|
+
state = Object.assign(Object.assign({}, state), { nbPrekeys: newNbPrekeys });
|
|
27
27
|
return newNbPrekeys;
|
|
28
28
|
}
|
|
29
29
|
/**
|