diff options
author | Aditya Wasan <adityawasan55@gmail.com> | 2021-04-18 15:38:54 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-18 10:08:54 +0000 |
commit | 7a532302e3b76952b4990d1dc7ee6d52bc842b9b (patch) | |
tree | b3fae1d1475e91dfeb8ef0d93fbda6a0cde53f61 /format-common/src/main | |
parent | 7710ca90248d6111c54eb452b1dca27dd4a53f22 (diff) |
Use correct time to find TOTP secret (#1387)
Diffstat (limited to 'format-common/src/main')
-rw-r--r-- | format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt | 5 |
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) } } } |