@wireapp/core 46.0.15 → 46.0.17
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 +43 -56
- package/lib/account/AccountService.js +1 -0
- package/lib/broadcast/BroadcastService.js +3 -0
- package/lib/client/ClientBackendRepository.js +1 -0
- package/lib/client/ClientDatabaseRepository.js +16 -7
- package/lib/client/ClientService.d.ts.map +1 -1
- package/lib/client/ClientService.js +14 -13
- package/lib/connection/ConnectionService.js +1 -0
- package/lib/conversation/AssetService/AssetService.d.ts +0 -1
- package/lib/conversation/AssetService/AssetService.d.ts.map +1 -1
- package/lib/conversation/AssetService/AssetService.js +13 -6
- 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 +90 -80
- package/lib/conversation/ConversationService/ConversationService.test.js +12 -5
- package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.d.ts.map +1 -1
- package/lib/conversation/MessageTimer/MessageTimer.js +2 -0
- package/lib/conversation/SubconversationService/SubconversationService.d.ts.map +1 -1
- package/lib/conversation/SubconversationService/SubconversationService.js +23 -17
- package/lib/conversation/content/AssetContent.d.ts +0 -1
- package/lib/conversation/content/AssetContent.d.ts.map +1 -1
- package/lib/conversation/content/ContentType.js +18 -19
- package/lib/conversation/content/FileContent.d.ts +0 -1
- package/lib/conversation/content/FileContent.d.ts.map +1 -1
- package/lib/conversation/content/ImageContent.d.ts +0 -1
- package/lib/conversation/content/ImageContent.d.ts.map +1 -1
- package/lib/conversation/message/MessageBuilder.js +22 -23
- package/lib/conversation/message/MessageService.js +5 -4
- package/lib/conversation/message/MessageService.test.js +20 -9
- package/lib/conversation/message/MessageToProtoMapper.js +2 -2
- package/lib/conversation/message/RecipientsHelper.js +1 -2
- package/lib/conversation/message/TextContentBuilder.js +3 -2
- package/lib/conversation/message/UserClientsUtil.js +2 -3
- package/lib/conversation/message/messageSender.js +5 -6
- package/lib/cryptography/AssetCryptography/AssetCryptography.d.ts.map +1 -1
- package/lib/cryptography/GenericMessageMapper.js +74 -22
- package/lib/cryptography/MessageHashService.d.ts +0 -1
- package/lib/cryptography/MessageHashService.d.ts.map +1 -1
- package/lib/cryptography/MessageHashService.js +2 -0
- package/lib/errors/DecryptionError.js +2 -0
- package/lib/errors/FederatedBackendsError.js +3 -2
- package/lib/giphy/GiphyService.js +1 -0
- package/lib/linkPreview/LinkPreviewService.js +2 -12
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.d.ts +4 -4
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.js +9 -8
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/schema.d.ts +8 -8
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +33 -3
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.test.js +11 -11
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +15 -5
- 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 +2 -3
- 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 +1 -2
- 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 +7 -3
- package/lib/messagingProtocols/mls/MLSService/ClientMLSError.js +1 -0
- 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 +109 -114
- package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +28 -9
- package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.js +1 -2
- package/lib/messagingProtocols/mls/conversationRejoinQueue.js +3 -4
- package/lib/messagingProtocols/mls/utils/MLSId.js +2 -3
- package/lib/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.js +6 -2
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.js +3 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.js +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.js +5 -4
- package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.js +1 -2
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +17 -14
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts +4 -7
- 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 +1 -2
- package/lib/messagingProtocols/proteus/ProteusService/sessionIdMigrator.js +2 -3
- package/lib/messagingProtocols/proteus/ProteusService/userDomainFilters.js +1 -2
- 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 +5 -2
- package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts.map +1 -1
- package/lib/notification/NotificationBackendRepository.d.ts +1 -1
- package/lib/notification/NotificationBackendRepository.js +1 -0
- package/lib/notification/NotificationDatabaseRepository.js +1 -0
- package/lib/notification/NotificationService.js +38 -49
- package/lib/secretStore/encryptedStore.js +10 -22
- package/lib/secretStore/secretKeyGenerator.js +2 -2
- package/lib/secretStore/secretKeyGenerator.test.js +1 -1
- package/lib/self/SelfService.js +2 -1
- package/lib/storage/CoreDB.js +2 -3
- package/lib/team/TeamService.js +1 -0
- package/lib/test/PayloadHelper.js +3 -4
- package/lib/testUtils/index.js +2 -3
- package/lib/user/UserService.d.ts +2 -2
- package/lib/user/UserService.js +1 -0
- package/lib/util/LocalStorageStore/index.d.ts.map +1 -1
- package/lib/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.js +4 -6
- package/lib/util/RecurringTaskScheduler/RecurringTaskScheduler.d.ts.map +1 -1
- package/lib/util/RecurringTaskScheduler/RecurringTaskScheduler.js +34 -33
- package/lib/util/TaskScheduler/TaskScheduler.d.ts +1 -1
- package/lib/util/TaskScheduler/TaskScheduler.d.ts.map +1 -1
- package/lib/util/TypePredicateUtil.js +7 -10
- package/lib/util/fullyQualifiedClientIdUtils.js +1 -2
- package/package.json +3 -3
|
@@ -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,OAAO,EAAsB,gBAAgB,EAAC,MAAM,2CAA2C,CAAC;AAQhG,OAAO,EAAC,QAAQ,EAAE,4BAA4B,EAAC,MAAM,UAAU,CAAC;AAGhE,KAAK,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAA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;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,17 +17,6 @@
|
|
|
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
|
-
};
|
|
31
20
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
21
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
22
|
};
|
|
@@ -63,99 +52,26 @@ const defaultConfig = {
|
|
|
63
52
|
nbKeyPackages: 100,
|
|
64
53
|
};
|
|
65
54
|
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
|
+
});
|
|
66
69
|
constructor(apiClient, coreCryptoClient, coreDatabase, recurringTaskScheduler) {
|
|
67
70
|
super();
|
|
68
71
|
this.apiClient = apiClient;
|
|
69
72
|
this.coreCryptoClient = coreCryptoClient;
|
|
70
73
|
this.coreDatabase = coreDatabase;
|
|
71
74
|
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
|
-
};
|
|
159
75
|
}
|
|
160
76
|
/**
|
|
161
77
|
* return true if the MLS service if configured and ready to be used
|
|
@@ -178,11 +94,13 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
178
94
|
* @param client id of the client to initialize
|
|
179
95
|
* @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)
|
|
180
96
|
*/
|
|
181
|
-
async initClient(userId, client,
|
|
182
|
-
var { skipInitIdentity } = _a, mlsConfig = __rest(_a, ["skipInitIdentity"]);
|
|
97
|
+
async initClient(userId, client, { skipInitIdentity, ...mlsConfig }) {
|
|
183
98
|
// filter out undefined values from mlsConfig
|
|
184
99
|
const filteredMLSConfig = Object.fromEntries(Object.entries(mlsConfig).filter(([_, value]) => value !== undefined));
|
|
185
|
-
this._config =
|
|
100
|
+
this._config = {
|
|
101
|
+
...defaultConfig,
|
|
102
|
+
...filteredMLSConfig,
|
|
103
|
+
};
|
|
186
104
|
await this.coreCryptoClient.mlsInit((0, MLSId_1.generateMLSDeviceId)(userId, client.id), this.config.ciphersuites, this.config.nbKeyPackages);
|
|
187
105
|
await this.coreCryptoClient.registerCallbacks({
|
|
188
106
|
// All authorization/membership rules are enforced on backend
|
|
@@ -203,11 +121,57 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
203
121
|
this.logger.info(`Blocked initial key package upload for client ${client.id} as E2EI is enabled`);
|
|
204
122
|
}
|
|
205
123
|
}
|
|
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);
|
|
206
129
|
async getCredentialType() {
|
|
207
130
|
return (await this.coreCryptoClient.e2eiIsEnabled(this.config.defaultCiphersuite))
|
|
208
131
|
? core_crypto_1.CredentialType.X509
|
|
209
132
|
: core_crypto_1.CredentialType.Basic;
|
|
210
133
|
}
|
|
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
|
+
};
|
|
211
175
|
/**
|
|
212
176
|
* Will add users to an existing MLS group and send a commit bundle to backend.
|
|
213
177
|
* Cannot be called with an empty array of keys.
|
|
@@ -236,7 +200,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
236
200
|
},
|
|
237
201
|
]
|
|
238
202
|
: [];
|
|
239
|
-
return
|
|
203
|
+
return { ...response, failures };
|
|
240
204
|
}
|
|
241
205
|
async getKeyPackagesPayload(qualifiedUsers) {
|
|
242
206
|
/**
|
|
@@ -309,7 +273,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
309
273
|
const groupInfo = await getGroupInfo();
|
|
310
274
|
const joinRequest = await this.coreCryptoClient.joinByExternalCommit(groupInfo, credentialType);
|
|
311
275
|
this.dispatchNewCrlDistributionPoints(joinRequest);
|
|
312
|
-
const { conversationId
|
|
276
|
+
const { conversationId, ...commitBundle } = joinRequest;
|
|
313
277
|
return { groupId: conversationId, commitBundle };
|
|
314
278
|
};
|
|
315
279
|
const { commitBundle, groupId } = await generateCommit();
|
|
@@ -419,15 +383,15 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
419
383
|
* @param options.parentGroupId in case the conversation is a subconversation, the id of the parent conversation
|
|
420
384
|
*/
|
|
421
385
|
async registerConversation(groupId, users, options) {
|
|
422
|
-
await this.registerEmptyConversation(groupId, options
|
|
423
|
-
const creator = options
|
|
386
|
+
await this.registerEmptyConversation(groupId, options?.parentGroupId);
|
|
387
|
+
const creator = options?.creator;
|
|
424
388
|
const { keyPackages, failures: keysClaimingFailures } = await this.getKeyPackagesPayload(users.map(user => {
|
|
425
|
-
if (user.id ===
|
|
389
|
+
if (user.id === creator?.user.id) {
|
|
426
390
|
/**
|
|
427
391
|
* we should skip fetching key packages for current self client,
|
|
428
392
|
* it's already added by the backend on the group creation time
|
|
429
393
|
*/
|
|
430
|
-
return
|
|
394
|
+
return { ...creator.user, skipOwnClientId: creator.client };
|
|
431
395
|
}
|
|
432
396
|
return user;
|
|
433
397
|
}));
|
|
@@ -435,7 +399,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
435
399
|
// If there are no clients to add, just update the keying material
|
|
436
400
|
const response = await this.updateKeyingMaterial(groupId);
|
|
437
401
|
await this.scheduleKeyMaterialRenewal(groupId);
|
|
438
|
-
return
|
|
402
|
+
return { ...response, failures: keysClaimingFailures };
|
|
439
403
|
}
|
|
440
404
|
const response = await this.addUsersToExistingConversation(groupId, keyPackages);
|
|
441
405
|
// We schedule a periodic key material renewal
|
|
@@ -466,7 +430,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
466
430
|
}
|
|
467
431
|
}
|
|
468
432
|
const { keyPackages: selfKeyPackages, failures: selfKeysClaimingFailures } = await this.getKeyPackagesPayload([
|
|
469
|
-
|
|
433
|
+
{ ...selfUser.user, skipOwnClientId: selfUser.client },
|
|
470
434
|
]);
|
|
471
435
|
const response = await this.addUsersToExistingConversation(groupId, [
|
|
472
436
|
...otherUserKeyPackages,
|
|
@@ -482,6 +446,38 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
482
446
|
throw error;
|
|
483
447
|
}
|
|
484
448
|
}
|
|
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
|
+
};
|
|
485
481
|
/**
|
|
486
482
|
* Will send a removal commit for given clients
|
|
487
483
|
* @param groupId groupId of the conversation
|
|
@@ -739,8 +735,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
739
735
|
return clientIds;
|
|
740
736
|
}
|
|
741
737
|
async handleMLSMessageAddEvent(event, groupIdFromConversationId) {
|
|
742
|
-
|
|
743
|
-
const qualifiedConversationId = (_a = event.qualified_conversation) !== null && _a !== void 0 ? _a : { id: event.conversation, domain: '' };
|
|
738
|
+
const qualifiedConversationId = event.qualified_conversation ?? { id: event.conversation, domain: '' };
|
|
744
739
|
const groupId = await groupIdFromConversationId(qualifiedConversationId, event.subconv);
|
|
745
740
|
// We should not receive a message for a group the client is not aware of
|
|
746
741
|
if (!groupId) {
|
|
@@ -756,7 +751,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
756
751
|
try {
|
|
757
752
|
await this.verifyLocalMLSKeyPackagesAmount(clientId);
|
|
758
753
|
}
|
|
759
|
-
catch
|
|
754
|
+
catch {
|
|
760
755
|
this.logger.error('Failed to verify the amount of MLS key packages');
|
|
761
756
|
}
|
|
762
757
|
return (0, events_1.handleMLSWelcomeMessage)({ event, mlsService: this });
|
|
@@ -791,8 +786,8 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
791
786
|
const newCommitBundle = {
|
|
792
787
|
commit: commitBundle.commit,
|
|
793
788
|
// @ts-ignore
|
|
794
|
-
groupInfo:
|
|
795
|
-
welcome: commitBundle
|
|
789
|
+
groupInfo: commitBundle?.group_info || commitBundle.groupInfo,
|
|
790
|
+
welcome: commitBundle?.welcome,
|
|
796
791
|
};
|
|
797
792
|
await this.uploadCommitBundle(groupIdAsBytes, newCommitBundle);
|
|
798
793
|
}
|
|
@@ -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) =>
|
|
65
|
+
get: async (key) => (await mockedDb.get('recurringTasks', key))?.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'] = { ...defaultMLSInitConfig, nbKeyPackages: 100, keyingMaterialUpdateThreshold: 1 };
|
|
72
72
|
return [mlsService, { apiClient, coreCrypto: mockCoreCrypto, recurringTaskScheduler }];
|
|
73
73
|
};
|
|
74
74
|
describe('MLSService', () => {
|
|
@@ -218,7 +218,12 @@ describe('MLSService', () => {
|
|
|
218
218
|
])('always return false for empty mls_public_keys (%d)', async (ciphersuite) => {
|
|
219
219
|
const [mlsService] = await createMLSService();
|
|
220
220
|
const mockClient = { mls_public_keys: {} };
|
|
221
|
-
mlsService['_config'] =
|
|
221
|
+
mlsService['_config'] = {
|
|
222
|
+
...defaultMLSInitConfig,
|
|
223
|
+
defaultCiphersuite: ciphersuite,
|
|
224
|
+
nbKeyPackages: 100,
|
|
225
|
+
keyingMaterialUpdateThreshold: 1,
|
|
226
|
+
};
|
|
222
227
|
const isInitialized = mlsService.isInitializedMLSClient(mockClient);
|
|
223
228
|
expect(isInitialized).toBe(false);
|
|
224
229
|
});
|
|
@@ -234,7 +239,12 @@ describe('MLSService', () => {
|
|
|
234
239
|
])('returns true if there is a signature corresponding to the ciphersuite used (%d, %s)', async (ciphersuite, signatureAlgo) => {
|
|
235
240
|
const [mlsService] = await createMLSService();
|
|
236
241
|
const mockClient = { mls_public_keys: { [signatureAlgo]: 'signature' } };
|
|
237
|
-
mlsService['_config'] =
|
|
242
|
+
mlsService['_config'] = {
|
|
243
|
+
...defaultMLSInitConfig,
|
|
244
|
+
defaultCiphersuite: ciphersuite,
|
|
245
|
+
nbKeyPackages: 100,
|
|
246
|
+
keyingMaterialUpdateThreshold: 1,
|
|
247
|
+
};
|
|
238
248
|
const isInitialized = mlsService.isInitializedMLSClient(mockClient);
|
|
239
249
|
expect(isInitialized).toBe(true);
|
|
240
250
|
});
|
|
@@ -250,7 +260,12 @@ describe('MLSService', () => {
|
|
|
250
260
|
])('returns false if there is a signature not corresponding to the ciphersuite used (%d, %s)', async (ciphersuite, signatureAlgo) => {
|
|
251
261
|
const [mlsService] = await createMLSService();
|
|
252
262
|
const mockClient = { mls_public_keys: { [signatureAlgo]: 'signature' } };
|
|
253
|
-
mlsService['_config'] =
|
|
263
|
+
mlsService['_config'] = {
|
|
264
|
+
...defaultMLSInitConfig,
|
|
265
|
+
defaultCiphersuite: ciphersuite,
|
|
266
|
+
nbKeyPackages: 100,
|
|
267
|
+
keyingMaterialUpdateThreshold: 1,
|
|
268
|
+
};
|
|
254
269
|
const isInitialized = mlsService.isInitializedMLSClient(mockClient);
|
|
255
270
|
expect(isInitialized).toBe(false);
|
|
256
271
|
});
|
|
@@ -266,7 +281,7 @@ describe('MLSService', () => {
|
|
|
266
281
|
jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValueOnce(mockedClientPublicKey);
|
|
267
282
|
jest.spyOn(apiClient.api.client, 'putClient').mockResolvedValueOnce(undefined);
|
|
268
283
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
|
|
269
|
-
const config =
|
|
284
|
+
const config = { ...defaultMLSInitConfig };
|
|
270
285
|
await mlsService.initClient(mockUserId, mockClient, config);
|
|
271
286
|
expect(coreCrypto.mlsInit).toHaveBeenCalledWith(expect.any(Uint8Array), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], 100);
|
|
272
287
|
expect(mlsService.config.nbKeyPackages).toEqual(100);
|
|
@@ -281,7 +296,7 @@ describe('MLSService', () => {
|
|
|
281
296
|
jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValueOnce(mockedClientPublicKey);
|
|
282
297
|
jest.spyOn(apiClient.api.client, 'putClient').mockResolvedValueOnce(undefined);
|
|
283
298
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
|
|
284
|
-
const config =
|
|
299
|
+
const config = { ...defaultMLSInitConfig, nbKeyPackages: 40, keyingMaterialUpdateThreshold: TimeUtil_1.TimeInMillis.DAY };
|
|
285
300
|
await mlsService.initClient(mockUserId, mockClient, config);
|
|
286
301
|
expect(coreCrypto.mlsInit).toHaveBeenCalledWith(expect.any(Uint8Array), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], config.nbKeyPackages);
|
|
287
302
|
expect(mlsService.config).toEqual(config);
|
|
@@ -296,10 +311,14 @@ describe('MLSService', () => {
|
|
|
296
311
|
jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValueOnce(mockedClientPublicKey);
|
|
297
312
|
jest.spyOn(apiClient.api.client, 'putClient').mockResolvedValueOnce(undefined);
|
|
298
313
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
|
|
299
|
-
const config =
|
|
314
|
+
const config = {
|
|
315
|
+
...defaultMLSInitConfig,
|
|
316
|
+
nbKeyPackages: undefined,
|
|
317
|
+
keyingMaterialUpdateThreshold: TimeUtil_1.TimeInMillis.DAY,
|
|
318
|
+
};
|
|
300
319
|
await mlsService.initClient(mockUserId, mockClient, config);
|
|
301
320
|
expect(coreCrypto.mlsInit).toHaveBeenCalledWith(expect.any(Uint8Array), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], 100);
|
|
302
|
-
expect(mlsService.config).toEqual(
|
|
321
|
+
expect(mlsService.config).toEqual({ ...config, nbKeyPackages: 100 });
|
|
303
322
|
});
|
|
304
323
|
it('uploads public key only if it was not yet defined on client entity', async () => {
|
|
305
324
|
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 = toProtobufCommitBundle;
|
|
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,4 +47,3 @@ function toProtobufCommitBundle({ commit, welcome, groupInfo }) {
|
|
|
47
47
|
welcome,
|
|
48
48
|
}).finish();
|
|
49
49
|
}
|
|
50
|
-
exports.toProtobufCommitBundle = toProtobufCommitBundle;
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.
|
|
21
|
+
exports.queueConversationRejoin = queueConversationRejoin;
|
|
22
|
+
exports.resumeRejoiningMLSConversations = resumeRejoiningMLSConversations;
|
|
23
|
+
exports.pauseRejoiningMLSConversations = pauseRejoiningMLSConversations;
|
|
22
24
|
const promise_queue_1 = require("@wireapp/promise-queue");
|
|
23
25
|
const sendingQueue = new promise_queue_1.PromiseQueue({ name: 'mls-conversation-rejoin', paused: false });
|
|
24
26
|
const queuedJobs = new Set();
|
|
@@ -35,12 +37,9 @@ async function queueConversationRejoin(groupId, rejoinFn) {
|
|
|
35
37
|
return result;
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
|
-
exports.queueConversationRejoin = queueConversationRejoin;
|
|
39
40
|
function resumeRejoiningMLSConversations() {
|
|
40
41
|
sendingQueue.pause(false);
|
|
41
42
|
}
|
|
42
|
-
exports.resumeRejoiningMLSConversations = resumeRejoiningMLSConversations;
|
|
43
43
|
function pauseRejoiningMLSConversations() {
|
|
44
44
|
sendingQueue.pause(true);
|
|
45
45
|
}
|
|
46
|
-
exports.pauseRejoiningMLSConversations = pauseRejoiningMLSConversations;
|
|
@@ -18,15 +18,14 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.
|
|
21
|
+
exports.generateMLSUserId = generateMLSUserId;
|
|
22
|
+
exports.generateMLSDeviceId = generateMLSDeviceId;
|
|
22
23
|
const fullyQualifiedClientIdUtils_1 = require("../../../util/fullyQualifiedClientIdUtils");
|
|
23
24
|
const textEncoder = new TextEncoder();
|
|
24
25
|
function generateMLSUserId({ id, domain }) {
|
|
25
26
|
return textEncoder.encode(`${id}@${domain}`);
|
|
26
27
|
}
|
|
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,OAAO,CAAC,mBAAmB,CA6BzD,CAAC"}
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.CoreCryptoWrapper =
|
|
21
|
+
exports.CoreCryptoWrapper = void 0;
|
|
22
|
+
exports.buildClient = buildClient;
|
|
22
23
|
const bazinga64_1 = require("bazinga64");
|
|
23
24
|
const idb_1 = require("idb");
|
|
24
25
|
const core_crypto_1 = require("@wireapp/core-crypto");
|
|
@@ -48,8 +49,11 @@ async function buildClient(storeEngine, { wasmFilePath, generateSecretKey, nbPre
|
|
|
48
49
|
});
|
|
49
50
|
return new CoreCryptoWrapper(coreCrypto, { nbPrekeys, onNewPrekeys, onWipe: key.deleteKey });
|
|
50
51
|
}
|
|
51
|
-
exports.buildClient = buildClient;
|
|
52
52
|
class CoreCryptoWrapper {
|
|
53
|
+
coreCrypto;
|
|
54
|
+
config;
|
|
55
|
+
prekeyTracker;
|
|
56
|
+
version;
|
|
53
57
|
constructor(coreCrypto, config) {
|
|
54
58
|
this.coreCrypto = coreCrypto;
|
|
55
59
|
this.config = config;
|
|
@@ -21,6 +21,9 @@ 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;
|
|
24
27
|
constructor(generator, config) {
|
|
25
28
|
this.generator = generator;
|
|
26
29
|
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 = { ...state, nbPrekeys: newNbPrekeys };
|
|
27
27
|
return newNbPrekeys;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
@@ -18,18 +18,19 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.CryptoboxWrapper =
|
|
21
|
+
exports.CryptoboxWrapper = void 0;
|
|
22
|
+
exports.buildClient = buildClient;
|
|
22
23
|
const cryptobox_1 = require("@wireapp/cryptobox");
|
|
23
24
|
const proteus_1 = require("@wireapp/proteus");
|
|
24
25
|
function buildClient(storeEngine, config) {
|
|
25
26
|
const cryptobox = new cryptobox_1.Cryptobox(storeEngine, config.nbPrekeys);
|
|
26
27
|
return new CryptoboxWrapper(cryptobox, config);
|
|
27
28
|
}
|
|
28
|
-
exports.buildClient = buildClient;
|
|
29
29
|
class CryptoboxWrapper {
|
|
30
|
+
cryptobox;
|
|
31
|
+
version = '1.0.0';
|
|
30
32
|
constructor(cryptobox, config) {
|
|
31
33
|
this.cryptobox = cryptobox;
|
|
32
|
-
this.version = '1.0.0';
|
|
33
34
|
this.cryptobox.on(cryptobox_1.Cryptobox.TOPIC.NEW_PREKEYS, prekeys => {
|
|
34
35
|
const serializedPreKeys = prekeys.map(prekey => this.cryptobox.serialize_prekey(prekey));
|
|
35
36
|
config.onNewPrekeys(serializedPreKeys);
|
|
@@ -88,7 +89,7 @@ class CryptoboxWrapper {
|
|
|
88
89
|
try {
|
|
89
90
|
return !!(await this.cryptobox.session_load(sessionId));
|
|
90
91
|
}
|
|
91
|
-
catch
|
|
92
|
+
catch {
|
|
92
93
|
return false;
|
|
93
94
|
}
|
|
94
95
|
}
|
|
@@ -34,12 +34,11 @@ const isCryptoboxError = (error) => {
|
|
|
34
34
|
return 'code' in error;
|
|
35
35
|
};
|
|
36
36
|
const generateDecryptionError = (senderInfo, error) => {
|
|
37
|
-
var _a;
|
|
38
37
|
const { clientId, userId } = senderInfo;
|
|
39
38
|
const sender = `${userId.id} (${clientId})`;
|
|
40
39
|
const coreCryptoCode = isCoreCryptoError(error) ? error.proteusErrorCode : null;
|
|
41
40
|
const cryptoboxCode = isCryptoboxError(error) ? error.code : null;
|
|
42
|
-
const code =
|
|
41
|
+
const code = coreCryptoCode ?? cryptoboxCode ?? exports.ProteusErrors.Unknown;
|
|
43
42
|
const message = `Decryption error from ${sender} (${error.message})`;
|
|
44
43
|
return new DecryptionError_1.DecryptionError(message, code);
|
|
45
44
|
};
|