From 40cabd258921d33da62e5a7b94edcc1ff646209d Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 4 Jun 2020 12:49:33 +0200 Subject: [PATCH] When trying to restore a keyback that has its key in 4S, check if 4S will be readable If the account data for the 4S key is cleared or lost somehow, don't attempt to read the key and ask for the passphrase/recovery key instead, as doing so would trigger another bootstrap from the restore key backup dialog, overwriting the existing key backup. --- .../views/dialogs/keybackup/RestoreKeyBackupDialog.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js b/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js index a16202ed93..829a4f102e 100644 --- a/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js +++ b/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js @@ -243,8 +243,10 @@ export default class RestoreKeyBackupDialog extends React.PureComponent { loadError: null, }); try { - const backupInfo = await MatrixClientPeg.get().getKeyBackupVersion(); - const backupKeyStored = await MatrixClientPeg.get().isKeyBackupKeyStored(); + const cli = MatrixClientPeg.get(); + const backupInfo = await cli.getKeyBackupVersion(); + const has4S = await cli.hasSecretStorageKey(); + const backupKeyStored = has4S && await cli.isKeyBackupKeyStored(); this.setState({ backupInfo, backupKeyStored,