From 68543dcb919acdbbecd33429da64dadd68b8d0ca Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Mon, 15 Feb 2021 11:13:12 -0300 Subject: [PATCH] Store main key also when verifying recovery code in case it wasn't stored before --- .../seedvault/ui/recoverycode/RecoveryCodeViewModel.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeViewModel.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeViewModel.kt index 65e2a62a..c3069475 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeViewModel.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeViewModel.kt @@ -73,7 +73,9 @@ class RecoveryCodeViewModel( keyManager.storeMainKey(seed) mRecoveryCodeSaved.setEvent(true) } else { - mExistingCodeChecked.setEvent(crypto.verifyBackupKey(seed)) + val verified = crypto.verifyBackupKey(seed) + if (verified && !keyManager.hasMainKey()) keyManager.storeMainKey(seed) + mExistingCodeChecked.setEvent(verified) } }