mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-23 10:11:52 +03:00
handle locked oath sessions when refreshing
This commit is contained in:
parent
d753c43a6a
commit
3bc8304f34
@ -444,9 +444,22 @@ class OathManager(
|
||||
private suspend fun requestRefresh() =
|
||||
appViewModel.connectedYubiKey.value?.let { usbYubiKeyDevice ->
|
||||
useOathSessionUsb(usbYubiKeyDevice) { session ->
|
||||
oathViewModel.updateCredentials(
|
||||
calculateOathCodes(session).model(session.deviceId)
|
||||
)
|
||||
try {
|
||||
oathViewModel.updateCredentials(
|
||||
calculateOathCodes(session).model(session.deviceId)
|
||||
)
|
||||
} catch(apduException: ApduException) {
|
||||
if (apduException.sw == SW.SECURITY_CONDITION_NOT_SATISFIED) {
|
||||
Log.d(TAG, "Handled oath credential refresh on locked session.")
|
||||
oathViewModel.setSessionState(session.model(keyManager.isRemembered(session.deviceId)))
|
||||
} else {
|
||||
Log.e(
|
||||
TAG,
|
||||
"Unexpected sw when refreshing oath credentials",
|
||||
apduException.message
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user