@wireapp/core 46.0.19 → 46.1.0-hotfix-1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Account.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.map +1 -1
- package/lib/conversation/ConversationService/ConversationService.js +80 -90
- package/lib/conversation/ConversationService/ConversationService.test.js +5 -12
- 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 +8 -0
- package/lib/conversation/SubconversationService/SubconversationService.d.ts.map +1 -1
- package/lib/conversation/SubconversationService/SubconversationService.js +51 -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.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +115 -110
- 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 +6 -6
|
@@ -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;AACzF,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,CAAC;AAE5E,OAAO,EAAC,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAC3C,O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AAO,EAAE,SAAS,EAAC,EAAE,4BAA4B;YAWnF,4BAA4B;YAU5B,0BAA0B;IAKxC,OAAO,CAAC,6BAA6B;IAIrC;;;;OAIG;IACU,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,UAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA4BvF;;;;OAIG;IACU,+BAA+B;IAiB5C;;;;OAIG;IACU,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;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();
|
|
@@ -383,15 +419,15 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
383
419
|
* @param options.parentGroupId in case the conversation is a subconversation, the id of the parent conversation
|
|
384
420
|
*/
|
|
385
421
|
async registerConversation(groupId, users, options) {
|
|
386
|
-
await this.registerEmptyConversation(groupId, options
|
|
387
|
-
const creator = options
|
|
422
|
+
await this.registerEmptyConversation(groupId, options === null || options === void 0 ? void 0 : options.parentGroupId);
|
|
423
|
+
const creator = options === null || options === void 0 ? void 0 : options.creator;
|
|
388
424
|
const { keyPackages, failures: keysClaimingFailures } = await this.getKeyPackagesPayload(users.map(user => {
|
|
389
|
-
if (user.id === creator
|
|
425
|
+
if (user.id === (creator === null || creator === void 0 ? void 0 : creator.user.id)) {
|
|
390
426
|
/**
|
|
391
427
|
* we should skip fetching key packages for current self client,
|
|
392
428
|
* it's already added by the backend on the group creation time
|
|
393
429
|
*/
|
|
394
|
-
return {
|
|
430
|
+
return Object.assign(Object.assign({}, creator.user), { skipOwnClientId: creator.client });
|
|
395
431
|
}
|
|
396
432
|
return user;
|
|
397
433
|
}));
|
|
@@ -399,7 +435,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
399
435
|
// If there are no clients to add, just update the keying material
|
|
400
436
|
const response = await this.updateKeyingMaterial(groupId);
|
|
401
437
|
await this.scheduleKeyMaterialRenewal(groupId);
|
|
402
|
-
return {
|
|
438
|
+
return Object.assign(Object.assign({}, response), { failures: keysClaimingFailures });
|
|
403
439
|
}
|
|
404
440
|
const response = await this.addUsersToExistingConversation(groupId, keyPackages);
|
|
405
441
|
// We schedule a periodic key material renewal
|
|
@@ -430,7 +466,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
430
466
|
}
|
|
431
467
|
}
|
|
432
468
|
const { keyPackages: selfKeyPackages, failures: selfKeysClaimingFailures } = await this.getKeyPackagesPayload([
|
|
433
|
-
{
|
|
469
|
+
Object.assign(Object.assign({}, selfUser.user), { skipOwnClientId: selfUser.client }),
|
|
434
470
|
]);
|
|
435
471
|
const response = await this.addUsersToExistingConversation(groupId, [
|
|
436
472
|
...otherUserKeyPackages,
|
|
@@ -446,38 +482,6 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
446
482
|
throw error;
|
|
447
483
|
}
|
|
448
484
|
}
|
|
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
485
|
/**
|
|
482
486
|
* Will send a removal commit for given clients
|
|
483
487
|
* @param groupId groupId of the conversation
|
|
@@ -623,7 +627,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
623
627
|
});
|
|
624
628
|
}
|
|
625
629
|
async replaceKeyPackages(clientId, keyPackages) {
|
|
626
|
-
return this.apiClient.api.client.replaceMLSKeyPackages(clientId, keyPackages.map(keyPackage => btoa(bazinga64_1.Converter.arrayBufferViewToBaselineString(keyPackage))));
|
|
630
|
+
return this.apiClient.api.client.replaceMLSKeyPackages(clientId, keyPackages.map(keyPackage => btoa(bazinga64_1.Converter.arrayBufferViewToBaselineString(keyPackage))), (0, numberToHex_1.numberToHex)(this.config.defaultCiphersuite));
|
|
627
631
|
}
|
|
628
632
|
async uploadMLSKeyPackages(clientId, keyPackages) {
|
|
629
633
|
return this.apiClient.api.client.uploadMLSKeyPackages(clientId, keyPackages.map(keyPackage => btoa(bazinga64_1.Converter.arrayBufferViewToBaselineString(keyPackage))));
|
|
@@ -735,7 +739,8 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
735
739
|
return clientIds;
|
|
736
740
|
}
|
|
737
741
|
async handleMLSMessageAddEvent(event, groupIdFromConversationId) {
|
|
738
|
-
|
|
742
|
+
var _a;
|
|
743
|
+
const qualifiedConversationId = (_a = event.qualified_conversation) !== null && _a !== void 0 ? _a : { id: event.conversation, domain: '' };
|
|
739
744
|
const groupId = await groupIdFromConversationId(qualifiedConversationId, event.subconv);
|
|
740
745
|
// We should not receive a message for a group the client is not aware of
|
|
741
746
|
if (!groupId) {
|
|
@@ -751,7 +756,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
751
756
|
try {
|
|
752
757
|
await this.verifyLocalMLSKeyPackagesAmount(clientId);
|
|
753
758
|
}
|
|
754
|
-
catch {
|
|
759
|
+
catch (_a) {
|
|
755
760
|
this.logger.error('Failed to verify the amount of MLS key packages');
|
|
756
761
|
}
|
|
757
762
|
return (0, events_1.handleMLSWelcomeMessage)({ event, mlsService: this });
|
|
@@ -786,8 +791,8 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
786
791
|
const newCommitBundle = {
|
|
787
792
|
commit: commitBundle.commit,
|
|
788
793
|
// @ts-ignore
|
|
789
|
-
groupInfo: commitBundle
|
|
790
|
-
welcome: commitBundle
|
|
794
|
+
groupInfo: (commitBundle === null || commitBundle === void 0 ? void 0 : commitBundle.group_info) || commitBundle.groupInfo,
|
|
795
|
+
welcome: commitBundle === null || commitBundle === void 0 ? void 0 : commitBundle.welcome,
|
|
791
796
|
};
|
|
792
797
|
await this.uploadCommitBundle(groupIdAsBytes, newCommitBundle);
|
|
793
798
|
}
|
|
@@ -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
|
/**
|
|
@@ -18,19 +18,18 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.CryptoboxWrapper = void 0;
|
|
22
|
-
exports.buildClient = buildClient;
|
|
21
|
+
exports.CryptoboxWrapper = exports.buildClient = void 0;
|
|
23
22
|
const cryptobox_1 = require("@wireapp/cryptobox");
|
|
24
23
|
const proteus_1 = require("@wireapp/proteus");
|
|
25
24
|
function buildClient(storeEngine, config) {
|
|
26
25
|
const cryptobox = new cryptobox_1.Cryptobox(storeEngine, config.nbPrekeys);
|
|
27
26
|
return new CryptoboxWrapper(cryptobox, config);
|
|
28
27
|
}
|
|
28
|
+
exports.buildClient = buildClient;
|
|
29
29
|
class CryptoboxWrapper {
|
|
30
|
-
cryptobox;
|
|
31
|
-
version = '1.0.0';
|
|
32
30
|
constructor(cryptobox, config) {
|
|
33
31
|
this.cryptobox = cryptobox;
|
|
32
|
+
this.version = '1.0.0';
|
|
34
33
|
this.cryptobox.on(cryptobox_1.Cryptobox.TOPIC.NEW_PREKEYS, prekeys => {
|
|
35
34
|
const serializedPreKeys = prekeys.map(prekey => this.cryptobox.serialize_prekey(prekey));
|
|
36
35
|
config.onNewPrekeys(serializedPreKeys);
|
|
@@ -89,7 +88,7 @@ class CryptoboxWrapper {
|
|
|
89
88
|
try {
|
|
90
89
|
return !!(await this.cryptobox.session_load(sessionId));
|
|
91
90
|
}
|
|
92
|
-
catch {
|
|
91
|
+
catch (_a) {
|
|
93
92
|
return false;
|
|
94
93
|
}
|
|
95
94
|
}
|
|
@@ -34,11 +34,12 @@ const isCryptoboxError = (error) => {
|
|
|
34
34
|
return 'code' in error;
|
|
35
35
|
};
|
|
36
36
|
const generateDecryptionError = (senderInfo, error) => {
|
|
37
|
+
var _a;
|
|
37
38
|
const { clientId, userId } = senderInfo;
|
|
38
39
|
const sender = `${userId.id} (${clientId})`;
|
|
39
40
|
const coreCryptoCode = isCoreCryptoError(error) ? error.proteusErrorCode : null;
|
|
40
41
|
const cryptoboxCode = isCryptoboxError(error) ? error.code : null;
|
|
41
|
-
const code = coreCryptoCode
|
|
42
|
+
const code = (_a = coreCryptoCode !== null && coreCryptoCode !== void 0 ? coreCryptoCode : cryptoboxCode) !== null && _a !== void 0 ? _a : exports.ProteusErrors.Unknown;
|
|
42
43
|
const message = `Decryption error from ${sender} (${error.message})`;
|
|
43
44
|
return new DecryptionError_1.DecryptionError(message, code);
|
|
44
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProteusService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/ProteusService.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,EAAC,MAAM,EAAE,OAAO,EAAC,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAGL,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAClF,OAAO,KAAK,EAAC,WAAW,EAAE,4BAA4B,EAAC,MAAM,8BAA8B,CAAC;AAG5F,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C,OAAO,KAAK,EACV,mCAAmC,EACnC,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAEL,iCAAiC,EAEjC,UAAU,EACV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAY1D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,wEAAwE;IACxE,QAAQ,EAAE,sBAAsB,CAAC;IACjC,wEAAwE;IACxE,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,sGAAsG;IACtG,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;AAEF,qBAAa,cAAc;IAKvB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM;IANzB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;gBAG/C,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,oBAAoB;IAKlC,wBAAwB,CAAC,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO7F,UAAU,CAAC,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"ProteusService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/ProteusService.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,EAAC,MAAM,EAAE,OAAO,EAAC,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAGL,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAClF,OAAO,KAAK,EAAC,WAAW,EAAE,4BAA4B,EAAC,MAAM,8BAA8B,CAAC;AAG5F,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C,OAAO,KAAK,EACV,mCAAmC,EACnC,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAEL,iCAAiC,EAEjC,UAAU,EACV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAG/B,O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