From 5dd5668389c564800d892c0736517d9a0cc1dfcd Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 4 Jul 2022 20:10:13 +0100 Subject: [PATCH] Add config param to disable e2e for signalling --- src/matrix-utils.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/matrix-utils.ts b/src/matrix-utils.ts index b76e913..0a3a3be 100644 --- a/src/matrix-utils.ts +++ b/src/matrix-utils.ts @@ -14,6 +14,7 @@ import { GroupCallType, } from "matrix-js-sdk/src/webrtc/groupCall"; import { ISyncStateData, SyncState } from "matrix-js-sdk/src/sync"; +import { logger } from "matrix-js-sdk/src/logger"; import IndexedDBWorker from "./IndexedDBWorker?worker"; @@ -79,6 +80,19 @@ export async function initClient( storeOpts.cryptoStore = new MemoryCryptoStore(); } + // XXX: we read from the URL search params in RoomPage too: + // it would be much better to read them in one place and pass + // the values around, but we initialise the matrix client in + // many different places so we'd have to pass it into all of + // them. + const params = new URLSearchParams(window.location.search); + // disable e2e only if enableE2e=false is given + const enableE2e = !(params.get("enableE2e") === "false"); + + if (!enableE2e) { + logger.info("Disabling E2E: group call signalling will NOT be encrypted."); + } + const client = createClient({ ...storeOpts, ...clientOptions, @@ -86,6 +100,7 @@ export async function initClient( // Use a relatively low timeout for API calls: this is a realtime application // so we don't want API calls taking ages, we'd rather they just fail. localTimeoutMs: 5000, + useE2eForGroupCall: enableE2e, }); try {