diff --git a/src/MatrixClientPeg.ts b/src/MatrixClientPeg.ts index 81a73ffccc..9682b41800 100644 --- a/src/MatrixClientPeg.ts +++ b/src/MatrixClientPeg.ts @@ -41,7 +41,7 @@ import PlatformPeg from "./PlatformPeg"; import { formatList } from "./utils/FormattingUtils"; import SdkConfig from "./SdkConfig"; import { setDeviceIsolationMode } from "./settings/controllers/DeviceIsolationModeController.ts"; -import { initialiseDehydration } from "./utils/device/dehydration"; +import { initialiseDehydrationIfEnabled } from "./utils/device/dehydration"; export interface IMatrixClientCreds { homeserverUrl: string; @@ -347,7 +347,7 @@ class MatrixClientPegClass implements IMatrixClientPeg { // is a new login, we will start dehydration after Secret Storage is // unlocked. try { - await initialiseDehydration({ onlyIfKeyCached: true, rehydrate: false }, this.matrixClient); + await initialiseDehydrationIfEnabled(this.matrixClient, { onlyIfKeyCached: true, rehydrate: false }); } catch (e) { // We may get an error dehydrating, such as if cross-signing and // SSSS are not set up yet. Just log the error and continue. diff --git a/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx b/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx index 14ad5d3039..daefa267bc 100644 --- a/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx +++ b/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx @@ -37,7 +37,7 @@ import Spinner from "../../../../components/views/elements/Spinner"; import InteractiveAuthDialog from "../../../../components/views/dialogs/InteractiveAuthDialog"; import { type IValidationResult } from "../../../../components/views/elements/Validation"; import PassphraseConfirmField from "../../../../components/views/auth/PassphraseConfirmField"; -import { initialiseDehydration } from "../../../../utils/device/dehydration"; +import { initialiseDehydrationIfEnabled } from "../../../../utils/device/dehydration"; // I made a mistake while converting this and it has to be fixed! enum Phase { @@ -273,7 +273,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent { - client = client || MatrixClientPeg.safeGet(); +export async function initialiseDehydrationIfEnabled( + client: MatrixClient, + opts: StartDehydrationOpts = {}, +): Promise { const crypto = client.getCrypto(); if (await deviceDehydrationEnabled(client, crypto)) { logger.log("Device dehydration enabled");