mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-31 06:15:48 +00:00
Use correct time to find TOTP secret (#1387)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user