From b8756a667c56f67d14b25286f2568f3eb3e8e9f3 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 5 Mar 2022 19:17:48 +0530 Subject: Cleanup IDE reported lints in autofill-parser and format-common (#1765) --- .../main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt | 2 -- format-common/src/main/kotlin/dev/msfjarvis/aps/util/totp/Otp.kt | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) (limited to 'format-common/src') 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 c36cb0ed..94149477 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,14 +13,12 @@ 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.ExperimentalTime import kotlinx.coroutines.awaitCancellation import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow /** Represents a single entry in the password store. */ -@OptIn(ExperimentalTime::class) public class PasswordEntry @AssistedInject constructor( 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 f1f71e00..0a3921db 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 @@ -19,10 +19,6 @@ internal object Otp { private val BASE_32 = Base32() private val STEAM_ALPHABET = "23456789BCDFGHJKMNPQRTVWXY".toCharArray() - init { - check(STEAM_ALPHABET.size == 26) - } - fun calculateCode( secret: String, counter: Long, @@ -51,7 +47,7 @@ internal object Otp { var remainingCodeInt = codeInt buildString { repeat(5) { - append(STEAM_ALPHABET[remainingCodeInt % 26]) + append(STEAM_ALPHABET[remainingCodeInt % STEAM_ALPHABET.size]) remainingCodeInt /= 26 } } -- cgit v1.2.3