Enforce Secure Backup completion when requested by HS

This removes all buttons to escape the Secure Backup setup flow when the
matching `.well-known` setting is set by homeserver.

Part of https://github.com/vector-im/element-web/issues/14954
This commit is contained in:
J. Ryan Stinnett 2020-08-14 18:06:35 +01:00
parent 941cbc47c8
commit 1932505d3b
3 changed files with 23 additions and 5 deletions

View file

@ -21,6 +21,7 @@ import { deriveKey } from 'matrix-js-sdk/src/crypto/key_passphrase';
import { decodeRecoveryKey } from 'matrix-js-sdk/src/crypto/recoverykey';
import { _t } from './languageHandler';
import {encodeBase64} from "matrix-js-sdk/src/crypto/olmlib";
import { isSecureBackupRequired } from './utils/WellKnownUtils';
// This stores the secret storage private keys in memory for the JS SDK. This is
// only meant to act as a cache to avoid prompting the user multiple times
@ -208,7 +209,18 @@ export async function accessSecretStorage(func = async () => { }, forceReset = f
{
force: forceReset,
},
null, /* priority = */ false, /* static = */ true,
null,
/* priority = */ false,
/* static = */ true,
/* options = */ {
onBeforeClose(reason) {
// If Secure Backup is required, you cannot leave the modal.
if (reason === "backgroundClick") {
return !isSecureBackupRequired();
}
return true;
},
},
);
const [confirmed] = await finished;
if (!confirmed) {