use calculateCodes() instead getCredentials()

This commit is contained in:
Adam Velebil 2022-09-06 09:39:14 +02:00
parent 98dc195184
commit 404245fd51
No known key found for this signature in database
GPG Key ID: AC6D6B9D715FC084

View File

@ -509,10 +509,12 @@ class OathManager(
}
}
private fun getOathCredential(oathSession: OathSession, credentialId: String) =
oathSession.credentials.firstOrNull { credential ->
private fun getOathCredential(oathSession: OathSession, credentialId: String) : Credential {
// we need to use oathSession.calculateCodes() to get proper Credential.touchRequired value
return oathSession.calculateCodes().map { e -> e.key }.firstOrNull { credential ->
(credential != null) && credential.id.asString() == credentialId
} ?: throw Exception("Failed to find account")
}
}