From 7a532302e3b76952b4990d1dc7ee6d52bc842b9b Mon Sep 17 00:00:00 2001 From: Aditya Wasan Date: Sun, 18 Apr 2021 15:38:54 +0530 Subject: Use correct time to find TOTP secret (#1387) --- .../src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'format-common') diff --git a/format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt b/format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt index 9b7fc8f3..05afd8c2 100644 --- a/format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt +++ b/format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt @@ -14,6 +14,7 @@ import dev.msfjarvis.aps.util.totp.Otp import dev.msfjarvis.aps.util.totp.TotpFinder import kotlin.collections.set import kotlin.time.ExperimentalTime +import kotlin.time.seconds import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.delay import kotlinx.coroutines.flow.MutableStateFlow @@ -83,10 +84,10 @@ constructor( scope.launch { updateTotp(clock.millis()) val remainingTime = totpPeriod - (System.currentTimeMillis() % totpPeriod) - delay(remainingTime) + delay(remainingTime.seconds) repeat(Int.MAX_VALUE) { updateTotp(clock.millis()) - delay(totpPeriod) + delay(totpPeriod.seconds) } } } -- cgit v1.2.3