@wireapp/core 45.3.7 → 46.0.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.d.ts CHANGED
@@ -12,7 +12,7 @@ import { AssetService, ConversationService } from './conversation/';
12
12
  import { SubconversationService } from './conversation/SubconversationService/SubconversationService';
13
13
  import { GiphyService } from './giphy/';
14
14
  import { LinkPreviewService } from './linkPreview';
15
- import { MLSService } from './messagingProtocols/mls';
15
+ import { InitClientOptions, MLSService } from './messagingProtocols/mls';
16
16
  import { E2EIServiceExternal } from './messagingProtocols/mls/E2EIdentityService';
17
17
  import { getTokenCallback } from './messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal';
18
18
  import { CoreCallbacks, CoreCryptoConfig, SecretCrypto } from './messagingProtocols/mls/types';
@@ -56,7 +56,7 @@ interface AccountOptions {
56
56
  */
57
57
  nbPrekeys: number;
58
58
  /**
59
- * Config for MLS and proteus devices. Will fallback to the old cryptobox logic if not provided
59
+ * Config for coreCrypto in case it supposed to be used. Will fallback to the old cryptobox logic if not provided
60
60
  */
61
61
  coreCryptoConfig?: CoreCryptoConfig;
62
62
  }
@@ -72,7 +72,6 @@ export declare class Account extends TypedEventEmitter<Events> {
72
72
  private readonly apiClient;
73
73
  private readonly logger;
74
74
  private readonly coreCryptoConfig?;
75
- private readonly isMlsEnabled;
76
75
  /** this is the client the consumer is currently using. Will be set as soon as `initClient` is called and will be rest upon logout */
77
76
  private currentClient?;
78
77
  private storeEngine?;
@@ -165,7 +164,7 @@ export declare class Account extends TypedEventEmitter<Events> {
165
164
  *
166
165
  * @returns The local existing client or undefined if the client does not exist or is not valid (non existing on backend)
167
166
  */
168
- initClient(client: RegisteredClient, willEnrollE2ei?: boolean): Promise<RegisteredClient>;
167
+ initClient(client: RegisteredClient, mlsConfig?: InitClientOptions): Promise<RegisteredClient>;
169
168
  private buildCryptoClient;
170
169
  /**
171
170
  * In order to be able to send MLS messages, the core needs a few information from the consumer.
@@ -175,7 +174,7 @@ export declare class Account extends TypedEventEmitter<Events> {
175
174
  * @param coreCallbacks
176
175
  */
177
176
  configureCoreCallbacks(coreCallbacks: CoreCallbacks): void;
178
- initServices(context: Context): Promise<void>;
177
+ private initServices;
179
178
  private resetContext;
180
179
  /**
181
180
  * Will logout the current user
@@ -1 +1 @@
1
- {"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../src/Account.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EAGZ,OAAO,EACP,MAAM,EAEN,SAAS,EAEV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAuB,UAAU,EAAE,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AAEnG,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AASxD,OAAO,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAC,UAAU,EAAe,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,WAAW,CAAC;AACpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAC,YAAY,EAAE,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAC,sBAAsB,EAAC,MAAM,8DAA8D,CAAC;AACpG,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAMpD,OAAO,EAAC,mBAAmB,EAAO,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAC,gBAAgB,EAAC,MAAM,iEAAiE,CAAC;A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AC,EAAE,OAAO,CAAC;KACb,GAAG,MAAM,IAAI;IAgGnB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,uBAAuB;YAIjB,UAAU;IAuBxB,OAAO,CAAC,yBAAyB,CAS/B;CACH"}
package/lib/Account.js CHANGED
@@ -127,7 +127,6 @@ class Account extends commons_1.TypedEventEmitter {
127
127
  this.apiClient = apiClient;
128
128
  this.backendFeatures = this.apiClient.backendFeatures;
129
129
  this.coreCryptoConfig = options.coreCryptoConfig;
130
- this.isMlsEnabled = async () => { var _a; return !!((_a = this.coreCryptoConfig) === null || _a === void 0 ? void 0 : _a.mls) && (await this.apiClient.supportsMLS()); };
131
130
  this.recurringTaskScheduler = new RecurringTaskScheduler_1.RecurringTaskScheduler({
132
131
  get: async (key) => {
133
132
  var _a;
@@ -265,7 +264,7 @@ class Account extends commons_1.TypedEventEmitter {
265
264
  *
266
265
  * @returns The local existing client or undefined if the client does not exist or is not valid (non existing on backend)
267
266
  */
268
- async initClient(client, willEnrollE2ei = false) {
267
+ async initClient(client, mlsConfig) {
269
268
  if (!this.service || !this.apiClient.context || !this.storeEngine) {
270
269
  throw new Error('Services are not set.');
271
270
  }
@@ -274,8 +273,11 @@ class Account extends commons_1.TypedEventEmitter {
274
273
  await this.apiClient.transport.http.associateClientWithSession(client.id);
275
274
  await this.service.proteus.initClient(this.storeEngine, this.apiClient.context);
276
275
  if (this.service.mls) {
276
+ if (!mlsConfig) {
277
+ throw new Error('trying to init MLS without config. Please provide a config to initClient method.');
278
+ }
277
279
  const { userId, domain = '' } = this.apiClient.context;
278
- await this.service.mls.initClient({ id: userId, domain }, client, willEnrollE2ei);
280
+ await this.service.mls.initClient({ id: userId, domain }, client, mlsConfig);
279
281
  // initialize schedulers for pending mls proposals once client is initialized
280
282
  await this.service.mls.initialisePendingProposalsTasks();
281
283
  // initialize scheduler for syncing key packages with backend
@@ -316,7 +318,6 @@ class Account extends commons_1.TypedEventEmitter {
316
318
  this.coreCallbacks = coreCallbacks;
317
319
  }
318
320
  async initServices(context) {
319
- var _a;
320
321
  const encryptedStoreName = this.generateEncryptedDbName(context);
321
322
  this.encryptedDb = this.options.systemCrypto
322
323
  ? await (0, encryptedStore_1.createCustomEncryptedStore)(encryptedStoreName, this.options.systemCrypto)
@@ -334,8 +335,8 @@ class Account extends commons_1.TypedEventEmitter {
334
335
  nbPrekeys: this.options.nbPrekeys,
335
336
  });
336
337
  const clientService = new client_2.ClientService(this.apiClient, proteusService, this.storeEngine);
337
- if (clientType === CryptoClient_1.CryptoClientType.CORE_CRYPTO && (await this.isMlsEnabled())) {
338
- mlsService = new mls_1.MLSService(this.apiClient, cryptoClient.getNativeClient(), this.db, this.recurringTaskScheduler, Object.assign({}, (_a = this.coreCryptoConfig) === null || _a === void 0 ? void 0 : _a.mls));
338
+ if (clientType === CryptoClient_1.CryptoClientType.CORE_CRYPTO && (await this.apiClient.supportsMLS())) {
339
+ mlsService = new mls_1.MLSService(this.apiClient, cryptoClient.getNativeClient(), this.db, this.recurringTaskScheduler);
339
340
  e2eServiceExternal = new E2EIdentityService_1.E2EIServiceExternal(cryptoClient.getNativeClient(), this.db, this.recurringTaskScheduler, clientService, mlsService);
340
341
  }
341
342
  const connectionService = new connection_1.ConnectionService(this.apiClient);
@@ -68,7 +68,7 @@ const MOCK_BACKEND = {
68
68
  async function createAccount() {
69
69
  const apiClient = new api_client_1.APIClient({ urls: MOCK_BACKEND });
70
70
  const account = new Account_1.Account(apiClient);
71
- await account.initServices({
71
+ await account['initServices']({
72
72
  clientType: client_1.ClientType.TEMPORARY,
73
73
  userId: '',
74
74
  });
@@ -173,7 +173,7 @@ describe('Account', () => {
173
173
  describe('"init"', () => {
174
174
  it('initializes the Protocol buffers', async () => {
175
175
  const account = new Account_1.Account();
176
- await account.initServices({ clientType: client_1.ClientType.TEMPORARY, userId: '' });
176
+ await account['initServices']({ clientType: client_1.ClientType.TEMPORARY, userId: '' });
177
177
  expect(account.service.conversation).toBeDefined();
178
178
  const message = protocol_messaging_1.GenericMessage.create({
179
179
  messageId: '2d7cb6d8-118f-11e8-b642-0ed5f89f718b',
@@ -186,7 +186,7 @@ describe('Account', () => {
186
186
  it('logs in with correct credentials', async () => {
187
187
  const apiClient = new api_client_1.APIClient({ urls: MOCK_BACKEND });
188
188
  const account = new Account_1.Account(apiClient);
189
- await account.initServices({ clientType: client_1.ClientType.TEMPORARY, userId: '' });
189
+ await account['initServices']({ clientType: client_1.ClientType.TEMPORARY, userId: '' });
190
190
  const { clientType, userId } = await account.login({
191
191
  clientType: client_1.ClientType.TEMPORARY,
192
192
  email: 'hello@example.com',
@@ -199,7 +199,7 @@ describe('Account', () => {
199
199
  const apiClient = new api_client_1.APIClient({ urls: MOCK_BACKEND });
200
200
  const account = new Account_1.Account(apiClient);
201
201
  let backendError;
202
- await account.initServices({ clientType: client_1.ClientType.TEMPORARY, userId: '' });
202
+ await account['initServices']({ clientType: client_1.ClientType.TEMPORARY, userId: '' });
203
203
  try {
204
204
  await account.login({
205
205
  clientType: client_1.ClientType.TEMPORARY,
package/lib/index.d.ts CHANGED
@@ -6,4 +6,5 @@ export * as cryptography from './cryptography/';
6
6
  export * as util from './util';
7
7
  export * as MessageBuilder from './conversation/message/MessageBuilder';
8
8
  export * as errors from './errors';
9
+ export { Ciphersuite } from '@wireapp/core-crypto';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAC,MAAM,WAAW,CAAC;AAC1E,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAChC,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,uCAAuC,CAAC;AACxE,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAC,MAAM,WAAW,CAAC;AAC1E,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAChC,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,uCAAuC,CAAC;AACxE,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC"}
package/lib/index.js CHANGED
@@ -41,7 +41,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
41
41
  return result;
42
42
  };
43
43
  Object.defineProperty(exports, "__esModule", { value: true });
44
- exports.errors = exports.MessageBuilder = exports.util = exports.cryptography = exports.CoreError = exports.conversation = exports.auth = exports.ConnectionState = exports.Account = void 0;
44
+ exports.Ciphersuite = exports.errors = exports.MessageBuilder = exports.util = exports.cryptography = exports.CoreError = exports.conversation = exports.auth = exports.ConnectionState = exports.Account = void 0;
45
45
  var Account_1 = require("./Account");
46
46
  Object.defineProperty(exports, "Account", { enumerable: true, get: function () { return Account_1.Account; } });
47
47
  Object.defineProperty(exports, "ConnectionState", { enumerable: true, get: function () { return Account_1.ConnectionState; } });
@@ -53,3 +53,5 @@ exports.cryptography = __importStar(require("./cryptography/"));
53
53
  exports.util = __importStar(require("./util"));
54
54
  exports.MessageBuilder = __importStar(require("./conversation/message/MessageBuilder"));
55
55
  exports.errors = __importStar(require("./errors"));
56
+ var core_crypto_1 = require("@wireapp/core-crypto");
57
+ Object.defineProperty(exports, "Ciphersuite", { enumerable: true, get: function () { return core_crypto_1.Ciphersuite; } });
@@ -1 +1 @@
1
- {"version":3,"file":"E2EIServiceExternal.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAIzD,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAC,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,EAAiB,MAAM,sBAAsB,CAAC;AAMnH,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAC,sBAAsB,EAAuB,MAAM,+BAA+B,CAAC;AAC3F,OAAO,EAAC,sBAAsB,EAAC,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG;IACnE,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,WAAW,CAAC;CAC9B,CAAC;AAEF,KAAK,MAAM,GAAG;IACZ,UAAU,EAAE;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,CAAC;CAC9B,CAAC;AAqBF,qBAAa,mBAAoB,SAAQ,iBAAiB,CAAC,MAAM,CAAC;IAK9D,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAR7B,OA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C5B,UAAU,EAAE,UAAU;IAU5B,sBAAsB,IAAI,OAAO,CAAC,OAAO,CAAC;IAKhD,gBAAgB;IAIV,oBAAoB,CAAC,cAAc,EAAE,UAAU,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAKtF,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IAI3B,0BAA0B,CACrC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,cAAc,EAAE,CAAC,GAAG,SAAS,CAAC;IAsBxD,kBAAkB,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,WAAW,EAAE,GACrB,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,cAAc,EAAE,CAAC,GAAG,SAAS,CAAC;IA0DxD,oBAAoB,CAC/B,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAC1C,OAAO,CAAC,cAAc,EAAE,CAAC;IAgBf,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC;YAKvC,4BAA4B;IAO1C;;;;;OAKG;IACU,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5D,OAAO,KAAK,WAAW,GAKtB;YAEa,+BAA+B;IAK7C;;;;;;;;;;;;OAYG;YACW,0BAA0B;IA2BxC,OAAO,CAAC,4BAA4B;YAStB,+BAA+B;YAQ/B,uBAAuB;YAKvB,0BAA0B;YAI1B,4BAA4B;YAO5B,WAAW;YAkBX,8BAA8B;CAM7C"}
@@ -70,7 +70,7 @@ class E2EIServiceExternal extends commons_1.TypedEventEmitter {
70
70
  return fixConversationState(state);
71
71
  }
72
72
  isE2EIEnabled() {
73
- return this.coreCryptoClient.e2eiIsEnabled(this.mlsService.config.cipherSuite);
73
+ return this.coreCryptoClient.e2eiIsEnabled(this.mlsService.config.defaultCiphersuite);
74
74
  }
75
75
  async getAllGroupUsersIdentities(groupId) {
76
76
  const conversationExists = await this.mlsService.conversationExists(groupId);
@@ -120,10 +120,7 @@ class E2EIServiceExternal extends commons_1.TypedEventEmitter {
120
120
  }
121
121
  async isFreshMLSSelfClient() {
122
122
  const client = await this.clientService.loadClient();
123
- if (!client) {
124
- return true;
125
- }
126
- return !(0, Helper_1.isMLSDevice)(client);
123
+ return !client || !this.mlsService.isInitializedMLSClient(client);
127
124
  }
128
125
  async registerLocalCertificateRoot(acmeService) {
129
126
  const localCertificateRoot = await acmeService.getLocalCertificateRoot();
@@ -1,4 +1,5 @@
1
1
  import { RegisteredClient } from '@wireapp/api-client/lib/client';
2
+ import { Ciphersuite } from '@wireapp/core-crypto';
2
3
  import { ClientIdStringType } from '../../../../util/fullyQualifiedClientIdUtils';
3
4
  export declare const jsonToByteArray: (data: any) => Uint8Array;
4
5
  type GetE2EIClientIdReturnType = {
@@ -6,7 +7,7 @@ type GetE2EIClientIdReturnType = {
6
7
  asBytes: Uint8Array;
7
8
  };
8
9
  export declare const getE2EIClientId: (clientId: string, userId: string, userDomain: string) => GetE2EIClientIdReturnType;
9
- export declare const isMLSDevice: ({ mls_public_keys }: RegisteredClient) => boolean;
10
+ export declare const isMLSDevice: ({ mls_public_keys }: RegisteredClient, ciphersuite: Ciphersuite) => boolean;
10
11
  export declare const isResponseStatusValid: (status: string | undefined) => boolean | "" | undefined;
11
12
  export {};
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Helper/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AAEhE,OAAO,EAAC,kBAAkB,EAAkC,MAAM,8CAA8C,CAAC;AAEjH,eAAO,MAAM,eAAe,SAAU,GAAG,KAAG,UAG3C,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC;AACF,eAAO,MAAM,eAAe,aAAc,MAAM,UAAU,MAAM,cAAc,MAAM,KAAG,yBAOtF,CAAC;AAEF,eAAO,MAAM,WAAW,wBAAuB,gBAAgB,YACoB,CAAC;AAEpF,eAAO,MAAM,qBAAqB,WAAY,MAAM,GAAG,SAAS,6BAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Helper/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EAA4B,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AAE3F,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAC,kBAAkB,EAAkC,MAAM,8CAA8C,CAAC;AAEjH,eAAO,MAAM,eAAe,SAAU,GAAG,KAAG,UAG3C,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC;AACF,eAAO,MAAM,eAAe,aAAc,MAAM,UAAU,MAAM,cAAc,MAAM,KAAG,yBAOtF,CAAC;AAgBF,eAAO,MAAM,WAAW,wBAAuB,gBAAgB,eAAe,WAAW,YAIxF,CAAC;AAEF,eAAO,MAAM,qBAAqB,WAAY,MAAM,GAAG,SAAS,6BAAiC,CAAC"}
@@ -19,6 +19,8 @@
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.isResponseStatusValid = exports.isMLSDevice = exports.getE2EIClientId = exports.jsonToByteArray = void 0;
22
+ const client_1 = require("@wireapp/api-client/lib/client");
23
+ const core_crypto_1 = require("@wireapp/core-crypto");
22
24
  const fullyQualifiedClientIdUtils_1 = require("../../../../util/fullyQualifiedClientIdUtils");
23
25
  const jsonToByteArray = (data) => {
24
26
  const encoder = new TextEncoder();
@@ -34,7 +36,24 @@ const getE2EIClientId = (clientId, userId, userDomain) => {
34
36
  };
35
37
  };
36
38
  exports.getE2EIClientId = getE2EIClientId;
37
- const isMLSDevice = ({ mls_public_keys }) => typeof mls_public_keys.ed25519 === 'string' && mls_public_keys.ed25519.length > 0;
39
+ /**
40
+ * depending on the ciphersuite used, the signature algorithm used is different. We need to keep a mapping of the ciphersuite to the signature algorithm
41
+ */
42
+ const ciphersuiteSignatureAlgorithmMap = {
43
+ [core_crypto_1.Ciphersuite.MLS_128_DHKEMP256_AES128GCM_SHA256_P256]: client_1.MLSPublicKeyAlgorithmKeys.P256,
44
+ [core_crypto_1.Ciphersuite.MLS_256_DHKEMP384_AES256GCM_SHA384_P384]: client_1.MLSPublicKeyAlgorithmKeys.P384,
45
+ [core_crypto_1.Ciphersuite.MLS_256_DHKEMP521_AES256GCM_SHA512_P521]: client_1.MLSPublicKeyAlgorithmKeys.P521,
46
+ [core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448]: client_1.MLSPublicKeyAlgorithmKeys.ED448,
47
+ [core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448]: client_1.MLSPublicKeyAlgorithmKeys.ED448,
48
+ [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519]: client_1.MLSPublicKeyAlgorithmKeys.ED25519,
49
+ [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519]: client_1.MLSPublicKeyAlgorithmKeys.ED25519,
50
+ [core_crypto_1.Ciphersuite.MLS_128_X25519KYBER768DRAFT00_AES128GCM_SHA256_Ed25519]: client_1.MLSPublicKeyAlgorithmKeys.ED25519,
51
+ };
52
+ const isMLSDevice = ({ mls_public_keys }, ciphersuite) => {
53
+ const signatureAlogrithm = ciphersuiteSignatureAlgorithmMap[ciphersuite];
54
+ const signature = mls_public_keys[signatureAlogrithm];
55
+ return typeof signature === 'string' && signature.length > 0;
56
+ };
38
57
  exports.isMLSDevice = isMLSDevice;
39
58
  const isResponseStatusValid = (status) => status && status === 'valid';
40
59
  exports.isResponseStatusValid = isResponseStatusValid;
@@ -5,21 +5,32 @@ import { QualifiedId } from '@wireapp/api-client/lib/user';
5
5
  import logdown from 'logdown';
6
6
  import { APIClient } from '@wireapp/api-client';
7
7
  import { TypedEventEmitter } from '@wireapp/commons';
8
- import { AddProposalArgs, ConversationId, CoreCrypto, DecryptedMessage, ProposalArgs, ProposalType, RemoveProposalArgs } from '@wireapp/core-crypto';
9
- import { MLSServiceConfig } from './MLSService.types';
8
+ import { AddProposalArgs, Ciphersuite, ConversationId, CoreCrypto, DecryptedMessage, ProposalArgs, ProposalType, RemoveProposalArgs } from '@wireapp/core-crypto';
10
9
  import { AddUsersFailure, KeyPackageClaimUser } from '../../../conversation';
11
10
  import { CoreDatabase } from '../../../storage/CoreDB';
12
11
  import { RecurringTaskScheduler } from '../../../util/RecurringTaskScheduler';
13
12
  import { User } from '../E2EIdentityService';
14
13
  import { getTokenCallback } from '../E2EIdentityService/E2EIServiceInternal';
15
14
  import { ClientId, HandlePendingProposalsParams } from '../types';
16
- export declare const optionalToUint8Array: (array: Uint8Array | []) => Uint8Array;
17
- interface LocalMLSServiceConfig extends MLSServiceConfig {
15
+ type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
16
+ interface MLSConfig {
17
+ /** List of ciphersuites that could be used for MLS */
18
+ ciphersuites: Ciphersuite[];
19
+ /** preferred ciphersuite to use */
20
+ defaultCiphersuite: Ciphersuite;
21
+ /**
22
+ * (milliseconds) period of time between automatic updates of the keying material (30 days by default)
23
+ */
24
+ keyingMaterialUpdateThreshold: number;
18
25
  /**
19
- * minimum number of key packages client should have available (configured to half of nbKeyPackages)
26
+ * number of key packages client should upload to the server (100 by default)
20
27
  */
21
- minRequiredNumberOfAvailableKeyPackages: number;
28
+ nbKeyPackages: number;
22
29
  }
30
+ export type InitClientOptions = Optional<MLSConfig, 'keyingMaterialUpdateThreshold' | 'nbKeyPackages'> & {
31
+ skipInitIdentity?: boolean;
32
+ };
33
+ export declare const optionalToUint8Array: (array: Uint8Array | []) => Uint8Array;
23
34
  type Events = {
24
35
  newEpoch: {
25
36
  epoch: number;
@@ -33,18 +44,25 @@ export declare class MLSService extends TypedEventEmitter<Events> {
33
44
  private readonly coreDatabase;
34
45
  private readonly recurringTaskScheduler;
35
46
  logger: logdown.Logger;
36
- config: LocalMLSServiceConfig;
47
+ private _config?;
37
48
  private readonly textEncoder;
38
49
  private readonly textDecoder;
39
50
  private readonly conflictBackoffQueue;
40
- constructor(apiClient: APIClient, coreCryptoClient: CoreCrypto, coreDatabase: CoreDatabase, recurringTaskScheduler: RecurringTaskScheduler, { keyingMaterialUpdateThreshold, nbKeyPackages, cipherSuite, }: Partial<MLSServiceConfig>);
51
+ constructor(apiClient: APIClient, coreCryptoClient: CoreCrypto, coreDatabase: CoreDatabase, recurringTaskScheduler: RecurringTaskScheduler);
52
+ get config(): MLSConfig;
53
+ private get minRequiredKeyPackages();
41
54
  /**
42
55
  * Will initialize an MLS client
43
56
  * @param userId the user owning the client
44
57
  * @param client id of the client to initialize
45
58
  * @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)
46
59
  */
47
- initClient(userId: QualifiedId, client: RegisteredClient, skipInitIdentity?: boolean): Promise<void>;
60
+ initClient(userId: QualifiedId, client: RegisteredClient, { skipInitIdentity, ...mlsConfig }: InitClientOptions): Promise<void>;
61
+ /**
62
+ * returns true if the client has a valid MLS identity in regard of the default ciphersuite set
63
+ * @param client the client to check
64
+ */
65
+ isInitializedMLSClient: (client: RegisteredClient) => boolean;
48
66
  private getCredentialType;
49
67
  private uploadCommitBundle;
50
68
  private readonly _uploadCommitBundle;
@@ -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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B,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;CAqCjB"}
@@ -61,10 +61,9 @@ exports.optionalToUint8Array = optionalToUint8Array;
61
61
  const defaultConfig = {
62
62
  keyingMaterialUpdateThreshold: 1000 * 60 * 60 * 24 * 30, //30 days
63
63
  nbKeyPackages: 100,
64
- cipherSuite: core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519,
65
64
  };
66
65
  class MLSService extends commons_1.TypedEventEmitter {
67
- constructor(apiClient, coreCryptoClient, coreDatabase, recurringTaskScheduler, { keyingMaterialUpdateThreshold = defaultConfig.keyingMaterialUpdateThreshold, nbKeyPackages = defaultConfig.nbKeyPackages, cipherSuite = defaultConfig.cipherSuite, }) {
66
+ constructor(apiClient, coreCryptoClient, coreDatabase, recurringTaskScheduler) {
68
67
  super();
69
68
  this.apiClient = apiClient;
70
69
  this.coreCryptoClient = coreCryptoClient;
@@ -79,6 +78,11 @@ class MLSService extends commons_1.TypedEventEmitter {
79
78
  maxRetryDelay: TimeUtil_1.TimeInMillis.SECOND * 32,
80
79
  shouldRetry: error => error instanceof http_1.BackendError && error.code === http_1.StatusCode.CONFLICT,
81
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);
82
86
  this.uploadCommitBundle = async (groupId, commitBundle, { isExternalCommit = false, regenerateCommitBundle } = {}) => {
83
87
  try {
84
88
  return await this._uploadCommitBundle(groupId, async () => commitBundle, isExternalCommit);
@@ -152,12 +156,15 @@ class MLSService extends commons_1.TypedEventEmitter {
152
156
  return false;
153
157
  }
154
158
  };
155
- this.config = {
156
- keyingMaterialUpdateThreshold,
157
- nbKeyPackages,
158
- cipherSuite,
159
- minRequiredNumberOfAvailableKeyPackages: Math.floor(nbKeyPackages / 2),
160
- };
159
+ }
160
+ get config() {
161
+ if (!this._config) {
162
+ throw new Error('mls config is not set, did you forget to call initClient?');
163
+ }
164
+ return this._config;
165
+ }
166
+ get minRequiredKeyPackages() {
167
+ return Math.floor(this.config.nbKeyPackages / 2);
161
168
  }
162
169
  /**
163
170
  * Will initialize an MLS client
@@ -165,15 +172,17 @@ class MLSService extends commons_1.TypedEventEmitter {
165
172
  * @param client id of the client to initialize
166
173
  * @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)
167
174
  */
168
- async initClient(userId, client, skipInitIdentity = false) {
169
- await this.coreCryptoClient.mlsInit((0, MLSId_1.generateMLSDeviceId)(userId, client.id), [this.config.cipherSuite], this.config.nbKeyPackages);
175
+ async initClient(userId, client, _a) {
176
+ var { skipInitIdentity } = _a, mlsConfig = __rest(_a, ["skipInitIdentity"]);
177
+ this._config = Object.assign(Object.assign({}, mlsConfig), defaultConfig);
178
+ await this.coreCryptoClient.mlsInit((0, MLSId_1.generateMLSDeviceId)(userId, client.id), this.config.ciphersuites, this.config.nbKeyPackages);
170
179
  await this.coreCryptoClient.registerCallbacks({
171
180
  // All authorization/membership rules are enforced on backend
172
181
  clientIsExistingGroupUser: async () => true,
173
182
  authorize: async () => true,
174
183
  userAuthorize: async () => true,
175
184
  });
176
- const isFreshMLSSelfClient = typeof client.mls_public_keys.ed25519 !== 'string' || client.mls_public_keys.ed25519.length === 0;
185
+ const isFreshMLSSelfClient = !this.isInitializedMLSClient(client);
177
186
  const shouldinitIdentity = !(isFreshMLSSelfClient && skipInitIdentity);
178
187
  if (shouldinitIdentity) {
179
188
  // We need to make sure keypackages and public key are uploaded to the backend
@@ -187,7 +196,7 @@ class MLSService extends commons_1.TypedEventEmitter {
187
196
  }
188
197
  }
189
198
  async getCredentialType() {
190
- return (await this.coreCryptoClient.e2eiIsEnabled(this.config.cipherSuite))
199
+ return (await this.coreCryptoClient.e2eiIsEnabled(this.config.defaultCiphersuite))
191
200
  ? core_crypto_1.CredentialType.X509
192
201
  : core_crypto_1.CredentialType.Basic;
193
202
  }
@@ -231,7 +240,7 @@ class MLSService extends commons_1.TypedEventEmitter {
231
240
  const emptyKeyPackagesUsers = [];
232
241
  const keyPackagesSettledResult = await Promise.allSettled(qualifiedUsers.map(async ({ id, domain, skipOwnClientId }) => {
233
242
  try {
234
- const keys = await this.apiClient.api.client.claimMLSKeyPackages(id, domain, (0, numberToHex_1.numberToHex)(this.config.cipherSuite), skipOwnClientId);
243
+ const keys = await this.apiClient.api.client.claimMLSKeyPackages(id, domain, (0, numberToHex_1.numberToHex)(this.config.defaultCiphersuite), skipOwnClientId);
235
244
  const isSelfUser = this.apiClient.userId === id && this.apiClient.domain === domain;
236
245
  // It's possible that user's backend is reachable but they have not uploaded their MLS key packages (or all of them have been claimed already)
237
246
  // We don't care about the self user here.
@@ -384,7 +393,7 @@ class MLSService extends commons_1.TypedEventEmitter {
384
393
  }
385
394
  const configuration = {
386
395
  externalSenders,
387
- ciphersuite: this.config.cipherSuite,
396
+ ciphersuite: this.config.defaultCiphersuite,
388
397
  };
389
398
  const credentialType = await this.getCredentialType();
390
399
  return this.coreCryptoClient.createConversation(groupIdBytes, credentialType, configuration);
@@ -488,11 +497,11 @@ class MLSService extends commons_1.TypedEventEmitter {
488
497
  }
489
498
  async clientValidKeypackagesCount() {
490
499
  const credentialType = await this.getCredentialType();
491
- return this.coreCryptoClient.clientValidKeypackagesCount(this.config.cipherSuite, credentialType);
500
+ return this.coreCryptoClient.clientValidKeypackagesCount(this.config.defaultCiphersuite, credentialType);
492
501
  }
493
502
  async clientKeypackages(amountRequested) {
494
503
  const credentialType = await this.getCredentialType();
495
- return this.coreCryptoClient.clientKeypackages(this.config.cipherSuite, credentialType, amountRequested);
504
+ return this.coreCryptoClient.clientKeypackages(this.config.defaultCiphersuite, credentialType, amountRequested);
496
505
  }
497
506
  /**
498
507
  * Will send an empty commit into a group (renew key material)
@@ -572,21 +581,21 @@ class MLSService extends commons_1.TypedEventEmitter {
572
581
  */
573
582
  async verifyLocalMLSKeyPackagesAmount(clientId) {
574
583
  const keyPackagesCount = await this.clientValidKeypackagesCount();
575
- if (keyPackagesCount <= this.config.minRequiredNumberOfAvailableKeyPackages) {
584
+ if (keyPackagesCount <= this.minRequiredKeyPackages) {
576
585
  return this.verifyRemoteMLSKeyPackagesAmount(clientId);
577
586
  }
578
587
  }
579
588
  async verifyRemoteMLSKeyPackagesAmount(clientId) {
580
589
  const backendKeyPackagesCount = await this.getRemoteMLSKeyPackageCount(clientId);
581
590
  // If we have enough keys uploaded on backend, there's no need to upload more.
582
- if (backendKeyPackagesCount > this.config.minRequiredNumberOfAvailableKeyPackages) {
591
+ if (backendKeyPackagesCount > this.minRequiredKeyPackages) {
583
592
  return;
584
593
  }
585
594
  const keyPackages = await this.clientKeypackages(this.config.nbKeyPackages);
586
595
  return this.uploadMLSKeyPackages(clientId, keyPackages);
587
596
  }
588
597
  async getRemoteMLSKeyPackageCount(clientId) {
589
- return this.apiClient.api.client.getMLSKeyPackageCount(clientId, (0, numberToHex_1.numberToHex)(this.config.cipherSuite));
598
+ return this.apiClient.api.client.getMLSKeyPackageCount(clientId, (0, numberToHex_1.numberToHex)(this.config.defaultCiphersuite));
590
599
  }
591
600
  /**
592
601
  * Will update the given client on backend with its public key.
@@ -597,7 +606,7 @@ class MLSService extends commons_1.TypedEventEmitter {
597
606
  async uploadMLSPublicKeys(client) {
598
607
  // If we've already updated a client with its public key, there's no need to do it again.
599
608
  const credentialType = await this.getCredentialType();
600
- const publicKey = await this.coreCryptoClient.clientPublicKey(this.config.cipherSuite, credentialType);
609
+ const publicKey = await this.coreCryptoClient.clientPublicKey(this.config.defaultCiphersuite, credentialType);
601
610
  return this.apiClient.api.client.putClient(client.id, {
602
611
  mls_public_keys: { ed25519: btoa(bazinga64_1.Converter.arrayBufferViewToBaselineString(publicKey)) },
603
612
  });
@@ -747,12 +756,12 @@ class MLSService extends commons_1.TypedEventEmitter {
747
756
  * @returns AcmeChallenge if the user is not authenticated, true if the user is authenticated
748
757
  */
749
758
  async enrollE2EI(discoveryUrl, user, client, nbPrekeys, certificateTtl, getOAuthToken) {
750
- const isCertificateRenewal = await this.coreCryptoClient.e2eiIsEnabled(this.config.cipherSuite);
759
+ const isCertificateRenewal = await this.coreCryptoClient.e2eiIsEnabled(this.config.defaultCiphersuite);
751
760
  const e2eiServiceInternal = new E2EIServiceInternal_1.E2EIServiceInternal(this.coreDatabase, this.coreCryptoClient, this.apiClient, certificateTtl, nbPrekeys, { user, clientId: client.id, discoveryUrl });
752
761
  const rotateBundle = await e2eiServiceInternal.generateCertificate(getOAuthToken, isCertificateRenewal);
753
762
  this.dispatchNewCrlDistributionPoints(rotateBundle);
754
763
  // upload the clients public keys
755
- if (!(0, Helper_1.isMLSDevice)(client)) {
764
+ if (!this.isInitializedMLSClient(client)) {
756
765
  // we only upload public keys for the initial certification process if the device is not already a registered MLS device.
757
766
  await this.uploadMLSPublicKeys(client);
758
767
  }
@@ -23,6 +23,7 @@ const event_1 = require("@wireapp/api-client/lib/event");
23
23
  const http_1 = require("@wireapp/api-client/lib/http");
24
24
  const crypto_1 = require("crypto");
25
25
  const api_client_1 = require("@wireapp/api-client");
26
+ const core_crypto_1 = require("@wireapp/core-crypto");
26
27
  const CoreCryptoMLSError_1 = require("./CoreCryptoMLSError");
27
28
  const MLSService_1 = require("./MLSService");
28
29
  const conversation_1 = require("../../../conversation");
@@ -33,6 +34,10 @@ jest.createMockFromModule('@wireapp/api-client');
33
34
  function createUserId() {
34
35
  return { id: (0, crypto_1.randomUUID)(), domain: '' };
35
36
  }
37
+ const defaultMLSInitConfig = {
38
+ ciphersuites: [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519],
39
+ defaultCiphersuite: core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519,
40
+ };
36
41
  const createMLSService = async () => {
37
42
  const apiClient = new api_client_1.APIClient();
38
43
  const mockCoreCrypto = {
@@ -61,7 +66,8 @@ const createMLSService = async () => {
61
66
  await mockedDb.put('recurringTasks', { key, firingDate: timestamp }, key);
62
67
  },
63
68
  });
64
- const mlsService = new MLSService_1.MLSService(apiClient, mockCoreCrypto, mockedDb, recurringTaskScheduler, {});
69
+ const mlsService = new MLSService_1.MLSService(apiClient, mockCoreCrypto, mockedDb, recurringTaskScheduler);
70
+ mlsService['_config'] = Object.assign(Object.assign({}, defaultMLSInitConfig), { nbKeyPackages: 100, keyingMaterialUpdateThreshold: 1 });
65
71
  return [mlsService, { apiClient, coreCrypto: mockCoreCrypto, recurringTaskScheduler }];
66
72
  };
67
73
  describe('MLSService', () => {
@@ -198,6 +204,56 @@ describe('MLSService', () => {
198
204
  expect(isEstablshed).toBe(true);
199
205
  });
200
206
  });
207
+ describe('isInitializedMLSClient', () => {
208
+ it.each([
209
+ [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519],
210
+ [core_crypto_1.Ciphersuite.MLS_128_DHKEMP256_AES128GCM_SHA256_P256],
211
+ [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519],
212
+ [core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448],
213
+ [core_crypto_1.Ciphersuite.MLS_256_DHKEMP521_AES256GCM_SHA512_P521],
214
+ [core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448],
215
+ [core_crypto_1.Ciphersuite.MLS_256_DHKEMP384_AES256GCM_SHA384_P384],
216
+ [core_crypto_1.Ciphersuite.MLS_128_X25519KYBER768DRAFT00_AES128GCM_SHA256_Ed25519],
217
+ ])('always return false for empty mls_public_keys (%d)', async (ciphersuite) => {
218
+ const [mlsService] = await createMLSService();
219
+ const mockClient = { mls_public_keys: {} };
220
+ mlsService['_config'] = Object.assign(Object.assign({}, defaultMLSInitConfig), { defaultCiphersuite: ciphersuite, nbKeyPackages: 100, keyingMaterialUpdateThreshold: 1 });
221
+ const isInitialized = mlsService.isInitializedMLSClient(mockClient);
222
+ expect(isInitialized).toBe(false);
223
+ });
224
+ it.each([
225
+ [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519, 'ed25519'],
226
+ [core_crypto_1.Ciphersuite.MLS_128_DHKEMP256_AES128GCM_SHA256_P256, 'p256'],
227
+ [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519, 'ed25519'],
228
+ [core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448, 'ed448'],
229
+ [core_crypto_1.Ciphersuite.MLS_256_DHKEMP521_AES256GCM_SHA512_P521, 'p521'],
230
+ [core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448, 'ed448'],
231
+ [core_crypto_1.Ciphersuite.MLS_256_DHKEMP384_AES256GCM_SHA384_P384, 'p384'],
232
+ [core_crypto_1.Ciphersuite.MLS_128_X25519KYBER768DRAFT00_AES128GCM_SHA256_Ed25519, 'ed25519'],
233
+ ])('returns true if there is a signature corresponding to the ciphersuite used (%d, %s)', async (ciphersuite, signatureAlgo) => {
234
+ const [mlsService] = await createMLSService();
235
+ const mockClient = { mls_public_keys: { [signatureAlgo]: 'signature' } };
236
+ mlsService['_config'] = Object.assign(Object.assign({}, defaultMLSInitConfig), { defaultCiphersuite: ciphersuite, nbKeyPackages: 100, keyingMaterialUpdateThreshold: 1 });
237
+ const isInitialized = mlsService.isInitializedMLSClient(mockClient);
238
+ expect(isInitialized).toBe(true);
239
+ });
240
+ it.each([
241
+ [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519, 'p256'],
242
+ [core_crypto_1.Ciphersuite.MLS_128_DHKEMP256_AES128GCM_SHA256_P256, 'ed25519'],
243
+ [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519, 'p256'],
244
+ [core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448, 'p384'],
245
+ [core_crypto_1.Ciphersuite.MLS_256_DHKEMP521_AES256GCM_SHA512_P521, 'ed448'],
246
+ [core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448, 'p256'],
247
+ [core_crypto_1.Ciphersuite.MLS_256_DHKEMP384_AES256GCM_SHA384_P384, 'p256'],
248
+ [core_crypto_1.Ciphersuite.MLS_128_X25519KYBER768DRAFT00_AES128GCM_SHA256_Ed25519, 'p384'],
249
+ ])('returns false if there is a signature not corresponding to the ciphersuite used (%d, %s)', async (ciphersuite, signatureAlgo) => {
250
+ const [mlsService] = await createMLSService();
251
+ const mockClient = { mls_public_keys: { [signatureAlgo]: 'signature' } };
252
+ mlsService['_config'] = Object.assign(Object.assign({}, defaultMLSInitConfig), { defaultCiphersuite: ciphersuite, nbKeyPackages: 100, keyingMaterialUpdateThreshold: 1 });
253
+ const isInitialized = mlsService.isInitializedMLSClient(mockClient);
254
+ expect(isInitialized).toBe(false);
255
+ });
256
+ });
201
257
  describe('initClient', () => {
202
258
  it('uploads public key only if it was not yet defined on client entity', async () => {
203
259
  const [mlsService, { apiClient, coreCrypto }] = await createMLSService();
@@ -209,7 +265,7 @@ describe('MLSService', () => {
209
265
  jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValueOnce(mockedClientPublicKey);
210
266
  jest.spyOn(apiClient.api.client, 'putClient').mockResolvedValueOnce(undefined);
211
267
  jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
212
- await mlsService.initClient(mockUserId, mockClient);
268
+ await mlsService.initClient(mockUserId, mockClient, defaultMLSInitConfig);
213
269
  expect(coreCrypto.mlsInit).toHaveBeenCalled();
214
270
  expect(apiClient.api.client.putClient).toHaveBeenCalledWith(mockClientId, expect.anything());
215
271
  });
@@ -223,9 +279,9 @@ describe('MLSService', () => {
223
279
  jest.spyOn(coreCrypto, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
224
280
  jest
225
281
  .spyOn(apiClient.api.client, 'getMLSKeyPackageCount')
226
- .mockResolvedValueOnce(mlsService.config.minRequiredNumberOfAvailableKeyPackages - 1);
282
+ .mockResolvedValueOnce(mlsService['minRequiredKeyPackages'] - 1);
227
283
  jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
228
- await mlsService.initClient(mockUserId, mockClient);
284
+ await mlsService.initClient(mockUserId, mockClient, defaultMLSInitConfig);
229
285
  expect(coreCrypto.mlsInit).toHaveBeenCalled();
230
286
  expect(apiClient.api.client.uploadMLSKeyPackages).toHaveBeenCalledWith(mockClientId, expect.anything());
231
287
  });
@@ -239,7 +295,7 @@ describe('MLSService', () => {
239
295
  jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
240
296
  jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages');
241
297
  jest.spyOn(apiClient.api.client, 'putClient');
242
- await mlsService.initClient(mockUserId, mockClient);
298
+ await mlsService.initClient(mockUserId, mockClient, defaultMLSInitConfig);
243
299
  expect(coreCrypto.mlsInit).toHaveBeenCalled();
244
300
  expect(apiClient.api.client.uploadMLSKeyPackages).not.toHaveBeenCalled();
245
301
  expect(apiClient.api.client.putClient).not.toHaveBeenCalled();
@@ -365,7 +421,7 @@ describe('MLSService', () => {
365
421
  apiClient.context = { clientType: client_1.ClientType.PERMANENT, clientId: mockClientId, userId: '' };
366
422
  const mockedClientKeyPackages = [new Uint8Array()];
367
423
  jest.spyOn(coreCrypto, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
368
- const numberOfKeysBelowThreshold = mlsService.config.minRequiredNumberOfAvailableKeyPackages - 1;
424
+ const numberOfKeysBelowThreshold = mlsService['minRequiredKeyPackages'] - 1;
369
425
  jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(numberOfKeysBelowThreshold);
370
426
  jest.spyOn(coreCrypto, 'clientValidKeypackagesCount').mockResolvedValueOnce(numberOfKeysBelowThreshold);
371
427
  jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
@@ -391,7 +447,7 @@ describe('MLSService', () => {
391
447
  apiClient.context = { clientType: client_1.ClientType.PERMANENT, clientId: mockClientId, userId: '' };
392
448
  const mockedClientKeyPackages = [new Uint8Array()];
393
449
  jest.spyOn(coreCrypto, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
394
- const numberOfKeysAboveThreshold = mlsService.config.minRequiredNumberOfAvailableKeyPackages + 1;
450
+ const numberOfKeysAboveThreshold = mlsService['minRequiredKeyPackages'] + 1;
395
451
  jest.spyOn(coreCrypto, 'clientValidKeypackagesCount').mockResolvedValueOnce(numberOfKeysAboveThreshold);
396
452
  jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(numberOfKeysAboveThreshold);
397
453
  jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
@@ -417,8 +473,8 @@ describe('MLSService', () => {
417
473
  apiClient.context = { clientType: client_1.ClientType.PERMANENT, clientId: mockClientId, userId: '' };
418
474
  const mockedClientKeyPackages = [new Uint8Array()];
419
475
  jest.spyOn(coreCrypto, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
420
- const numberOfKeysBelowThreshold = mlsService.config.minRequiredNumberOfAvailableKeyPackages - 1;
421
- const numberOfKeysAboveThreshold = mlsService.config.minRequiredNumberOfAvailableKeyPackages + 1;
476
+ const numberOfKeysBelowThreshold = mlsService['minRequiredKeyPackages'] - 1;
477
+ const numberOfKeysAboveThreshold = mlsService['minRequiredKeyPackages'] + 1;
422
478
  jest.spyOn(coreCrypto, 'clientValidKeypackagesCount').mockResolvedValueOnce(numberOfKeysBelowThreshold);
423
479
  jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(numberOfKeysAboveThreshold);
424
480
  jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
@@ -1,4 +1,4 @@
1
- import type { Ciphersuite, CommitBundle } from '@wireapp/core-crypto';
1
+ import type { CommitBundle } from '@wireapp/core-crypto';
2
2
  export interface UploadCommitOptions {
3
3
  /**
4
4
  * If uploading the commit fails and we endup in a scenario where a retrial is possible, then this callback will be called to re-generate a new commit bundle
@@ -9,20 +9,6 @@ export interface UploadCommitOptions {
9
9
  */
10
10
  isExternalCommit?: boolean;
11
11
  }
12
- export interface MLSServiceConfig {
13
- /**
14
- * (milliseconds) period of time between automatic updates of the keying material (30 days by default)
15
- */
16
- keyingMaterialUpdateThreshold: number;
17
- /**
18
- * number of key packages client should upload to the server (100 by default)
19
- */
20
- nbKeyPackages: number;
21
- /**
22
- * default ciphersuite to use for MLS (MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 = 1 by default)
23
- */
24
- cipherSuite: Ciphersuite;
25
- }
26
12
  export type NewCrlDistributionPointsPayload = {
27
13
  crlNewDistributionPoints?: string[] | undefined;
28
14
  };
@@ -1 +1 @@
1
- {"version":3,"file":"MLSService.types.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.types.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,WAAW,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAEpE,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC;IAErD;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,6BAA6B,EAAE,MAAM,CAAC;IACtC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,MAAM,+BAA+B,GAAG;IAAC,wBAAwB,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;CAAC,CAAC"}
1
+ {"version":3,"file":"MLSService.types.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.types.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC;IAErD;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,MAAM,+BAA+B,GAAG;IAAC,wBAAwB,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;CAAC,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { QualifiedId } from '@wireapp/api-client/lib/user';
2
- import { MLSServiceConfig } from './MLSService/MLSService.types';
3
2
  export type ClientId = string;
4
3
  export type SecretCrypto = {
5
4
  encrypt: (value: Uint8Array) => Promise<Uint8Array>;
@@ -28,7 +27,5 @@ export interface CoreCryptoConfig {
28
27
  * It, thus, needs to know where, on the server, the file can be found
29
28
  */
30
29
  wasmFilePath: string;
31
- /** If set will create an MLS capable device from the current device */
32
- mls?: Partial<MLSServiceConfig>;
33
30
  }
34
31
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/messagingProtocols/mls/types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAE/D,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACpD,OAAO,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACvD,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,yBAAyB,EAAE,CAAC,cAAc,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACzF;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,SAAS,CAAC;AAEd,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB,uEAAuE;IACvE,GAAG,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACjC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/messagingProtocols/mls/types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACpD,OAAO,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACvD,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,yBAAyB,EAAE,CAAC,cAAc,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACzF;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,SAAS,CAAC;AAEd,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB"}
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": "^26.14.1",
14
+ "@wireapp/api-client": "^27.0.0",
15
15
  "@wireapp/commons": "^5.2.7",
16
- "@wireapp/core-crypto": "1.0.0-rc.55",
16
+ "@wireapp/core-crypto": "1.0.0-rc.56",
17
17
  "@wireapp/cryptobox": "12.8.0",
18
18
  "@wireapp/priority-queue": "^2.1.5",
19
19
  "@wireapp/promise-queue": "^2.3.2",
@@ -61,6 +61,6 @@
61
61
  "test:coverage": "jest --coverage",
62
62
  "watch": "tsc --watch"
63
63
  },
64
- "version": "45.3.7",
65
- "gitHead": "c94175a33db40c02c0f821120b946e97aae87ab3"
64
+ "version": "46.0.0",
65
+ "gitHead": "aa538cb7b45fddbd8cf8f1b8e28af71c0d1c948a"
66
66
  }