summaryrefslogtreecommitdiff
path: root/format-common
diff options
context:
space:
mode:
Diffstat (limited to 'format-common')
-rw-r--r--format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt2
-rw-r--r--format-common/src/main/kotlin/dev/msfjarvis/aps/util/totp/Otp.kt6
2 files changed, 1 insertions, 7 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 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
}
}