@wireapp/core 46.46.0 → 46.46.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.test.js +13 -0
- package/lib/conversation/ConversationService/ConversationService.d.ts +60 -13
- package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
- package/lib/conversation/ConversationService/ConversationService.js +199 -319
- package/lib/conversation/ConversationService/ConversationService.test.js +34 -8
- package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.d.ts +5 -0
- package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +1 -1
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.d.ts +78 -0
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.js +173 -0
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.d.ts +2 -0
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.js +117 -0
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.d.ts +167 -0
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.js +316 -0
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.d.ts +2 -0
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.js +248 -0
- package/lib/messagingProtocols/mls/recovery/index.d.ts +5 -0
- package/lib/messagingProtocols/mls/recovery/index.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/recovery/index.js +28 -0
- package/package.json +2 -2
package/lib/Account.test.js
CHANGED
|
@@ -57,6 +57,19 @@ const uuid_1 = require("uuid");
|
|
|
57
57
|
const api_client_1 = require("@wireapp/api-client");
|
|
58
58
|
const commons_1 = require("@wireapp/commons");
|
|
59
59
|
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
60
|
+
// Mock ConversationService to avoid requiring MLSService in constructor during tests
|
|
61
|
+
jest.mock('./conversation', () => {
|
|
62
|
+
const actual = jest.requireActual('./conversation');
|
|
63
|
+
class FakeConversationService {
|
|
64
|
+
constructor(..._args) { }
|
|
65
|
+
// Return unhandled so NotificationService falls back to generic handling in tests
|
|
66
|
+
handleEvent = jest.fn(async () => ({ status: 'unhandled' }));
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
...actual,
|
|
70
|
+
ConversationService: FakeConversationService,
|
|
71
|
+
};
|
|
72
|
+
});
|
|
60
73
|
const Account_1 = require("./Account");
|
|
61
74
|
const notification_2 = require("./notification");
|
|
62
75
|
const BASE_URL = 'mock-backend.wire.com';
|
|
@@ -31,8 +31,8 @@ export declare class ConversationService extends TypedEventEmitter<Events> {
|
|
|
31
31
|
private readonly _mlsService?;
|
|
32
32
|
readonly messageTimer: MessageTimer;
|
|
33
33
|
private readonly logger;
|
|
34
|
-
private readonly recoveringKeyMaterialGroups;
|
|
35
34
|
private groupIdConversationMap;
|
|
35
|
+
private MLSRecoveryOrchestrator;
|
|
36
36
|
constructor(apiClient: APIClient, proteusService: ProteusService, coreDatabase: CoreDatabase, groupIdFromConversationId: (conversationId: QualifiedId, subconversationId?: SUBCONVERSATION_ID) => Promise<string | undefined>, subconversationService: SubconversationService, isMLSConversationRecoveryEnabled: () => Promise<boolean>, _mlsService?: MLSService | undefined);
|
|
37
37
|
get mlsService(): MLSService;
|
|
38
38
|
/**
|
|
@@ -110,23 +110,57 @@ export declare class ConversationService extends TypedEventEmitter<Events> {
|
|
|
110
110
|
* @param conversationData
|
|
111
111
|
*/
|
|
112
112
|
establishMLSGroupConversation(groupId: string, userIdsToAdd: QualifiedId[], selfUserId: QualifiedId, selfClientId: string, conversationQualifiedId: QualifiedId): Promise<BaseCreateConversationResponse>;
|
|
113
|
+
/**
|
|
114
|
+
* Send an MLS message wrapped with recovery.
|
|
115
|
+
*
|
|
116
|
+
* Uses the MLS recovery orchestrator to handle transient MLS errors (for example, wrong epoch)
|
|
117
|
+
* according to per-operation policies. When configured, the original send is retried once
|
|
118
|
+
* after a successful recovery. Unrecoverable errors are re-thrown by the orchestrator.
|
|
119
|
+
* The low-level send logic lives in {@link performSendMLSMessageAPI}.
|
|
120
|
+
*/
|
|
113
121
|
private sendMLSMessage;
|
|
122
|
+
private performSendMLSMessageAPI;
|
|
114
123
|
/**
|
|
115
|
-
*
|
|
124
|
+
* Add users to an existing MLS group with recovery.
|
|
116
125
|
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
126
|
+
* Claims key packages and passes them to CoreCrypto.addClientsToConversation. The MLS recovery
|
|
127
|
+
* orchestrator handles recoverable failures (e.g., wrong epoch) and may retry the operation once
|
|
128
|
+
* depending on policy. The optional shouldRetry flag is ignored; retries are governed by policies.
|
|
129
|
+
*
|
|
130
|
+
* @param qualifiedUsers List of qualified user ids (use skipOwnClientId on self to avoid claiming its key package)
|
|
131
|
+
* @param groupId Id of the MLS group to add users to
|
|
132
|
+
* @param conversationId Qualified id of the conversation
|
|
120
133
|
*/
|
|
121
|
-
addUsersToMLSConversation({ qualifiedUsers, groupId, conversationId,
|
|
134
|
+
addUsersToMLSConversation({ qualifiedUsers, groupId, conversationId, }: Required<AddUsersParams> & {
|
|
122
135
|
shouldRetry?: boolean;
|
|
123
136
|
}): Promise<BaseCreateConversationResponse>;
|
|
124
|
-
|
|
137
|
+
private performAddUsersToMLSConversationAPI;
|
|
138
|
+
/**
|
|
139
|
+
* Remove users from an existing MLS group with recovery.
|
|
140
|
+
*
|
|
141
|
+
* The MLS recovery orchestrator handles recoverable failures and may retry the operation once
|
|
142
|
+
* depending on policy. The optional shouldRetry flag is ignored; retries are policy-driven.
|
|
143
|
+
*/
|
|
144
|
+
removeUsersFromMLSConversation({ groupId, conversationId, qualifiedUserIds, }: RemoveUsersParams & {
|
|
125
145
|
shouldRetry?: boolean;
|
|
126
146
|
}): Promise<Conversation>;
|
|
127
|
-
|
|
147
|
+
private performRemoveUsersFromMLSConversationAPI;
|
|
148
|
+
/**
|
|
149
|
+
* Join an MLS conversation via external commit with recovery.
|
|
150
|
+
*
|
|
151
|
+
* If the group is not established or is out of date, the orchestrator recovers accordingly.
|
|
152
|
+
* The join operation itself is not automatically re-run by policy.
|
|
153
|
+
*/
|
|
154
|
+
joinByExternalCommit(conversationId: QualifiedId): Promise<void>;
|
|
155
|
+
private performJoinByExternalCommitAPI;
|
|
128
156
|
private refreshGroupIdConversationMap;
|
|
129
157
|
private getConversationByGroupId;
|
|
158
|
+
/**
|
|
159
|
+
* React to a key material update failure using the recovery orchestrator.
|
|
160
|
+
*
|
|
161
|
+
* The original error is forwarded to the orchestrator under the 'keyMaterialUpdate' operation
|
|
162
|
+
* so it can map and apply the configured recovery policy. Unrecoverable errors are logged.
|
|
163
|
+
*/
|
|
130
164
|
private reactToKeyMaterialUpdateFailure;
|
|
131
165
|
private resetMLSConversation;
|
|
132
166
|
/**
|
|
@@ -194,15 +228,28 @@ export declare class ConversationService extends TypedEventEmitter<Events> {
|
|
|
194
228
|
selfUserId: QualifiedId;
|
|
195
229
|
qualifiedUsers: QualifiedId[];
|
|
196
230
|
}): Promise<void>;
|
|
231
|
+
/**
|
|
232
|
+
* Handle an inbound MLS message-add event with recovery.
|
|
233
|
+
*
|
|
234
|
+
* Policies (see MlsRecoveryOrchestrator):
|
|
235
|
+
* - WrongEpoch.handleMessageAdd → recover from epoch mismatch and re-run once.
|
|
236
|
+
* - GroupOutOfSync.handleMessageAdd → not handled here; the error bubbles.
|
|
237
|
+
*
|
|
238
|
+
* Returns the decrypted payload when available. Unknown or unrecoverable errors are logged
|
|
239
|
+
* and result in null so event processing can continue safely.
|
|
240
|
+
*/
|
|
197
241
|
private handleMLSMessageAddEvent;
|
|
198
242
|
private recoverMLSGroupFromEpochMismatch;
|
|
199
|
-
private handleMLSWelcomeMessageEvent;
|
|
200
|
-
private handleMlsOrphanWelcomeEvent;
|
|
201
243
|
/**
|
|
202
|
-
*
|
|
203
|
-
*
|
|
244
|
+
* Handle an MLS welcome event with recovery.
|
|
245
|
+
*
|
|
246
|
+
* Policies (see MlsRecoveryOrchestrator):
|
|
247
|
+
* - OrphanWelcome → join via external commit (no auto re-run).
|
|
248
|
+
* - ConversationAlreadyExists → wipe local state and re-run welcome once.
|
|
249
|
+
*
|
|
250
|
+
* Always resolves to null; the effects are applied to local state.
|
|
204
251
|
*/
|
|
205
|
-
private
|
|
252
|
+
private handleMLSWelcomeMessageEvent;
|
|
206
253
|
private handleOtrMessageAddEvent;
|
|
207
254
|
private isConversationBlacklisted;
|
|
208
255
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationService/ConversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EACZ,2BAA2B,EAC3B,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ConversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationService/ConversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EACZ,2BAA2B,EAC3B,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAGnB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,YAAY,EAIZ,4BAA4B,EAE7B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAC,GAAG,EAAC,MAAM,oCAAoC,CAAC;AAGvD,OAAO,EAAC,SAAS,EAAC,MAAM,qB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