Add security customisation points

This adds various customisations point in the app for security related
decisions. By default, these do nothing, but would be customised at the
app level via module replacement (so that no changes are needed here in the
SDK).

Fixes https://github.com/vector-im/element-web/issues/15350
This commit is contained in:
J. Ryan Stinnett 2020-10-08 16:35:17 +01:00
parent e3155fe58f
commit 388cb0e2c1
6 changed files with 134 additions and 5 deletions

View file

@ -22,6 +22,7 @@ import SetupEncryptionDialog from "../components/views/dialogs/security/SetupEnc
import { accessSecretStorage } from "../SecurityManager";
import ToastStore from "../stores/ToastStore";
import GenericToast from "../components/views/toasts/GenericToast";
import SecurityCustomisations from "../customisations/Security";
const TOAST_KEY = "setupencryption";
@ -78,6 +79,10 @@ const onReject = () => {
};
export const showToast = (kind: Kind) => {
if (SecurityCustomisations.setupEncryptionNeeded?.(kind)) {
return;
}
const onAccept = async () => {
if (kind === Kind.VERIFY_THIS_SESSION) {
Modal.createTrackedDialog("Verify session", "Verify session", SetupEncryptionDialog,