From 4a82e868595160a0494dbb1efd0a09b1f4c2817f Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Fri, 17 Jan 2020 17:59:08 +0000 Subject: [PATCH] Adjust secret storage to work before sync This adjusts to changed JS SDK APIs that allow secret storage to optionally ask the server for any account data needed at login. Fixes https://github.com/vector-im/riot-web/issues/11901 --- src/CrossSigningManager.js | 2 +- src/components/views/settings/CrossSigningPanel.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CrossSigningManager.js b/src/CrossSigningManager.js index 0773a8d32d..085764214f 100644 --- a/src/CrossSigningManager.js +++ b/src/CrossSigningManager.js @@ -107,7 +107,7 @@ export async function accessSecretStorage(func = async () => { }) { cachingAllowed = true; try { - if (!cli.hasSecretStorageKey()) { + if (!await cli.hasSecretStorageKey()) { // This dialog calls bootstrap itself after guiding the user through // passphrase creation. const { finished } = Modal.createTrackedDialogAsync('Create Secret Storage dialog', '', diff --git a/src/components/views/settings/CrossSigningPanel.js b/src/components/views/settings/CrossSigningPanel.js index 2b191454f6..49046cd051 100644 --- a/src/components/views/settings/CrossSigningPanel.js +++ b/src/components/views/settings/CrossSigningPanel.js @@ -60,14 +60,14 @@ export default class CrossSigningPanel extends React.PureComponent { this.setState(this._getUpdatedStatus()); }; - _getUpdatedStatus() { + 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; const crossSigningPublicKeysOnDevice = crossSigning.getId(); - const crossSigningPrivateKeysInStorage = crossSigning.isStoredInSecretStorage(secretStorage); - const secretStorageKeyInAccount = secretStorage.hasKey(); + const crossSigningPrivateKeysInStorage = await crossSigning.isStoredInSecretStorage(secretStorage); + const secretStorageKeyInAccount = await secretStorage.hasKey(); return { crossSigningPublicKeysOnDevice,