From c11af8c9fa3cbf4dc9720ea452825564c5b5584c Mon Sep 17 00:00:00 2001 From: "Mehdi.Bagvand" Date: Wed, 2 Aug 2023 22:15:52 +0330 Subject: [PATCH] fix wrong reading key or passphrase from well-known configuration --- .../recover/BootstrapSharedViewModel.kt | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSharedViewModel.kt b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSharedViewModel.kt index c9c2c5ce9ac..8cd893701ad 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSharedViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSharedViewModel.kt @@ -96,30 +96,29 @@ class BootstrapSharedViewModel @AssistedInject constructor( secureBackupMethod = wellKnown?.secureBackupMethod() ?: SecureBackupMethod.KEY_OR_PASSPHRASE, ) } - } - - when (initialState.setupMode) { - SetupMode.PASSPHRASE_RESET, - SetupMode.PASSPHRASE_AND_NEEDED_SECRETS_RESET, - SetupMode.HARD_RESET -> { - setState { - copy( - step = BootstrapStep.FirstForm( - keyBackUpExist = false, - reset = session.sharedSecretStorageService().isRecoverySetup(), - methods = this.secureBackupMethod - ) - ) + when (initialState.setupMode) { + SetupMode.PASSPHRASE_RESET, + SetupMode.PASSPHRASE_AND_NEEDED_SECRETS_RESET, + SetupMode.HARD_RESET -> { + setState { + copy( + step = BootstrapStep.FirstForm( + keyBackUpExist = false, + reset = session.sharedSecretStorageService().isRecoverySetup(), + methods = this.secureBackupMethod + ) + ) + } } - } - SetupMode.CROSS_SIGNING_ONLY -> { - // Go straight to account password - setState { - copy(step = BootstrapStep.AccountReAuth()) + SetupMode.CROSS_SIGNING_ONLY -> { + // Go straight to account password + setState { + copy(step = BootstrapStep.AccountReAuth()) + } + } + SetupMode.NORMAL -> { + checkMigration() } - } - SetupMode.NORMAL -> { - checkMigration() } } }