From ac9bb699047964c4b43b190976c8f823127bcc1f Mon Sep 17 00:00:00 2001 From: Pavneet-Sing Date: Tue, 1 Feb 2022 00:55:37 +0530 Subject: [PATCH] fix(wallet): clear fingerprint after wallet reset --- .../chrome/browser/crypto_wallet/util/KeystoreHelper.java | 7 +++++++ .../browser/settings/BraveWalletResetPreference.java | 2 ++ 2 files changed, 9 insertions(+) diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/util/KeystoreHelper.java b/android/java/org/chromium/chrome/browser/crypto_wallet/util/KeystoreHelper.java index ca88e746fe19..ca9a55e61057 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/util/KeystoreHelper.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/util/KeystoreHelper.java @@ -116,4 +116,11 @@ public static String decryptText() return new String(cipher.doFinal(Base64.decode(encryptedBase64, Base64.DEFAULT)), "UTF-8"); } + + public static void resetBiometric() { + SharedPreferencesManager manager = SharedPreferencesManager.getInstance(); + manager.removeKey(BravePreferenceKeys.BRAVE_USE_BIOMETRICS_FOR_WALLET); + manager.removeKey(BravePreferenceKeys.BRAVE_BIOMETRICS_FOR_WALLET_ENCRYPTED); + manager.removeKey(BravePreferenceKeys.BRAVE_BIOMETRICS_FOR_WALLET_IV); + } } diff --git a/android/java/org/chromium/chrome/browser/settings/BraveWalletResetPreference.java b/android/java/org/chromium/chrome/browser/settings/BraveWalletResetPreference.java index fe61ef95b861..da4ded65cfd8 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveWalletResetPreference.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveWalletResetPreference.java @@ -28,6 +28,7 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.app.BraveActivity; +import org.chromium.chrome.browser.crypto_wallet.util.KeystoreHelper; import org.chromium.chrome.browser.crypto_wallet.util.Utils; import org.chromium.chrome.browser.crypto_wallet.util.WalletNativeUtils; import org.chromium.ui.KeyboardVisibilityDelegate; @@ -87,6 +88,7 @@ public void onClick(DialogInterface dialog, int button) { if (TextUtils.equals(inputText, mConfirmationPhrase)) { Log.w(TAG, "Reset"); WalletNativeUtils.resetWallet(); + KeystoreHelper.resetBiometric(); Utils.setCryptoOnboarding(true); }