Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 5344b86

Browse files
authored
Merge pull request #6633 from matrix-org/dbkr/fix_cross_signing_setup_settings
Fix cross signing setup from settings screen
2 parents 30a08ea + 08b37eb commit 5344b86

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

src/components/views/settings/CrossSigningPanel.tsx

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import InteractiveAuthDialog from '../dialogs/InteractiveAuthDialog';
2525
import ConfirmDestroyCrossSigningDialog from '../dialogs/security/ConfirmDestroyCrossSigningDialog';
2626
import { replaceableComponent } from "../../../utils/replaceableComponent";
2727
import { MatrixEvent } from 'matrix-js-sdk/src';
28+
import SetupEncryptionDialog from '../dialogs/security/SetupEncryptionDialog';
29+
import { accessSecretStorage } from '../../../SecurityManager';
2830

2931
interface IState {
3032
error?: Error;
@@ -72,7 +74,16 @@ export default class CrossSigningPanel extends React.PureComponent<{}, IState> {
7274
};
7375

7476
private onBootstrapClick = () => {
75-
this.bootstrapCrossSigning({ forceReset: false });
77+
if (this.state.crossSigningPrivateKeysInStorage) {
78+
Modal.createTrackedDialog(
79+
"Verify session", "Verify session", SetupEncryptionDialog,
80+
{}, null, /* priority = */ false, /* static = */ true,
81+
);
82+
} else {
83+
// Trigger the flow to set up secure backup, which is what this will do when in
84+
// the appropriate state.
85+
accessSecretStorage();
86+
}
7687
};
7788

7889
private onStatusChanged = () => {
@@ -176,10 +187,14 @@ export default class CrossSigningPanel extends React.PureComponent<{}, IState> {
176187
summarisedStatus = <p>{ _t(
177188
"Your homeserver does not support cross-signing.",
178189
) }</p>;
179-
} else if (crossSigningReady) {
190+
} else if (crossSigningReady && crossSigningPrivateKeysInStorage) {
180191
summarisedStatus = <p>{ _t(
181192
"Cross-signing is ready for use.",
182193
) }</p>;
194+
} else if (crossSigningReady && !crossSigningPrivateKeysInStorage) {
195+
summarisedStatus = <p>⚠️ { _t(
196+
"Cross-signing is ready but keys are not backed up.",
197+
) }</p>;
183198
} else if (crossSigningPrivateKeysInStorage) {
184199
summarisedStatus = <p>{ _t(
185200
"Your account has a cross-signing identity in secret storage, " +
@@ -210,9 +225,13 @@ export default class CrossSigningPanel extends React.PureComponent<{}, IState> {
210225

211226
// TODO: determine how better to expose this to users in addition to prompts at login/toast
212227
if (!keysExistEverywhere && homeserverSupportsCrossSigning) {
228+
let buttonCaption = _t("Set up Secure Backup");
229+
if (crossSigningPrivateKeysInStorage) {
230+
buttonCaption = _t("Verify this session");
231+
}
213232
actions.push(
214233
<AccessibleButton key="setup" kind="primary" onClick={this.onBootstrapClick}>
215-
{ _t("Set up") }
234+
{ buttonCaption }
216235
</AccessibleButton>,
217236
);
218237
}

src/i18n/strings/en_EN.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1102,9 +1102,9 @@
11021102
"Change Password": "Change Password",
11031103
"Your homeserver does not support cross-signing.": "Your homeserver does not support cross-signing.",
11041104
"Cross-signing is ready for use.": "Cross-signing is ready for use.",
1105+
"Cross-signing is ready but keys are not backed up.": "Cross-signing is ready but keys are not backed up.",
11051106
"Your account has a cross-signing identity in secret storage, but it is not yet trusted by this session.": "Your account has a cross-signing identity in secret storage, but it is not yet trusted by this session.",
11061107
"Cross-signing is not set up.": "Cross-signing is not set up.",
1107-
"Set up": "Set up",
11081108
"Reset": "Reset",
11091109
"Cross-signing public keys:": "Cross-signing public keys:",
11101110
"in memory": "in memory",
@@ -1202,6 +1202,7 @@
12021202
"Algorithm:": "Algorithm:",
12031203
"Your keys are <b>not being backed up from this session</b>.": "Your keys are <b>not being backed up from this session</b>.",
12041204
"Back up your keys before signing out to avoid losing them.": "Back up your keys before signing out to avoid losing them.",
1205+
"Set up": "Set up",
12051206
"well formed": "well formed",
12061207
"unexpected type": "unexpected type",
12071208
"Back up your encryption keys with your account data in case you lose access to your sessions. Your keys will be secured with a unique Security Key.": "Back up your encryption keys with your account data in case you lose access to your sessions. Your keys will be secured with a unique Security Key.",

0 commit comments

Comments
 (0)