fix flow in getDeviceInfo

This commit is contained in:
Adam Velebil 2022-08-25 08:47:23 +02:00
parent a99c953c96
commit dc08a471a1
No known key found for this signature in database
GPG Key ID: AC6D6B9D715FC084

View File

@ -18,10 +18,10 @@ suspend fun getDeviceInfo(device: YubiKeyDevice): Info {
val deviceInfo = runCatching {
device.withConnection<SmartCardConnection, DeviceInfo> { DeviceUtil.readInfo(it, pid) }
}.onFailure {
}.recoverCatching {
Log.d(OathManager.TAG, "Smart card connection not available")
device.withConnection<OtpConnection, DeviceInfo> { DeviceUtil.readInfo(it, pid) }
}.onFailure {
}.recoverCatching {
Log.d(OathManager.TAG, "OTP connection not available")
device.withConnection<FidoConnection, DeviceInfo> { DeviceUtil.readInfo(it, pid) }
}.getOrElse {