From 50cccd3212b384d3b26460544f2e8e54651f259f Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Fri, 15 Nov 2019 10:57:20 +0000 Subject: [PATCH 1/2] Add cross-signing feature flag Fixes https://github.com/vector-im/riot-web/issues/11407 --- src/MatrixClientPeg.js | 10 ++++++++++ src/i18n/strings/en_EN.json | 1 + src/settings/Settings.js | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/src/MatrixClientPeg.js b/src/MatrixClientPeg.js index bebb254afc..ef0130ec15 100644 --- a/src/MatrixClientPeg.js +++ b/src/MatrixClientPeg.js @@ -220,6 +220,16 @@ class MatrixClientPeg { identityServer: new IdentityAuthClient(), }; + if (SettingsStore.isFeatureEnabled("feature_cross_signing")) { + // TODO: Cross-signing keys are temporarily in memory only. A + // separate task in the cross-signing project will build from here. + const keys = []; + opts.cryptoCallbacks = { + getCrossSigningKey: k => keys[k], + saveCrossSigningKeys: newKeys => Object.assign(keys, newKeys), + }; + } + this.matrixClient = createMatrixClient(opts); // we're going to add eventlisteners for each matrix event tile, so the diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index dc9773ad21..8469f62d5c 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -342,6 +342,7 @@ "Use the new, consistent UserInfo panel for Room Members and Group Members": "Use the new, consistent UserInfo panel for Room Members and Group Members", "Try out new ways to ignore people (experimental)": "Try out new ways to ignore people (experimental)", "Send verification requests in direct message": "Send verification requests in direct message", + "Enable cross-signing to verify per-user instead of per-device": "Enable cross-signing to verify per-user instead of per-device", "Use the new, faster, composer for writing messages": "Use the new, faster, composer for writing messages", "Enable Emoji suggestions while typing": "Enable Emoji suggestions while typing", "Use compact timeline layout": "Use compact timeline layout", diff --git a/src/settings/Settings.js b/src/settings/Settings.js index 973d389ba6..c63217775a 100644 --- a/src/settings/Settings.js +++ b/src/settings/Settings.js @@ -146,6 +146,12 @@ export const SETTINGS = { supportedLevels: LEVELS_FEATURE, default: false, }, + "feature_cross_signing": { + isFeature: true, + displayName: _td("Enable cross-signing to verify per-user instead of per-device"), + supportedLevels: LEVELS_FEATURE, + default: false, + }, "useCiderComposer": { displayName: _td("Use the new, faster, composer for writing messages"), supportedLevels: LEVELS_ACCOUNT_SETTINGS, From b8c0a0fe7238675dc818d152e0e63720a0a04bf6 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Fri, 15 Nov 2019 11:31:19 +0000 Subject: [PATCH 2/2] Reload automatically when changing cross-signing flag --- src/settings/Settings.js | 5 +++-- ...LowBandwidthController.js => ReloadOnChangeController.js} | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) rename src/settings/controllers/{LowBandwidthController.js => ReloadOnChangeController.js} (91%) diff --git a/src/settings/Settings.js b/src/settings/Settings.js index c63217775a..89bca043bd 100644 --- a/src/settings/Settings.js +++ b/src/settings/Settings.js @@ -23,7 +23,7 @@ import { } from "./controllers/NotificationControllers"; import CustomStatusController from "./controllers/CustomStatusController"; import ThemeController from './controllers/ThemeController'; -import LowBandwidthController from "./controllers/LowBandwidthController"; +import ReloadOnChangeController from "./controllers/ReloadOnChangeController"; // These are just a bunch of helper arrays to avoid copy/pasting a bunch of times const LEVELS_ROOM_SETTINGS = ['device', 'room-device', 'room-account', 'account', 'config']; @@ -151,6 +151,7 @@ export const SETTINGS = { displayName: _td("Enable cross-signing to verify per-user instead of per-device"), supportedLevels: LEVELS_FEATURE, default: false, + controller: new ReloadOnChangeController(), }, "useCiderComposer": { displayName: _td("Use the new, faster, composer for writing messages"), @@ -433,7 +434,7 @@ export const SETTINGS = { supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG, displayName: _td('Low bandwidth mode'), default: false, - controller: new LowBandwidthController(), + controller: new ReloadOnChangeController(), }, "fallbackICEServerAllowed": { supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS, diff --git a/src/settings/controllers/LowBandwidthController.js b/src/settings/controllers/ReloadOnChangeController.js similarity index 91% rename from src/settings/controllers/LowBandwidthController.js rename to src/settings/controllers/ReloadOnChangeController.js index c7796a425a..eadaee89ca 100644 --- a/src/settings/controllers/LowBandwidthController.js +++ b/src/settings/controllers/ReloadOnChangeController.js @@ -17,7 +17,7 @@ limitations under the License. import SettingController from "./SettingController"; import PlatformPeg from "../../PlatformPeg"; -export default class LowBandwidthController extends SettingController { +export default class ReloadOnChangeController extends SettingController { onChange(level, roomId, newValue) { PlatformPeg.get().reload(); }