@wireapp/core 40.5.3-draft-20-cc.0 → 40.5.3

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.
@@ -74,7 +74,7 @@ export declare class ConversationService {
74
74
  */
75
75
  addUsersToMLSConversation({ qualifiedUsers, groupId, conversationId, }: Required<AddUsersParams>): Promise<MLSReturnType>;
76
76
  removeUsersFromMLSConversation({ groupId, conversationId, qualifiedUserIds, }: RemoveUsersParams): Promise<MLSReturnType>;
77
- joinByExternalCommit(conversationId: QualifiedId): Promise<PostMlsMessageResponse | null>;
77
+ joinByExternalCommit(conversationId: QualifiedId): Promise<PostMlsMessageResponse>;
78
78
  /**
79
79
  * Will send an external proposal for the current device to join a specific conversation.
80
80
  * In order for the external proposal to be sent correctly, the underlying mls conversation needs to be in a non-established state
@@ -156,7 +156,6 @@ class ConversationService {
156
156
  * @param conversationData
157
157
  */
158
158
  async createMLSConversation(conversationData, selfUserId, selfClientId) {
159
- var _a;
160
159
  const { qualified_users: qualifiedUsers = [] } = conversationData;
161
160
  /**
162
161
  * @note For creating MLS conversations the users & qualified_users
@@ -175,7 +174,7 @@ class ConversationService {
175
174
  // We fetch the fresh version of the conversation created on backend with the newly added users
176
175
  const conversation = await this.apiClient.api.conversation.getConversation(qualifiedId);
177
176
  return {
178
- events: (_a = response === null || response === void 0 ? void 0 : response.events) !== null && _a !== void 0 ? _a : [],
177
+ events: response.events,
179
178
  conversation,
180
179
  };
181
180
  }
@@ -220,7 +219,7 @@ class ConversationService {
220
219
  //We store the info when user was added (and key material was created), so we will know when to renew it
221
220
  this.mlsService.resetKeyMaterialRenewal(groupId);
222
221
  return {
223
- events: (response === null || response === void 0 ? void 0 : response.events) || [],
222
+ events: response.events,
224
223
  conversation,
225
224
  };
226
225
  }
@@ -232,7 +231,7 @@ class ConversationService {
232
231
  this.mlsService.resetKeyMaterialRenewal(groupId);
233
232
  const conversation = await this.getConversation(conversationId);
234
233
  return {
235
- events: (messageResponse === null || messageResponse === void 0 ? void 0 : messageResponse.events) || [],
234
+ events: messageResponse.events,
236
235
  conversation,
237
236
  };
238
237
  }
@@ -3,7 +3,7 @@ import { Subconversation } from '@wireapp/api-client/lib/conversation/Subconvers
3
3
  import { QualifiedId } from '@wireapp/api-client/lib/user';
4
4
  import logdown from 'logdown';
5
5
  import { APIClient } from '@wireapp/api-client';
6
- import { AddProposalArgs, ConversationId, CoreCrypto, DecryptedMessage, ExternalAddProposalArgs, ExternalProposalType, Invitee, ProposalArgs, ProposalType, RemoveProposalArgs } from '@wireapp/core-crypto';
6
+ import { AddProposalArgs, ConversationId, CoreCrypto, DecryptedMessage, ExternalAddProposalArgs, ExternalProposalType, ExternalRemoveProposalArgs, Invitee, ProposalArgs, ProposalType, RemoveProposalArgs } from '@wireapp/core-crypto';
7
7
  import { MLSServiceConfig } from './MLSService.types';
8
8
  import { KeyPackageClaimUser } from '../../../conversation';
9
9
  import { TypedEventEmitter } from '../../../util/TypedEventEmitter';
@@ -30,17 +30,23 @@ export declare class MLSService extends TypedEventEmitter<Events> {
30
30
  groupIdFromConversationId?: MLSCallbacks['groupIdFromConversationId'];
31
31
  private readonly textEncoder;
32
32
  private readonly textDecoder;
33
- private readonly defaultCiphersuite;
34
33
  constructor(apiClient: APIClient, coreCryptoClient: CoreCrypto, { keyingMaterialUpdateThreshold, nbKeyPackages, }: Partial<MLSServiceConfig>);
35
34
  initClient(userId: QualifiedId, clientId: string): Promise<void>;
36
35
  createClient(userId: QualifiedId, clientId: string): Promise<void>;
37
36
  private uploadCommitBundle;
38
- addUsersToExistingConversation(groupId: Uint8Array, invitee: Invitee[]): Promise<PostMlsMessageResponse | null> | null;
37
+ /**
38
+ * Will add users to an existing MLS group and send a commit bundle to backend.
39
+ * Cannot be called with an empty array of keys.
40
+ *
41
+ * @param groupId - the group id of the MLS group
42
+ * @param invitee - the list of keys of clients to add to the MLS group
43
+ */
44
+ addUsersToExistingConversation(groupId: Uint8Array, invitee: Invitee[]): Promise<PostMlsMessageResponse>;
39
45
  configureMLSCallbacks({ groupIdFromConversationId, ...coreCryptoCallbacks }: MLSCallbacks): void;
40
46
  getKeyPackagesPayload(qualifiedUsers: KeyPackageClaimUser[]): Promise<Invitee[]>;
41
47
  getEpoch(groupId: string | Uint8Array): Promise<number>;
42
48
  newProposal(proposalType: ProposalType, args: ProposalArgs | AddProposalArgs | RemoveProposalArgs): Promise<import("@wireapp/core-crypto").ProposalBundle>;
43
- joinByExternalCommit(getGroupInfo: () => Promise<Uint8Array>): Promise<PostMlsMessageResponse | null>;
49
+ joinByExternalCommit(getGroupInfo: () => Promise<Uint8Array>): Promise<PostMlsMessageResponse>;
44
50
  getConferenceSubconversation(conversationId: QualifiedId): Promise<Subconversation>;
45
51
  private deleteConferenceSubconversation;
46
52
  /**
@@ -61,7 +67,7 @@ export declare class MLSService extends TypedEventEmitter<Events> {
61
67
  epoch: number;
62
68
  }>;
63
69
  exportSecretKey(groupId: string, keyLength: number): Promise<string>;
64
- newExternalProposal(externalProposalType: ExternalProposalType, args: ExternalAddProposalArgs): Promise<Uint8Array>;
70
+ newExternalProposal(externalProposalType: ExternalProposalType, args: ExternalAddProposalArgs | ExternalRemoveProposalArgs): Promise<Uint8Array>;
65
71
  processWelcomeMessage(welcomeMessage: Uint8Array): Promise<ConversationId>;
66
72
  decryptMessage(conversationId: ConversationId, payload: Uint8Array): Promise<DecryptedMessage>;
67
73
  encryptMessage(conversationId: ConversationId, message: Uint8Array): Promise<Uint8Array>;
@@ -76,7 +82,7 @@ export declare class MLSService extends TypedEventEmitter<Events> {
76
82
  * @param generateCommit The function that will generate a coreCrypto CommitBundle
77
83
  */
78
84
  private processCommitAction;
79
- updateKeyingMaterial(conversationId: ConversationId): Promise<PostMlsMessageResponse | null>;
85
+ updateKeyingMaterial(conversationId: ConversationId): Promise<PostMlsMessageResponse>;
80
86
  /**
81
87
  * Will create a conversation inside of coreCrypto.
82
88
  * @param groupId the id of the group to create inside of coreCrypto
@@ -86,13 +92,13 @@ export declare class MLSService extends TypedEventEmitter<Events> {
86
92
  registerConversation(groupId: string, users: QualifiedId[], creator?: {
87
93
  user: QualifiedId;
88
94
  client?: string;
89
- }): Promise<PostMlsMessageResponse | null | undefined>;
95
+ }): Promise<PostMlsMessageResponse>;
90
96
  /**
91
97
  * Will send a removal commit for given clients
92
98
  * @param groupId groupId of the conversation
93
99
  * @param clientIds the list of **qualified** ids of the clients we want to remove from the group
94
100
  */
95
- removeClientsFromConversation(groupId: string, clientIds: string[]): Promise<PostMlsMessageResponse | null>;
101
+ removeClientsFromConversation(groupId: string, clientIds: string[]): Promise<PostMlsMessageResponse>;
96
102
  private commitProposals;
97
103
  conversationExists(groupId: string): Promise<boolean>;
98
104
  clientValidKeypackagesCount(): Promise<number>;
@@ -1 +1 @@
1
- {"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,sBAAsB,EAAE,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AAChG,OAAO,EAAC,eAAe,EAAC,MAAM,sDAAsD,CAAC;AACrF,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAIzD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EACL,eAAe,EAIf,cAAc,EACd,UAAU,EAEV,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,gBAAgB,EAAsB,MAAM,oBAAoB,CAAC;AAIzE,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAK1D,OAAO,EAAC,iBAAiB,EAAC,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AACtD,OAAO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AM,CAAA;KAAC,EAAE,CAAC;CAW1G"}
@@ -40,6 +40,7 @@ const bazinga64_1 = require("bazinga64");
40
40
  const logdown_1 = __importDefault(require("logdown"));
41
41
  const commons_1 = require("@wireapp/commons");
42
42
  const core_crypto_1 = require("@wireapp/core-crypto");
43
+ const commitBundleUtil_1 = require("./commitBundleUtil");
43
44
  const pendingProposalsStore_1 = require("./stores/pendingProposalsStore");
44
45
  const subconversationGroupIdStore_1 = require("./stores/subconversationGroupIdStore/subconversationGroupIdStore");
45
46
  const messageSender_1 = require("../../../conversation/message/messageSender");
@@ -66,7 +67,6 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
66
67
  this.logger = (0, logdown_1.default)('@wireapp/core/MLSService');
67
68
  this.textEncoder = new TextEncoder();
68
69
  this.textDecoder = new TextDecoder();
69
- this.defaultCiphersuite = core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519;
70
70
  this.config = {
71
71
  keyingMaterialUpdateThreshold,
72
72
  nbKeyPackages,
@@ -74,21 +74,22 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
74
74
  }
75
75
  async initClient(userId, clientId) {
76
76
  const qualifiedClientId = (0, fullyQualifiedClientIdUtils_1.constructFullyQualifiedClientId)(userId.id, clientId, userId.domain);
77
- await this.coreCryptoClient.mlsInit(this.textEncoder.encode(qualifiedClientId), [this.defaultCiphersuite]);
77
+ await this.coreCryptoClient.mlsInit(this.textEncoder.encode(qualifiedClientId), [
78
+ core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519,
79
+ ]);
78
80
  }
79
81
  async createClient(userId, clientId) {
80
82
  await this.initClient(userId, clientId);
81
83
  // If the device is new, we need to upload keypackages and public key to the backend
82
- const publicKey = await this.coreCryptoClient.clientPublicKey(this.defaultCiphersuite);
83
- const keyPackages = await this.coreCryptoClient.clientKeypackages(this.defaultCiphersuite, this.config.nbKeyPackages);
84
+ const publicKey = await this.coreCryptoClient.clientPublicKey(core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519);
85
+ const keyPackages = await this.coreCryptoClient.clientKeypackages(core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519, this.config.nbKeyPackages);
84
86
  await this.uploadMLSPublicKeys(publicKey, clientId);
85
87
  await this.uploadMLSKeyPackages(keyPackages, clientId);
86
88
  }
87
89
  async uploadCommitBundle(groupId, commitBundle, { regenerateCommitBundle, isExternalCommit } = {}) {
88
- const { commit, groupInfo, welcome } = commitBundle;
89
- const bundlePayload = new Uint8Array([...commit, ...groupInfo.payload, ...(welcome || [])]);
90
+ const bundlePayload = (0, commitBundleUtil_1.toProtobufCommitBundle)(commitBundle);
90
91
  try {
91
- const response = await this.apiClient.api.conversation.postMlsCommitBundle(bundlePayload);
92
+ const response = await this.apiClient.api.conversation.postMlsCommitBundle(bundlePayload.slice());
92
93
  if (isExternalCommit) {
93
94
  await this.coreCryptoClient.mergePendingGroupFromExternalCommit(groupId);
94
95
  }
@@ -116,14 +117,19 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
116
117
  else {
117
118
  await this.coreCryptoClient.clearPendingCommit(groupId);
118
119
  }
120
+ throw error;
119
121
  }
120
- return null;
121
122
  }
123
+ /**
124
+ * Will add users to an existing MLS group and send a commit bundle to backend.
125
+ * Cannot be called with an empty array of keys.
126
+ *
127
+ * @param groupId - the group id of the MLS group
128
+ * @param invitee - the list of keys of clients to add to the MLS group
129
+ */
122
130
  addUsersToExistingConversation(groupId, invitee) {
123
131
  if (invitee.length < 1) {
124
- // providing an empty invitee list to addClientsToConversation method would make core-crypto throw an error
125
- // we want to skip adding clinets in this case
126
- return null;
132
+ throw new Error('Empty list of keys provided to addUsersToExistingConversation');
127
133
  }
128
134
  return this.processCommitAction(groupId, () => this.coreCryptoClient.addClientsToConversation(groupId, invitee));
129
135
  }
@@ -299,7 +305,7 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
299
305
  const mlsKeyBytes = Object.values(mlsKeys).map((key) => bazinga64_1.Decoder.fromBase64(key).asBytes);
300
306
  const configuration = {
301
307
  externalSenders: mlsKeyBytes,
302
- ciphersuite: this.defaultCiphersuite,
308
+ ciphersuite: core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519,
303
309
  };
304
310
  await this.coreCryptoClient.createConversation(groupIdBytes, core_crypto_1.CredentialType.Basic, configuration);
305
311
  const keyPackages = await this.getKeyPackagesPayload(users.map(user => {
@@ -338,10 +344,10 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
338
344
  return this.coreCryptoClient.conversationExists(groupIdBytes);
339
345
  }
340
346
  async clientValidKeypackagesCount() {
341
- return this.coreCryptoClient.clientValidKeypackagesCount(this.defaultCiphersuite);
347
+ return this.coreCryptoClient.clientValidKeypackagesCount(core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519);
342
348
  }
343
349
  async clientKeypackages(amountRequested) {
344
- return this.coreCryptoClient.clientKeypackages(this.defaultCiphersuite, amountRequested);
350
+ return this.coreCryptoClient.clientKeypackages(core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519, amountRequested);
345
351
  }
346
352
  /**
347
353
  * Renew key material for a given groupId
@@ -4,5 +4,5 @@ import { CommitBundle } from '@wireapp/core-crypto';
4
4
  * @param commitBundle a commit bundle generated by coreCrypto
5
5
  * @returns
6
6
  */
7
- export declare function toProtobufCommitBundle({ commit, welcome, groupInfo }: CommitBundle): Uint8Array;
7
+ export declare function toProtobufCommitBundle({ commit, welcome, publicGroupState }: CommitBundle): Uint8Array;
8
8
  //# sourceMappingURL=commitBundleUtil.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"commitBundleUtil.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/commitBundleUtil.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAC,YAAY,EAA2C,MAAM,sBAAsB,CAAC;AAY5F;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,EAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAC,EAAE,YAAY,GAAG,UAAU,CAW7F"}
1
+ {"version":3,"file":"commitBundleUtil.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/commitBundleUtil.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAC,YAAY,EAAkD,MAAM,sBAAsB,CAAC;AAYnG;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,EAAC,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAC,EAAE,YAAY,GAAG,UAAU,CAWpG"}
@@ -27,20 +27,20 @@ const ratchetTreeMapping = {
27
27
  [core_crypto_1.RatchetTreeType.Delta]: mls_1.mls.RatchetTreeType.DELTA,
28
28
  };
29
29
  const groupInfoType = {
30
- [core_crypto_1.GroupInfoEncryptionType.Plaintext]: mls_1.mls.GroupInfoType.PUBLIC_GROUP_STATE,
31
- [core_crypto_1.GroupInfoEncryptionType.JweEncrypted]: mls_1.mls.GroupInfoType.GROUP_INFO_JWE,
30
+ [core_crypto_1.PublicGroupStateEncryptionType.Plaintext]: mls_1.mls.GroupInfoType.PUBLIC_GROUP_STATE,
31
+ [core_crypto_1.PublicGroupStateEncryptionType.JweEncrypted]: mls_1.mls.GroupInfoType.GROUP_INFO_JWE,
32
32
  };
33
33
  /**
34
34
  * Will convert a coreCrypto commit bundle into a Uint8Array representing a protobuf object
35
35
  * @param commitBundle a commit bundle generated by coreCrypto
36
36
  * @returns
37
37
  */
38
- function toProtobufCommitBundle({ commit, welcome, groupInfo }) {
39
- const { ratchetTreeType, encryptionType } = groupInfo;
38
+ function toProtobufCommitBundle({ commit, welcome, publicGroupState }) {
39
+ const { ratchetTreeType, encryptionType } = publicGroupState;
40
40
  return mls_1.mls.CommitBundle.encode({
41
41
  groupInfoBundle: {
42
42
  ratchetTreeType: ratchetTreeMapping[ratchetTreeType],
43
- groupInfo: groupInfo.payload,
43
+ groupInfo: publicGroupState.payload,
44
44
  groupInfoType: groupInfoType[encryptionType],
45
45
  },
46
46
  commit,
@@ -27,17 +27,17 @@ describe('toProtobufCommitBundle', () => {
27
27
  const payload = {
28
28
  commit: Uint8Array.from([0]),
29
29
  welcome: Uint8Array.from([1]),
30
- groupInfo: {
30
+ publicGroupState: {
31
31
  ratchetTreeType: core_crypto_1.RatchetTreeType.Full,
32
32
  payload: Uint8Array.from([2]),
33
- encryptionType: core_crypto_1.GroupInfoEncryptionType.Plaintext,
33
+ encryptionType: core_crypto_1.PublicGroupStateEncryptionType.Plaintext,
34
34
  },
35
35
  };
36
36
  const result = (0, commitBundleUtil_1.toProtobufCommitBundle)(payload);
37
37
  const { commit, welcome, groupInfoBundle } = mls_1.mls.CommitBundle.decode(result);
38
38
  expect(bazinga64_1.Encoder.toBase64(commit)).toEqual(bazinga64_1.Encoder.toBase64(payload.commit));
39
39
  expect(bazinga64_1.Encoder.toBase64(welcome)).toEqual(bazinga64_1.Encoder.toBase64(payload.welcome));
40
- expect(bazinga64_1.Encoder.toBase64(groupInfoBundle.groupInfo)).toEqual(bazinga64_1.Encoder.toBase64(payload.groupInfo.payload));
40
+ expect(bazinga64_1.Encoder.toBase64(groupInfoBundle.groupInfo)).toEqual(bazinga64_1.Encoder.toBase64(payload.publicGroupState.payload));
41
41
  expect(groupInfoBundle.ratchetTreeType).toEqual(mls_1.mls.RatchetTreeType.FULL);
42
42
  expect(groupInfoBundle.groupInfoType).toEqual(mls_1.mls.GroupInfoType.PUBLIC_GROUP_STATE);
43
43
  });
package/package.json CHANGED
@@ -11,9 +11,9 @@
11
11
  "./lib/cryptography/AssetCryptography/crypto.node": "./lib/cryptography/AssetCryptography/crypto.browser.js"
12
12
  },
13
13
  "dependencies": {
14
- "@wireapp/api-client": "^24.15.6-draft-20-cc.0",
14
+ "@wireapp/api-client": "^24.15.6",
15
15
  "@wireapp/commons": "^5.1.0",
16
- "@wireapp/core-crypto": "1.0.0-pre.5",
16
+ "@wireapp/core-crypto": "0.11.0",
17
17
  "@wireapp/cryptobox": "12.8.0",
18
18
  "@wireapp/promise-queue": "^2.2.0",
19
19
  "@wireapp/protocol-messaging": "1.44.0",
@@ -37,7 +37,7 @@
37
37
  "@types/long": "^5.0.0",
38
38
  "@types/rimraf": "^3.0.2",
39
39
  "@types/tough-cookie": "4.0.2",
40
- "commander": "10.0.1",
40
+ "commander": "11.0.0",
41
41
  "cross-env": "7.0.3",
42
42
  "dotenv-defaults": "5.0.2",
43
43
  "fake-indexeddb": "^4.0.0",
@@ -60,6 +60,6 @@
60
60
  "test:coverage": "jest --coverage",
61
61
  "watch": "tsc --watch"
62
62
  },
63
- "version": "40.5.3-draft-20-cc.0",
64
- "gitHead": "65797abcfc2b0c8e61c5375f7de53b983347a4b9"
63
+ "version": "40.5.3",
64
+ "gitHead": "20950a4f74a00ab33d6e46cc34ee425def930462"
65
65
  }