diff --git a/src/components/structures/auth/CompleteSecurity.js b/src/components/structures/auth/CompleteSecurity.js index 29d8207d0a..0f30d9cf61 100644 --- a/src/components/structures/auth/CompleteSecurity.js +++ b/src/components/structures/auth/CompleteSecurity.js @@ -22,8 +22,9 @@ import { MatrixClientPeg } from '../../../MatrixClientPeg'; import { accessSecretStorage } from '../../../CrossSigningManager'; const PHASE_INTRO = 0; -const PHASE_DONE = 1; -const PHASE_CONFIRM_SKIP = 2; +const PHASE_BUSY = 1; +const PHASE_DONE = 2; +const PHASE_CONFIRM_SKIP = 3; export default class CompleteSecurity extends React.Component { static propTypes = { @@ -39,6 +40,7 @@ export default class CompleteSecurity extends React.Component { // the presence of it insidicating that we're in 'verify mode'. // Because of the latter, it lives in the state. verificationRequest: null, + backupInfo: null, }; MatrixClientPeg.get().on("crypto.verification.request", this.onVerificationRequest); } @@ -53,10 +55,16 @@ export default class CompleteSecurity extends React.Component { } onStartClick = async () => { + this.setState({ + phase: PHASE_BUSY, + }); const cli = MatrixClientPeg.get(); + const backupInfo = await cli.getKeyBackupVersion(); + this.setState({backupInfo}); try { await accessSecretStorage(async () => { await cli.checkOwnCrossSigningTrust(); + if (backupInfo) await cli.restoreKeyBackupWithSecretStorage(backupInfo); }); if (cli.getCrossSigningId()) { @@ -66,6 +74,9 @@ export default class CompleteSecurity extends React.Component { } } catch (e) { // this will throw if the user hits cancel, so ignore + this.setState({ + phase: PHASE_INTRO, + }); } } @@ -155,13 +166,21 @@ export default class CompleteSecurity extends React.Component { } else if (phase === PHASE_DONE) { icon = ; title = _t("Session verified"); + let message; + if (this.state.backupInfo) { + message =

{_t( + "Your new session is now verified. It has access to your " + + "encrypted messages, and other users will see it as trusted.", + )}

; + } else { + message =

{_t( + "Your new session is now verified. Other users will see it as trusted.", + )}

; + } body = (
-

{_t( - "Your new session is now verified. It has access to your " + - "encrypted messages, and other users will see it as trusted.", - )}

+ {message}
); + } else if (phase === PHASE_BUSY) { + const Spinner = sdk.getComponent('views.elements.Spinner'); + icon = ; + title = ''; + body = ; } else { throw new Error(`Unknown phase ${phase}`); } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index b5a412e117..3ce31f69aa 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1894,6 +1894,7 @@ "Done": "Done", "Without completing security on this device, it won’t have access to encrypted messages.": "Without completing security on this device, it won’t have access to encrypted messages.", "Go Back": "Go Back", + "Restoring": "Restoring", "Failed to send email": "Failed to send email", "The email address linked to your account must be entered.": "The email address linked to your account must be entered.", "A new password must be entered.": "A new password must be entered.",