You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-09 08:42:50 +03:00
Shuttle secrets via credentials and avoid calling doSetLoggedIn twice
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -798,11 +798,7 @@ async function createOidcTokenRefresher(credentials: IMatrixClientCreds): Promis
|
||||
*
|
||||
* @returns {Promise} promise which resolves to the new MatrixClient once it has been started
|
||||
*/
|
||||
async function doSetLoggedIn(
|
||||
credentials: IMatrixClientCreds,
|
||||
clearStorageEnabled: boolean,
|
||||
secrets?: QRSecretsBundle,
|
||||
): Promise<MatrixClient> {
|
||||
async function doSetLoggedIn(credentials: IMatrixClientCreds, clearStorageEnabled: boolean): Promise<MatrixClient> {
|
||||
checkSessionLock();
|
||||
credentials.guest = Boolean(credentials.guest);
|
||||
|
||||
@@ -873,7 +869,7 @@ async function doSetLoggedIn(
|
||||
checkSessionLock();
|
||||
|
||||
dis.fire(Action.OnLoggedIn);
|
||||
await startMatrixClient(client, /*startSyncing=*/ !softLogout, secrets);
|
||||
await startMatrixClient(client, /*startSyncing=*/ !softLogout, credentials.secrets);
|
||||
|
||||
return client;
|
||||
}
|
||||
|
@@ -66,6 +66,7 @@ export interface IMatrixClientCreds {
|
||||
guest?: boolean;
|
||||
pickleKey?: string;
|
||||
freshLogin?: boolean;
|
||||
secrets?: QRSecretsBundle;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -27,7 +27,7 @@ import type { MSC4108SignInWithQR } from "matrix-js-sdk/src/rendezvous";
|
||||
import LoginWithQRFlow from "./LoginWithQRFlow";
|
||||
import { getOidcClientId } from "../../../utils/oidc/registerClient";
|
||||
import SdkConfig from "../../../SdkConfig";
|
||||
import { completeDeviceAuthorizationGrant, completeLoginWithQr } from "../../../Lifecycle";
|
||||
import { completeDeviceAuthorizationGrant } from "../../../Lifecycle";
|
||||
|
||||
/**
|
||||
* The intention of this enum is to have a mode that scans a QR code instead of generating one.
|
||||
@@ -284,10 +284,8 @@ export default class LoginWithQR extends React.Component<IProps, IState> {
|
||||
// wait for secrets:
|
||||
const { secrets } = await rendezvous.loginStep5(credentials.deviceId);
|
||||
|
||||
await completeLoginWithQr(credentials, secrets);
|
||||
|
||||
// done
|
||||
this.props.onFinished(credentials);
|
||||
this.props.onFinished({ ...credentials, secrets });
|
||||
} else {
|
||||
// MSC4108-Flow: ExistingScanned
|
||||
const homeserverBaseUrl = homeserverBaseUrlFromStep1;
|
||||
@@ -354,10 +352,8 @@ export default class LoginWithQR extends React.Component<IProps, IState> {
|
||||
// wait for secrets
|
||||
const { secrets } = await this.state.rendezvous.loginStep5(credentials.deviceId);
|
||||
|
||||
await completeLoginWithQr(credentials, secrets);
|
||||
|
||||
// done
|
||||
this.props.onFinished(credentials);
|
||||
this.props.onFinished({ ...credentials, secrets });
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user