@@ -664,43 +664,6 @@ export async function setLoggedIn(credentials: IMatrixClientCreds): Promise<Matr
664
664
return doSetLoggedIn ( Object . assign ( { } , credentials , { pickleKey } ) , true , true ) ;
665
665
}
666
666
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
-
704
667
/**
705
668
* When we have a authenticated via OIDC-native flow and have a refresh token
706
669
* try to create a token refresher.
0 commit comments