Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

Commit 7fa97d4

Browse files
committed
Remove remaining old dehydration
1 parent d98a7f5 commit 7fa97d4

File tree

3 files changed

+2
-46
lines changed

3 files changed

+2
-46
lines changed

Diff for: src/Lifecycle.ts

-37
Original file line numberDiff line numberDiff line change
@@ -664,43 +664,6 @@ export async function setLoggedIn(credentials: IMatrixClientCreds): Promise<Matr
664664
return doSetLoggedIn(Object.assign({}, credentials, { pickleKey }), true, true);
665665
}
666666

667-
/**
668-
* Hydrates an existing session by using the credentials provided. This will
669-
* not clear any local storage, unlike setLoggedIn().
670-
*
671-
* Stops the existing Matrix client (without clearing its data) and starts a
672-
* new one in its place. This additionally starts all other react-sdk services
673-
* which use the new Matrix client.
674-
*
675-
* If the credentials belong to a different user from the session already stored,
676-
* the old session will be cleared automatically.
677-
*
678-
* @param {IMatrixClientCreds} credentials The credentials to use
679-
*
680-
* @returns {Promise} promise which resolves to the new MatrixClient once it has been started
681-
*/
682-
export async function hydrateSession(credentials: IMatrixClientCreds): Promise<MatrixClient> {
683-
const oldUserId = MatrixClientPeg.safeGet().getUserId();
684-
const oldDeviceId = MatrixClientPeg.safeGet().getDeviceId();
685-
686-
stopMatrixClient(); // unsets MatrixClientPeg.get()
687-
localStorage.removeItem("mx_soft_logout");
688-
_isLoggingOut = false;
689-
690-
const overwrite = credentials.userId !== oldUserId || credentials.deviceId !== oldDeviceId;
691-
if (overwrite) {
692-
logger.warn("Clearing all data: Old session belongs to a different user/session");
693-
}
694-
695-
if (!credentials.pickleKey && credentials.deviceId !== undefined) {
696-
logger.info("Lifecycle#hydrateSession: Pickle key not provided - trying to get one");
697-
credentials.pickleKey =
698-
(await PlatformPeg.get()?.getPickleKey(credentials.userId, credentials.deviceId)) ?? undefined;
699-
}
700-
701-
return doSetLoggedIn(credentials, overwrite, false);
702-
}
703-
704667
/**
705668
* When we have a authenticated via OIDC-native flow and have a refresh token
706669
* try to create a token refresher.

Diff for: src/SecurityManager.ts

-7
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,6 @@ async function doAccessSecretStorage(func: () => Promise<void>, forceReset: bool
275275
});
276276
logger.debug("accessSecretStorage: bootstrapSecretStorage");
277277
await crypto.bootstrapSecretStorage({});
278-
279-
const keyId = Object.keys(secretStorageKeys)[0];
280-
if (!keyId) {
281-
logger.warn("accessSecretStorage: Not setting dehydration key: no SSSS key found");
282-
} else {
283-
logger.log("accessSecretStorage: Not setting dehydration key: feature disabled");
284-
}
285278
}
286279

287280
logger.debug("accessSecretStorage: 4S now ready");

Diff for: src/components/structures/auth/SoftLogout.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export default class SoftLogout extends React.Component<IProps, IState> {
168168
return;
169169
}
170170

171-
Lifecycle.hydrateSession(credentials).catch((e) => {
171+
Lifecycle.setLoggedIn(credentials).catch((e) => {
172172
logger.error(e);
173173
this.setState({ busy: false, errorText: _t("auth|failed_soft_logout_auth") });
174174
});
@@ -204,7 +204,7 @@ export default class SoftLogout extends React.Component<IProps, IState> {
204204
return false;
205205
}
206206

207-
return Lifecycle.hydrateSession(credentials)
207+
return Lifecycle.setLoggedIn(credentials)
208208
.then(() => {
209209
if (this.props.onTokenLoginCompleted) {
210210
this.props.onTokenLoginCompleted();

0 commit comments

Comments
 (0)