diff --git a/src/components/structures/auth/E2eSetup.tsx b/src/components/structures/auth/E2eSetup.tsx index 80a135fe19f..d2fb046fe77 100644 --- a/src/components/structures/auth/E2eSetup.tsx +++ b/src/components/structures/auth/E2eSetup.tsx @@ -11,7 +11,7 @@ import { MatrixClient } from "matrix-js-sdk/src/matrix"; import AuthPage from "../../views/auth/AuthPage"; import CompleteSecurityBody from "../../views/auth/CompleteSecurityBody"; -import CreateCrossSigningDialog from "../../views/dialogs/security/CreateCrossSigningDialog"; +import InitialCryptoSetup from "../../views/dialogs/security/InitialCryptoSetup"; interface IProps { matrixClient: MatrixClient; @@ -25,7 +25,7 @@ export default class E2eSetup extends React.Component { return ( - = ({ matrixClient, accountPassword, tokenLogin, onFinished }) => { +const InitialCryptoSetup: React.FC = ({ matrixClient, accountPassword, tokenLogin, onFinished }) => { const [error, setError] = useState(false); - const bootstrapCrossSigning = useCallback(async () => { + const doSetup = useCallback(async () => { const cryptoApi = matrixClient.getCrypto(); if (!cryptoApi) return; @@ -40,6 +40,12 @@ const CreateCrossSigningDialog: React.FC = ({ matrixClient, accountPasswo try { await createCrossSigning(matrixClient, tokenLogin, accountPassword); + + const backupInfo = await matrixClient.getKeyBackupVersion(); + if (backupInfo === null) { + await cryptoApi.resetKeyBackup(); + } + onFinished(true); } catch (e) { if (tokenLogin) { @@ -58,8 +64,8 @@ const CreateCrossSigningDialog: React.FC = ({ matrixClient, accountPasswo }, [onFinished]); useEffect(() => { - bootstrapCrossSigning(); - }, [bootstrapCrossSigning]); + doSetup(); + }, [doSetup]); let content; if (error) { @@ -69,7 +75,7 @@ const CreateCrossSigningDialog: React.FC = ({ matrixClient, accountPasswo
@@ -96,4 +102,4 @@ const CreateCrossSigningDialog: React.FC = ({ matrixClient, accountPasswo ); }; -export default CreateCrossSigningDialog; +export default InitialCryptoSetup;