From c70aa4ccf0678a499459c0dbf9b9512bc2145fcb Mon Sep 17 00:00:00 2001 From: Adam Velebil Date: Thu, 24 Mar 2022 12:02:14 +0100 Subject: [PATCH] clear keys from memory after disconnecting usb yk --- .../kotlin/com/yubico/authenticator/MainViewModel.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/android/app/src/main/kotlin/com/yubico/authenticator/MainViewModel.kt b/android/app/src/main/kotlin/com/yubico/authenticator/MainViewModel.kt index 4ff0d16a..2bdf9836 100644 --- a/android/app/src/main/kotlin/com/yubico/authenticator/MainViewModel.kt +++ b/android/app/src/main/kotlin/com/yubico/authenticator/MainViewModel.kt @@ -46,7 +46,8 @@ class MainViewModel : ViewModel() { val yubiKeyDevice = MutableLiveData() private var isUsbKeyConnected: Boolean = false - private val keyManager = KeyManager(KeyStoreProvider(), ClearingMemProvider()) + private val memoryKeyProvider = ClearingMemProvider() + private val keyManager = KeyManager(KeyStoreProvider(), memoryKeyProvider) private var _operationContext = OperationContext.Oath @@ -178,13 +179,11 @@ class MainViewModel : ViewModel() { } fun yubikeyDetached() { - if (isUsbKeyConnected) { - // forget the current password only for usb keys - // TODO: clear from memory store + // clear keys from memory + memoryKeyProvider.clearAll() _fManagementApi.updateDeviceInfo("") {} } - } fun onDialogClosed(result: Pigeon.Result) {