From b01015f5c5a45ca0031d3a1f2d26417d55ca4e20 Mon Sep 17 00:00:00 2001
From: "J. Ryan Stinnett"
Date: Wed, 24 Jun 2020 14:30:12 +0100
Subject: [PATCH] Show cross-signing / secret storage reset button in more
cases
This exposes the cross-signing / secret storage reset button in more cases to
hopefully give people a better chance of trying again in case something failed
halfway through set up. In particular, any combination of keys existing now
reveals the reset button.
Fixes https://github.com/vector-im/riot-web/issues/13993
---
.../views/settings/CrossSigningPanel.js | 25 ++++++++++---------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/components/views/settings/CrossSigningPanel.js b/src/components/views/settings/CrossSigningPanel.js
index 7eb239cbca..aa512d4365 100644
--- a/src/components/views/settings/CrossSigningPanel.js
+++ b/src/components/views/settings/CrossSigningPanel.js
@@ -154,13 +154,6 @@ export default class CrossSigningPanel extends React.PureComponent {
errorSection = {error.toString()}
;
}
- // Whether the various keys exist on your account (but not necessarily
- // on this device).
- const enabledForAccount = (
- crossSigningPrivateKeysInStorage &&
- secretStorageKeyInAccount
- );
-
let summarisedStatus;
if (homeserverSupportsCrossSigning === undefined) {
const InlineSpinner = sdk.getComponent('views.elements.InlineSpinner');
@@ -184,8 +177,19 @@ export default class CrossSigningPanel extends React.PureComponent {
)}
;
}
+ const keysExistAnywhere = (
+ secretStorageKeyInAccount ||
+ crossSigningPrivateKeysInStorage ||
+ crossSigningPublicKeysOnDevice
+ );
+ const keysExistEverywhere = (
+ secretStorageKeyInAccount &&
+ crossSigningPrivateKeysInStorage &&
+ crossSigningPublicKeysOnDevice
+ );
+
let resetButton;
- if (enabledForAccount) {
+ if (keysExistAnywhere) {
resetButton = (
@@ -197,10 +201,7 @@ export default class CrossSigningPanel extends React.PureComponent {
// TODO: determine how better to expose this to users in addition to prompts at login/toast
let bootstrapButton;
- if (
- (!enabledForAccount || !crossSigningPublicKeysOnDevice) &&
- homeserverSupportsCrossSigning
- ) {
+ if (!keysExistEverywhere && homeserverSupportsCrossSigning) {
bootstrapButton = (