mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-23 10:11:52 +03:00
fix calculation of touch TOTP
This commit is contained in:
parent
d8916161f6
commit
ada86d7dad
@ -236,7 +236,7 @@ class MainViewModel : ViewModel() {
|
||||
private fun calculateCode(
|
||||
session: OathSession,
|
||||
credential: Credential,
|
||||
timestamp: Long = 0
|
||||
timestamp: Long
|
||||
) =
|
||||
if (credential.isSteamCredential()) {
|
||||
session.calculateSteamCode(credential, timestamp)
|
||||
@ -276,7 +276,7 @@ class MainViewModel : ViewModel() {
|
||||
val code =
|
||||
if (credentialData.oathType == OathType.TOTP && !requireTouch) {
|
||||
// recalculate the code
|
||||
calculateCode(session, credential)
|
||||
calculateCode(session, credential, System.currentTimeMillis())
|
||||
} else null
|
||||
|
||||
val jsonResult = Pair<Credential, Code?>(credential, code)
|
||||
@ -407,7 +407,7 @@ class MainViewModel : ViewModel() {
|
||||
|
||||
val credential = getOathCredential(session, credentialId)
|
||||
|
||||
val resultJson = calculateCode(session, credential)
|
||||
val resultJson = calculateCode(session, credential, System.currentTimeMillis())
|
||||
.toJson()
|
||||
.toString()
|
||||
|
||||
|
@ -21,7 +21,7 @@ fun Credential.isSteamCredential(): Boolean =
|
||||
*/
|
||||
fun OathSession.calculateSteamCode(
|
||||
credential: Credential,
|
||||
timestamp: Long = 0,
|
||||
timestamp: Long,
|
||||
): Code {
|
||||
val timeSlotMs = 30_000
|
||||
if (!credential.isSteamCredential()) {
|
||||
|
Loading…
Reference in New Issue
Block a user