Merge pull request #4821 from matrix-org/jryans/more-reset-paths

Show cross-signing / secret storage reset button in more cases
This commit is contained in:
J. Ryan Stinnett 2020-06-24 17:35:24 +01:00 committed by GitHub
commit 767090dd78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -154,13 +154,6 @@ export default class CrossSigningPanel extends React.PureComponent {
errorSection = <div className="error">{error.toString()}</div>; errorSection = <div className="error">{error.toString()}</div>;
} }
// Whether the various keys exist on your account (but not necessarily
// on this device).
const enabledForAccount = (
crossSigningPrivateKeysInStorage &&
secretStorageKeyInAccount
);
let summarisedStatus; let summarisedStatus;
if (homeserverSupportsCrossSigning === undefined) { if (homeserverSupportsCrossSigning === undefined) {
const InlineSpinner = sdk.getComponent('views.elements.InlineSpinner'); const InlineSpinner = sdk.getComponent('views.elements.InlineSpinner');
@ -184,8 +177,19 @@ export default class CrossSigningPanel extends React.PureComponent {
)}</p>; )}</p>;
} }
const keysExistAnywhere = (
secretStorageKeyInAccount ||
crossSigningPrivateKeysInStorage ||
crossSigningPublicKeysOnDevice
);
const keysExistEverywhere = (
secretStorageKeyInAccount &&
crossSigningPrivateKeysInStorage &&
crossSigningPublicKeysOnDevice
);
let resetButton; let resetButton;
if (enabledForAccount) { if (keysExistAnywhere) {
resetButton = ( resetButton = (
<div className="mx_CrossSigningPanel_buttonRow"> <div className="mx_CrossSigningPanel_buttonRow">
<AccessibleButton kind="danger" onClick={this._destroySecureSecretStorage}> <AccessibleButton kind="danger" onClick={this._destroySecureSecretStorage}>
@ -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 // TODO: determine how better to expose this to users in addition to prompts at login/toast
let bootstrapButton; let bootstrapButton;
if ( if (!keysExistEverywhere && homeserverSupportsCrossSigning) {
(!enabledForAccount || !crossSigningPublicKeysOnDevice) &&
homeserverSupportsCrossSigning
) {
bootstrapButton = ( bootstrapButton = (
<div className="mx_CrossSigningPanel_buttonRow"> <div className="mx_CrossSigningPanel_buttonRow">
<AccessibleButton kind="primary" onClick={this._onBootstrapClick}> <AccessibleButton kind="primary" onClick={this._onBootstrapClick}>