Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
Update two factor code every 5 seconds
Browse files Browse the repository at this point in the history
TODO: generate code only when old code expired
  • Loading branch information
M3DZIK committed Feb 27, 2024
1 parent 5383833 commit 328b717
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.text.SimpleDateFormat
import java.util.Locale
import java.util.concurrent.TimeUnit

@Composable
fun CipherViewScreen(
Expand All @@ -83,7 +84,7 @@ fun CipherViewScreen(

scope.launch {
while (lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED)) {
delay(30 * 1000)
delay(TimeUnit.SECONDS.toMillis(5))

totpCode = TOTPGenerator.now(params)
}
Expand Down

0 comments on commit 328b717

Please sign in to comment.