Skip to content

Commit 98a1140

Browse files
authored
feat: activate mls for client via mls feature config [FS-1088] (#13898)
* feat: always pass mlsconfig object to initialize mlsclient * feat: enable sending external proposals when mls feature flag is off * runfix: add support for broken clients by disabling mls for them * refactor: update var name * chore: bump core to use renamed systemCrypto * chore: use exact version match * chore: update lock file * refactor: rename disabling mls helper boolean * refactor: simplify supportmls logic * runfix: require feature flag to support mls for m4 * runfix: make supportMLS a function * Revert "runfix: make supportMLS a function" This reverts commit 06ba72d. * Revert "runfix: require feature flag to support mls for m4" This reverts commit a32154e. * runfix: add mls feature config var back to supportMLS helper
1 parent 84709a3 commit 98a1140

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/script/main/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {Runtime} from '@wireapp/commons';
3131

3232
import {getLogger, Logger} from 'Util/Logger';
3333
import {t} from 'Util/LocalizerUtil';
34-
import {arrayToBase64, checkIndexedDb, createRandomUuid} from 'Util/util';
34+
import {arrayToBase64, checkIndexedDb, createRandomUuid, supportsMLS} from 'Util/util';
3535
import {TIME_IN_MILLIS} from 'Util/TimeUtil';
3636
import {enableLogging} from 'Util/LoggerUtil';
3737
import {Environment} from 'Util/Environment';
@@ -428,7 +428,7 @@ class App {
428428

429429
const conversationEntities = await conversationRepository.getConversations();
430430

431-
if (Config.getConfig().FEATURE.ENABLE_MLS) {
431+
if (supportsMLS()) {
432432
// We send external proposal to all the MLS conversations that are in an unknown state (not established nor pendingWelcome)
433433
await mlsConversationState.getState().sendExternalToPendingJoin(
434434
conversationEntities,

src/script/service/CoreSingleton.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {ClientType} from '@wireapp/api-client/src/client/';
2222
import {container, singleton} from 'tsyringe';
2323
import {APIClient} from './APIClientSingleton';
2424
import {createStorageEngine, DatabaseTypes} from './StoreEngineProvider';
25-
import {isTemporaryClientAndNonPersistent} from 'Util/util';
25+
import {isTemporaryClientAndNonPersistent, supportsMLS} from 'Util/util';
2626
import {Config} from '../Config';
2727

2828
declare global {
@@ -45,15 +45,15 @@ export class Core extends Account<Uint8Array> {
4545

4646
return createStorageEngine(storeName, dbType);
4747
},
48-
mlsConfig: Config.getConfig().FEATURE.ENABLE_MLS
48+
mlsConfig: supportsMLS()
4949
? {
5050
coreCrypoWasmFilePath: '/min/core-crypto.wasm',
51+
keyingMaterialUpdateThreshold: Config.getConfig().FEATURE.MLS_CONFIG_KEYING_MATERIAL_UPDATE_THRESHOLD,
5152
/*
52-
* When in an electron context, the window.secretsCrypto will be populated by the renderer process.
53+
* When in an electron context, the window.systemCrypto will be populated by the renderer process.
5354
* We then give those crypto primitives to the core that will use them when encrypting MLS secrets.
54-
* When in an browser context, then this secretsCrypto will be undefined and the core will then use it's internal encryption system
55+
* When in a browser context, then this systemCrypto will be undefined and the core will then use it's internal encryption system
5556
*/
56-
keyingMaterialUpdateThreshold: Config.getConfig().FEATURE.MLS_CONFIG_KEYING_MATERIAL_UPDATE_THRESHOLD,
5757
systemCrypto: window.systemCrypto,
5858
}
5959
: undefined,

src/script/util/util.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,3 +398,7 @@ export const getSelectionPosition = (element: HTMLTextAreaElement, currentMentio
398398

399399
return {newEnd, newStart};
400400
};
401+
402+
// temporary hack that disables mls for old 'broken' desktop clients, see https://github.com/wireapp/wire-desktop/pull/6094
403+
export const supportsMLS = () =>
404+
Config.getConfig().FEATURE.ENABLE_MLS && (!Runtime.isDesktopApp() || window.systemCrypto);

0 commit comments

Comments
 (0)