From 5534c0dbe99b88415748ce3d9d105013137cd20a Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Fri, 5 Sep 2025 09:32:17 +0100 Subject: [PATCH] Remove remaining support for outdated .well-known settings (#30702) * Remove remaining support for `secure_backup_setup_methods` option Support for this .well-known setting had been removed everywhere except in a rather obscure corner of the code. There are many other problems with this area (https://github.com/element-hq/element-web/issues/29171) but removing support for the outdated option is an easy step. * Remove remaining `secure_backup_required` setting support Again, this setting was only honoured in the obscure "New Recovery Method" flow. --- src/SecurityManager.ts | 10 ------ .../security/CreateSecretStorageDialog.tsx | 34 +++++-------------- src/utils/WellKnownUtils.ts | 27 --------------- 3 files changed, 8 insertions(+), 63 deletions(-) diff --git a/src/SecurityManager.ts b/src/SecurityManager.ts index ecf895fd79..a5be789c8a 100644 --- a/src/SecurityManager.ts +++ b/src/SecurityManager.ts @@ -14,7 +14,6 @@ import { logger as rootLogger } from "matrix-js-sdk/src/logger"; import Modal from "./Modal"; import { MatrixClientPeg } from "./MatrixClientPeg"; import { _t } from "./languageHandler"; -import { isSecureBackupRequired } from "./utils/WellKnownUtils"; import AccessSecretStorageDialog, { type KeyParams, } from "./components/views/dialogs/security/AccessSecretStorageDialog"; @@ -232,15 +231,6 @@ async function doAccessSecretStorage(func: () => Promise, opts: AccessSecr undefined, /* priority = */ false, /* static = */ true, - /* options = */ { - onBeforeClose: async (reason): Promise => { - // If Secure Backup is required, you cannot leave the modal. - if (reason === "backgroundClick") { - return !isSecureBackupRequired(cli); - } - return true; - }, - }, ); const [confirmed] = await finished; if (!confirmed) { diff --git a/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx b/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx index 4ed369fb13..ed2fbe87a5 100644 --- a/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx +++ b/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx @@ -25,11 +25,6 @@ import StyledRadioButton from "../../../../components/views/elements/StyledRadio import AccessibleButton from "../../../../components/views/elements/AccessibleButton"; import DialogButtons from "../../../../components/views/elements/DialogButtons"; import InlineSpinner from "../../../../components/views/elements/InlineSpinner"; -import { - getSecureBackupSetupMethods, - isSecureBackupRequired, - SecureBackupSetupMethod, -} from "../../../../utils/WellKnownUtils"; import { ModuleRunner } from "../../../../modules/ModuleRunner"; import type Field from "../../../../components/views/elements/Field"; import BaseDialog from "../../../../components/views/dialogs/BaseDialog"; @@ -39,6 +34,11 @@ import { type IValidationResult } from "../../../../components/views/elements/Va import PassphraseConfirmField from "../../../../components/views/auth/PassphraseConfirmField"; import { initialiseDehydrationIfEnabled } from "../../../../utils/device/dehydration"; +enum SecureBackupSetupMethod { + Key = "key", + Passphrase = "passphrase", +} + // I made a mistake while converting this and it has to be fixed! enum Phase { Loading = "loading", @@ -68,7 +68,6 @@ interface IState { downloaded: boolean; setPassphrase: boolean; - canSkip: boolean; passPhraseKeySelected: string; error?: boolean; } @@ -93,16 +92,6 @@ export default class CreateSecretStorageDialog extends React.PureComponent @@ -410,7 +395,6 @@ export default class CreateSecretStorageDialog extends React.PureComponent ); @@ -601,7 +585,6 @@ export default class CreateSecretStorageDialog extends React.PureComponent @@ -672,7 +655,6 @@ export default class CreateSecretStorageDialog extends React.PureComponent diff --git a/src/utils/WellKnownUtils.ts b/src/utils/WellKnownUtils.ts index b2af51e2c3..f1e093b66a 100644 --- a/src/utils/WellKnownUtils.ts +++ b/src/utils/WellKnownUtils.ts @@ -30,8 +30,6 @@ export interface IE2EEWellKnown { * Disables the option to enable encryption in room settings for all new and existing rooms */ force_disable?: boolean; - secure_backup_required?: boolean; - secure_backup_setup_methods?: SecureBackupSetupMethod[]; } export interface ITileServerWellKnown { @@ -74,28 +72,3 @@ export function getEmbeddedPagesWellKnown(matrixClient: MatrixClient | undefined export function embeddedPagesFromWellKnown(clientWellKnown?: IClientWellKnown): IEmbeddedPagesWellKnown { return clientWellKnown?.[EMBEDDED_PAGES_WK_PROPERTY]; } - -export function isSecureBackupRequired(matrixClient: MatrixClient): boolean { - return getE2EEWellKnown(matrixClient)?.["secure_backup_required"] === true; -} - -export enum SecureBackupSetupMethod { - Key = "key", - Passphrase = "passphrase", -} - -export function getSecureBackupSetupMethods(matrixClient: MatrixClient): SecureBackupSetupMethod[] { - const wellKnown = getE2EEWellKnown(matrixClient); - if ( - !wellKnown || - !wellKnown["secure_backup_setup_methods"] || - !wellKnown["secure_backup_setup_methods"].length || - !( - wellKnown["secure_backup_setup_methods"].includes(SecureBackupSetupMethod.Key) || - wellKnown["secure_backup_setup_methods"].includes(SecureBackupSetupMethod.Passphrase) - ) - ) { - return [SecureBackupSetupMethod.Key, SecureBackupSetupMethod.Passphrase]; - } - return wellKnown["secure_backup_setup_methods"]; -}