From 7fa97d452bc1419554f6888b7aedae2597e48a86 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Thu, 10 Oct 2024 10:52:22 +0200 Subject: [PATCH] Remove remaining old dehydration --- src/Lifecycle.ts | 37 ------------------- src/SecurityManager.ts | 7 ---- src/components/structures/auth/SoftLogout.tsx | 4 +- 3 files changed, 2 insertions(+), 46 deletions(-) diff --git a/src/Lifecycle.ts b/src/Lifecycle.ts index 130c0b5315..39d93dec11 100644 --- a/src/Lifecycle.ts +++ b/src/Lifecycle.ts @@ -664,43 +664,6 @@ export async function setLoggedIn(credentials: IMatrixClientCreds): Promise { - const oldUserId = MatrixClientPeg.safeGet().getUserId(); - const oldDeviceId = MatrixClientPeg.safeGet().getDeviceId(); - - stopMatrixClient(); // unsets MatrixClientPeg.get() - localStorage.removeItem("mx_soft_logout"); - _isLoggingOut = false; - - const overwrite = credentials.userId !== oldUserId || credentials.deviceId !== oldDeviceId; - if (overwrite) { - logger.warn("Clearing all data: Old session belongs to a different user/session"); - } - - if (!credentials.pickleKey && credentials.deviceId !== undefined) { - logger.info("Lifecycle#hydrateSession: Pickle key not provided - trying to get one"); - credentials.pickleKey = - (await PlatformPeg.get()?.getPickleKey(credentials.userId, credentials.deviceId)) ?? undefined; - } - - return doSetLoggedIn(credentials, overwrite, false); -} - /** * When we have a authenticated via OIDC-native flow and have a refresh token * try to create a token refresher. diff --git a/src/SecurityManager.ts b/src/SecurityManager.ts index 510bf62200..1ea3e888f2 100644 --- a/src/SecurityManager.ts +++ b/src/SecurityManager.ts @@ -275,13 +275,6 @@ async function doAccessSecretStorage(func: () => Promise, forceReset: bool }); logger.debug("accessSecretStorage: bootstrapSecretStorage"); await crypto.bootstrapSecretStorage({}); - - const keyId = Object.keys(secretStorageKeys)[0]; - if (!keyId) { - logger.warn("accessSecretStorage: Not setting dehydration key: no SSSS key found"); - } else { - logger.log("accessSecretStorage: Not setting dehydration key: feature disabled"); - } } logger.debug("accessSecretStorage: 4S now ready"); diff --git a/src/components/structures/auth/SoftLogout.tsx b/src/components/structures/auth/SoftLogout.tsx index 4c02f818a7..117485df7e 100644 --- a/src/components/structures/auth/SoftLogout.tsx +++ b/src/components/structures/auth/SoftLogout.tsx @@ -168,7 +168,7 @@ export default class SoftLogout extends React.Component { return; } - Lifecycle.hydrateSession(credentials).catch((e) => { + Lifecycle.setLoggedIn(credentials).catch((e) => { logger.error(e); this.setState({ busy: false, errorText: _t("auth|failed_soft_logout_auth") }); }); @@ -204,7 +204,7 @@ export default class SoftLogout extends React.Component { return false; } - return Lifecycle.hydrateSession(credentials) + return Lifecycle.setLoggedIn(credentials) .then(() => { if (this.props.onTokenLoginCompleted) { this.props.onTokenLoginCompleted();