summaryrefslogtreecommitdiff
path: root/format-common/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'format-common/src/main')
-rw-r--r--format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt6
-rw-r--r--format-common/src/main/kotlin/dev/msfjarvis/aps/util/totp/Otp.kt2
2 files changed, 4 insertions, 4 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 05afd8c2..a65e3494 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
@@ -13,8 +13,8 @@ import dev.msfjarvis.aps.util.time.UserClock
import dev.msfjarvis.aps.util.totp.Otp
import dev.msfjarvis.aps.util.totp.TotpFinder
import kotlin.collections.set
+import kotlin.time.Duration
import kotlin.time.ExperimentalTime
-import kotlin.time.seconds
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
@@ -84,10 +84,10 @@ constructor(
scope.launch {
updateTotp(clock.millis())
val remainingTime = totpPeriod - (System.currentTimeMillis() % totpPeriod)
- delay(remainingTime.seconds)
+ delay(Duration.seconds(remainingTime))
repeat(Int.MAX_VALUE) {
updateTotp(clock.millis())
- delay(totpPeriod.seconds)
+ delay(Duration.seconds(totpPeriod))
}
}
}
diff --git a/format-common/src/main/kotlin/dev/msfjarvis/aps/util/totp/Otp.kt b/format-common/src/main/kotlin/dev/msfjarvis/aps/util/totp/Otp.kt
index e6efd794..832529e9 100644
--- a/format-common/src/main/kotlin/dev/msfjarvis/aps/util/totp/Otp.kt
+++ b/format-common/src/main/kotlin/dev/msfjarvis/aps/util/totp/Otp.kt
@@ -24,7 +24,7 @@ internal object Otp {
}
fun calculateCode(secret: String, counter: Long, algorithm: String, digits: String) = runCatching {
- val algo = "Hmac${algorithm.toUpperCase(Locale.ROOT)}"
+ val algo = "Hmac${algorithm.uppercase(Locale.ROOT)}"
val decodedSecret = BASE_32.decode(secret)
val secretKey = SecretKeySpec(decodedSecret, algo)
val digest =