summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAditya Wasan <adityawasan55@gmail.com>2021-04-18 15:38:54 +0530
committerGitHub <noreply@github.com>2021-04-18 10:08:54 +0000
commit7a532302e3b76952b4990d1dc7ee6d52bc842b9b (patch)
treeb3fae1d1475e91dfeb8ef0d93fbda6a0cde53f61
parent7710ca90248d6111c54eb452b1dca27dd4a53f22 (diff)
Use correct time to find TOTP secret (#1387)
-rw-r--r--format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt5
1 files changed, 3 insertions, 2 deletions
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)
}
}
}