move e2ee-default switch to well-known from config.json

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2020-06-01 22:37:12 +01:00
parent cbc2aee746
commit 3f72a590f5
1 changed files with 9 additions and 3 deletions

View File

@ -23,8 +23,8 @@ import dis from "./dispatcher/dispatcher";
import * as Rooms from "./Rooms";
import DMRoomMap from "./utils/DMRoomMap";
import {getAddressType} from "./UserAddress";
import SettingsStore from "./settings/SettingsStore";
import SdkConfig from "./SdkConfig";
const E2EE_WK_KEY = "im.vector.riot.e2ee";
/**
* Create a new room, and switch to it.
@ -238,5 +238,11 @@ export async function ensureDMExists(client, userId) {
}
export function privateShouldBeEncrypted() {
return SettingsStore.getValue("feature_cross_signing") && SdkConfig.get().e2ee_default_for_private_rooms !== false;
const clientWellKnown = MatrixClientPeg.get().getClientWellKnown();
if (clientWellKnown && clientWellKnown[E2EE_WK_KEY]) {
const defaultDisabled = clientWellKnown[E2EE_WK_KEY]["default"] === false;
return !defaultDisabled;
}
return true;
}