Rename CreateCrossSigningDialog to InitialCryptoSetup
because it will soon encompass things other than just creating cross signing.
This commit is contained in:
parent
0c4189f2ed
commit
d77f11b5d8
2 changed files with 17 additions and 11 deletions
|
@ -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<IProps> {
|
|||
return (
|
||||
<AuthPage>
|
||||
<CompleteSecurityBody>
|
||||
<CreateCrossSigningDialog
|
||||
<InitialCryptoSetup
|
||||
matrixClient={this.props.matrixClient}
|
||||
onFinished={this.props.onFinished}
|
||||
accountPassword={this.props.accountPassword}
|
||||
|
|
|
@ -25,14 +25,14 @@ interface Props {
|
|||
}
|
||||
|
||||
/*
|
||||
* Walks the user through the process of creating a cross-signing keys. In most
|
||||
* cases, only a spinner is shown, but for more complex auth like SSO, the user
|
||||
* may need to complete some steps to proceed.
|
||||
* Walks the user through the process of creating a cross-signing keys and setting
|
||||
* up message key backup. In most cases, only a spinner is shown, but for more
|
||||
* complex auth like SSO, the user may need to complete some steps to proceed.
|
||||
*/
|
||||
const CreateCrossSigningDialog: React.FC<Props> = ({ matrixClient, accountPassword, tokenLogin, onFinished }) => {
|
||||
const InitialCryptoSetup: React.FC<Props> = ({ 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<Props> = ({ 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<Props> = ({ matrixClient, accountPasswo
|
|||
}, [onFinished]);
|
||||
|
||||
useEffect(() => {
|
||||
bootstrapCrossSigning();
|
||||
}, [bootstrapCrossSigning]);
|
||||
doSetup();
|
||||
}, [doSetup]);
|
||||
|
||||
let content;
|
||||
if (error) {
|
||||
|
@ -69,7 +75,7 @@ const CreateCrossSigningDialog: React.FC<Props> = ({ matrixClient, accountPasswo
|
|||
<div className="mx_Dialog_buttons">
|
||||
<DialogButtons
|
||||
primaryButton={_t("action|retry")}
|
||||
onPrimaryButtonClick={bootstrapCrossSigning}
|
||||
onPrimaryButtonClick={doSetup}
|
||||
onCancel={onCancel}
|
||||
/>
|
||||
</div>
|
||||
|
@ -96,4 +102,4 @@ const CreateCrossSigningDialog: React.FC<Props> = ({ matrixClient, accountPasswo
|
|||
);
|
||||
};
|
||||
|
||||
export default CreateCrossSigningDialog;
|
||||
export default InitialCryptoSetup;
|
Loading…
Add table
Add a link
Reference in a new issue