From 281bc09c9a06e47e35ac026ef913f8078359abd8 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 23 Mar 2020 18:36:37 +0000 Subject: [PATCH 1/3] Use unified function to check cross-signing is ready Fixes mismatches where the Cross signing panel would say cross signing was not ready but no toasts would appear. Fixes https://github.com/vector-im/riot-web/issues/12796 Fixes https://github.com/vector-im/riot-web/issues/12798 Requires https://github.com/matrix-org/matrix-js-sdk/pull/1279 --- src/DeviceListener.js | 5 ++++- src/components/views/settings/CrossSigningPanel.js | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/DeviceListener.js b/src/DeviceListener.js index 6a506db496..346be4bd13 100644 --- a/src/DeviceListener.js +++ b/src/DeviceListener.js @@ -107,7 +107,10 @@ export default class DeviceListener { ) return; if (!cli.isCryptoEnabled()) return; - if (!cli.getCrossSigningId()) { + + const crossSigningReady = await cli.crossSigningReady(); + + if (!crossSigningReady) { if (this._dismissedThisDeviceToast) { ToastStore.sharedInstance().dismissToast(THIS_DEVICE_TOAST_KEY); return; diff --git a/src/components/views/settings/CrossSigningPanel.js b/src/components/views/settings/CrossSigningPanel.js index d583210c9a..0df75f16bc 100644 --- a/src/components/views/settings/CrossSigningPanel.js +++ b/src/components/views/settings/CrossSigningPanel.js @@ -74,12 +74,14 @@ export default class CrossSigningPanel extends React.PureComponent { const secretStorageKeyInAccount = await secretStorage.hasKey(); const homeserverSupportsCrossSigning = await cli.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing"); + const crossSigningReady = await cli.crossSigningReady(); this.setState({ crossSigningPublicKeysOnDevice, crossSigningPrivateKeysInStorage, secretStorageKeyInAccount, homeserverSupportsCrossSigning, + crossSigningReady, }); } @@ -124,6 +126,7 @@ export default class CrossSigningPanel extends React.PureComponent { crossSigningPrivateKeysInStorage, secretStorageKeyInAccount, homeserverSupportsCrossSigning, + crossSigningReady, } = this.state; let errorSection; @@ -139,11 +142,14 @@ export default class CrossSigningPanel extends React.PureComponent { ); let summarisedStatus; - if (!homeserverSupportsCrossSigning) { + if (homeserverSupportsCrossSigning === undefined) { + const InlineSpinner = sdk.getComponent('views.elements.InlineSpinner'); + summarisedStatus =

; + } else if (!homeserverSupportsCrossSigning) { summarisedStatus =

{_t( "Your homeserver does not support cross-signing.", )}

; - } else if (enabledForAccount && crossSigningPublicKeysOnDevice) { + } else if (crossSigningReady) { summarisedStatus =

✅ {_t( "Cross-signing and secret storage are enabled.", )}

; From 5e1a46c656096daf9e774ae2cce38d20749981c4 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 24 Mar 2020 13:03:07 +0000 Subject: [PATCH 2/3] Update for new name --- src/DeviceListener.js | 2 +- src/components/views/settings/CrossSigningPanel.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DeviceListener.js b/src/DeviceListener.js index 346be4bd13..3992a587ae 100644 --- a/src/DeviceListener.js +++ b/src/DeviceListener.js @@ -108,7 +108,7 @@ export default class DeviceListener { if (!cli.isCryptoEnabled()) return; - const crossSigningReady = await cli.crossSigningReady(); + const crossSigningReady = await cli.isCrossSigningReady(); if (!crossSigningReady) { if (this._dismissedThisDeviceToast) { diff --git a/src/components/views/settings/CrossSigningPanel.js b/src/components/views/settings/CrossSigningPanel.js index 0df75f16bc..9fb47d8bbd 100644 --- a/src/components/views/settings/CrossSigningPanel.js +++ b/src/components/views/settings/CrossSigningPanel.js @@ -74,7 +74,7 @@ export default class CrossSigningPanel extends React.PureComponent { const secretStorageKeyInAccount = await secretStorage.hasKey(); const homeserverSupportsCrossSigning = await cli.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing"); - const crossSigningReady = await cli.crossSigningReady(); + const crossSigningReady = await cli.isCrossSigningReady(); this.setState({ crossSigningPublicKeysOnDevice, From 0fce57f891d985e6219e9a4c80e9e5a69ca18772 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 24 Mar 2020 13:13:28 +0000 Subject: [PATCH 3/3] Probably OK for debugging info to access private stuff --- src/components/views/settings/CrossSigningPanel.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/views/settings/CrossSigningPanel.js b/src/components/views/settings/CrossSigningPanel.js index 9fb47d8bbd..5bf36b1ae8 100644 --- a/src/components/views/settings/CrossSigningPanel.js +++ b/src/components/views/settings/CrossSigningPanel.js @@ -65,7 +65,6 @@ export default class CrossSigningPanel extends React.PureComponent { }; async _getUpdatedStatus() { - // XXX: Add public accessors if we keep this around in production const cli = MatrixClientPeg.get(); const crossSigning = cli._crypto._crossSigningInfo; const secretStorage = cli._crypto._secretStorage;