@wireapp/core 37.0.4 → 37.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/conversation/ConversationService/ConversationService.d.ts +4 -0
- package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
- package/lib/conversation/ConversationService/ConversationService.js +15 -32
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +11 -2
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +32 -2
- package/package.json +2 -2
|
@@ -69,6 +69,10 @@ export declare class ConversationService {
|
|
|
69
69
|
* ################ MLS Functions ################
|
|
70
70
|
* ###############################################
|
|
71
71
|
*/
|
|
72
|
+
/**
|
|
73
|
+
* Will create a conversation on backend and register it to CoreCrypto once created
|
|
74
|
+
* @param conversationData
|
|
75
|
+
*/
|
|
72
76
|
createMLSConversation(conversationData: NewConversation): Promise<MLSReturnType>;
|
|
73
77
|
private sendMLSMessage;
|
|
74
78
|
addUsersToMLSConversation({ qualifiedUserIds, groupId, conversationId, }: Required<AddUsersParams>): Promise<MLSReturnType>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationService/ConversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAEL,YAAY,EACZ,2BAA2B,EAC3B,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,WAAW,EAGZ,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAC,4BAA4B,EAAC,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAC,GAAG,EAAC,MAAM,oCAAoC,CAAC;AAGvD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAI9C,OAAO,EAAC,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAAE,UAA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AAM,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAWrE,QAAQ,CAAC,EAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAC,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAWhF,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAK/E,6BAA6B,CAAC,MAAM,EAAE,mCAAmC;IAIzE,0BAA0B,CACrC,cAAc,EAAE,WAAW,EAC3B,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,4BAA4B,CAAC;IAIxC;;;OAGG;IACU,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,oBAAoB,EAAE,wBAAwB,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAO5F,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrD,0BAA0B,CAC/B,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,WAAW,EACnB,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,OAAO,CAAC,IAAI,CAAC;IAaT,yBAAyB,CAC9B,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,OAAO,EACjB,gBAAgB,GAAE,MAAM,GAAG,IAAiB,GAC3C,OAAO,CAAC,IAAI,CAAC;IAaT,yBAAyB,CAC9B,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,2BAA2B,GAAG,MAAM,GACrD,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;OAIG;
|
|
1
|
+
{"version":3,"file":"ConversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationService/ConversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAEL,YAAY,EACZ,2BAA2B,EAC3B,WAAW,EACX,eAAe,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AAI,CAAC;IAaT,yBAAyB,CAC9B,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,2BAA2B,GAAG,MAAM,GACrD,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;OAIG;IAEH;;;OAGG;IACU,qBAAqB,CAAC,gBAAgB,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;YAmC/E,cAAc;IAqBf,yBAAyB,CAAC,EACrC,gBAAgB,EAChB,OAAO,EACP,cAAc,GACf,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAcvC,8BAA8B,CAAC,EAC1C,OAAO,EACP,cAAc,EACd,gBAAgB,GACjB,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;IAsBhC,oBAAoB,CAAC,cAAc,EAAE,WAAW;IAI7D;;;;;OAKG;IACU,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAiBvD,4BAA4B,CAAC,OAAO,EAAE,MAAM;IAK5C,mBAAmB,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrE"}
|
|
@@ -171,7 +171,16 @@ class ConversationService {
|
|
|
171
171
|
* ################ MLS Functions ################
|
|
172
172
|
* ###############################################
|
|
173
173
|
*/
|
|
174
|
+
/**
|
|
175
|
+
* Will create a conversation on backend and register it to CoreCrypto once created
|
|
176
|
+
* @param conversationData
|
|
177
|
+
*/
|
|
174
178
|
async createMLSConversation(conversationData) {
|
|
179
|
+
var _a;
|
|
180
|
+
const { selfUserId, qualified_users: qualifiedUsers = [] } = conversationData;
|
|
181
|
+
if (!selfUserId) {
|
|
182
|
+
throw new Error('You need to pass self user qualified id in order to create an MLS conversation');
|
|
183
|
+
}
|
|
175
184
|
/**
|
|
176
185
|
* @note For creating MLS conversations the users & qualified_users
|
|
177
186
|
* field must be empty as backend is not aware which users
|
|
@@ -182,40 +191,14 @@ class ConversationService {
|
|
|
182
191
|
if (!groupId) {
|
|
183
192
|
throw new Error('No group_id found in response which is required for creating MLS conversations.');
|
|
184
193
|
}
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
const mlsKeys = (await this.apiClient.api.client.getPublicKeys()).removal;
|
|
191
|
-
const mlsKeyBytes = Object.values(mlsKeys).map((key) => bazinga64_1.Decoder.fromBase64(key).asBytes);
|
|
192
|
-
const config = {
|
|
193
|
-
externalSenders: mlsKeyBytes,
|
|
194
|
-
ciphersuite: 1, // TODO: Use the correct ciphersuite enum.
|
|
195
|
-
};
|
|
196
|
-
await this.mlsService.createConversation(groupIdBytes, config);
|
|
197
|
-
const coreCryptoKeyPackagesPayload = await this.mlsService.getKeyPackagesPayload([
|
|
198
|
-
{
|
|
199
|
-
id: selfUserId.id,
|
|
200
|
-
domain: selfUserId.domain,
|
|
201
|
-
/**
|
|
202
|
-
* we should skip fetching key packages for current self client,
|
|
203
|
-
* it's already added by the backend on the group creation time
|
|
204
|
-
*/
|
|
205
|
-
skipOwn: conversationData.creator_client,
|
|
206
|
-
},
|
|
207
|
-
...qualifiedUsers,
|
|
208
|
-
]);
|
|
209
|
-
let response;
|
|
210
|
-
if (coreCryptoKeyPackagesPayload.length !== 0) {
|
|
211
|
-
response = await this.mlsService.addUsersToExistingConversation(groupIdBytes, coreCryptoKeyPackagesPayload);
|
|
212
|
-
}
|
|
213
|
-
// We schedule a key material renewal
|
|
214
|
-
this.mlsService.scheduleKeyMaterialRenewal(groupId);
|
|
194
|
+
const response = await this.mlsService.registerConversation(groupId, qualifiedUsers.concat(selfUserId), {
|
|
195
|
+
user: selfUserId,
|
|
196
|
+
client: conversationData.creator_client,
|
|
197
|
+
});
|
|
215
198
|
// We fetch the fresh version of the conversation created on backend with the newly added users
|
|
216
|
-
const conversation = await this.
|
|
199
|
+
const conversation = await this.apiClient.api.conversation.getConversation(qualifiedId);
|
|
217
200
|
return {
|
|
218
|
-
events: (response === null || response === void 0 ? void 0 : response.events)
|
|
201
|
+
events: (_a = response === null || response === void 0 ? void 0 : response.events) !== null && _a !== void 0 ? _a : [],
|
|
219
202
|
conversation,
|
|
220
203
|
};
|
|
221
204
|
}
|
|
@@ -2,7 +2,7 @@ import { PostMlsMessageResponse } from '@wireapp/api-client/lib/conversation';
|
|
|
2
2
|
import { QualifiedId } from '@wireapp/api-client/lib/user';
|
|
3
3
|
import logdown from 'logdown';
|
|
4
4
|
import { APIClient } from '@wireapp/api-client';
|
|
5
|
-
import { AddProposalArgs,
|
|
5
|
+
import { AddProposalArgs, ConversationId, CoreCrypto, DecryptedMessage, ExternalProposalArgs, ExternalProposalType, ExternalRemoveProposalArgs, Invitee, ProposalArgs, ProposalType, RemoveProposalArgs } from '@wireapp/core-crypto';
|
|
6
6
|
import { MLSServiceConfig } from './MLSService.types';
|
|
7
7
|
import { QualifiedUsers } from '../../../conversation';
|
|
8
8
|
import { EventHandlerResult } from '../../common.types';
|
|
@@ -40,7 +40,16 @@ export declare class MLSService {
|
|
|
40
40
|
*/
|
|
41
41
|
private processCommitAction;
|
|
42
42
|
updateKeyingMaterial(conversationId: ConversationId): Promise<PostMlsMessageResponse | null>;
|
|
43
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Will create a conversation inside of coreCrypto.
|
|
45
|
+
* @param groupId the id of the group to create inside of coreCrypto
|
|
46
|
+
* @param users the list of users that will be members of the conversation (including the self user)
|
|
47
|
+
* @param creator the creator of the list. Most of the time will be the self user (or empty if the conversation was created by backend first)
|
|
48
|
+
*/
|
|
49
|
+
registerConversation(groupId: string, users: QualifiedId[], creator?: {
|
|
50
|
+
user: QualifiedId;
|
|
51
|
+
client?: string;
|
|
52
|
+
}): Promise<PostMlsMessageResponse | null | undefined>;
|
|
44
53
|
removeClientsFromConversation(conversationId: ConversationId, clientIds: Uint8Array[]): Promise<PostMlsMessageResponse | null>;
|
|
45
54
|
private commitProposals;
|
|
46
55
|
conversationExists(conversationId: ConversationId): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,sBAAsB,EAAC,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAGzD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EACL,eAAe,
|
|
1
|
+
{"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,sBAAsB,EAAC,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAGzD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EACL,eAAe,EAGf,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B,EAC1B,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAC,gBAAgB,EAAsB,MAAM,oBAAoB,CAAC;AAIzE,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAKrD,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAC,kBAAkB,EAAqB,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAC,4BAA4B,EAAE,4BAA4B,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AAIlG,eAAO,MAAM,oBAAoB,UAAW,UAAU,GAAG,EAAE,KAAG,UAE7D,CAAC;AAOF,qBAAa,UAAU;IAMnB,OAA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C,EAAC,OAAO,EAAE,UAAkB,EAAC,EAAE,4BAA4B;IAa/F;;;;OAIG;IACU,6BAA6B;CAgB3C"}
|
|
@@ -195,8 +195,38 @@ class MLSService {
|
|
|
195
195
|
updateKeyingMaterial(conversationId) {
|
|
196
196
|
return this.processCommitAction(conversationId, () => this.coreCryptoClient.updateKeyingMaterial(conversationId));
|
|
197
197
|
}
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
/**
|
|
199
|
+
* Will create a conversation inside of coreCrypto.
|
|
200
|
+
* @param groupId the id of the group to create inside of coreCrypto
|
|
201
|
+
* @param users the list of users that will be members of the conversation (including the self user)
|
|
202
|
+
* @param creator the creator of the list. Most of the time will be the self user (or empty if the conversation was created by backend first)
|
|
203
|
+
*/
|
|
204
|
+
async registerConversation(groupId, users, creator) {
|
|
205
|
+
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
206
|
+
const mlsKeys = (await this.apiClient.api.client.getPublicKeys()).removal;
|
|
207
|
+
const mlsKeyBytes = Object.values(mlsKeys).map((key) => bazinga64_1.Decoder.fromBase64(key).asBytes);
|
|
208
|
+
const configuration = {
|
|
209
|
+
externalSenders: mlsKeyBytes,
|
|
210
|
+
ciphersuite: 1, // TODO: Use the correct ciphersuite enum.
|
|
211
|
+
};
|
|
212
|
+
this.coreCryptoClient.createConversation(groupIdBytes, configuration);
|
|
213
|
+
const coreCryptoKeyPackagesPayload = await this.getKeyPackagesPayload(users.map(user => {
|
|
214
|
+
if (user.id === (creator === null || creator === void 0 ? void 0 : creator.user.id)) {
|
|
215
|
+
/**
|
|
216
|
+
* we should skip fetching key packages for current self client,
|
|
217
|
+
* it's already added by the backend on the group creation time
|
|
218
|
+
*/
|
|
219
|
+
return Object.assign(Object.assign({}, creator.user), { skipOwn: creator.client });
|
|
220
|
+
}
|
|
221
|
+
return user;
|
|
222
|
+
}));
|
|
223
|
+
let response;
|
|
224
|
+
if (coreCryptoKeyPackagesPayload.length !== 0) {
|
|
225
|
+
response = await this.addUsersToExistingConversation(groupIdBytes, coreCryptoKeyPackagesPayload);
|
|
226
|
+
}
|
|
227
|
+
// We schedule a key material renewal
|
|
228
|
+
this.scheduleKeyMaterialRenewal(groupId);
|
|
229
|
+
return response;
|
|
200
230
|
}
|
|
201
231
|
removeClientsFromConversation(conversationId, clientIds) {
|
|
202
232
|
return this.processCommitAction(conversationId, () => this.coreCryptoClient.removeClientsFromConversation(conversationId, clientIds));
|
package/package.json
CHANGED