From 4880e1db276b4cf2ec29eeffbd38539ca643b4be Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Wed, 28 Apr 2021 10:27:14 +0530 Subject: Upgrade to Kotlin 1.5 (#1397) * build: upgrade Kotlin to 1.5.0 and Hilt to 2.35.1 Signed-off-by: Harsh Shandilya * all: address kotlin.time.seconds deprecation Signed-off-by: Harsh Shandilya * autofill-parser/openpgp-ktx: require Kotlin 1.5 Signed-off-by: Harsh Shandilya * all: address string method deprecations Signed-off-by: Harsh Shandilya * build: disable NewApi lint Signed-off-by: Harsh Shandilya --- .../main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt | 6 +++--- format-common/src/main/kotlin/dev/msfjarvis/aps/util/totp/Otp.kt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'format-common/src/main') 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 = -- cgit v1.2.3