summaryrefslogtreecommitdiff
path: root/format-common/src/main
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2021-05-15 12:56:49 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2021-05-15 15:40:20 +0530
commit7e2eb2425e7b9b6ccb37b7b89f19de3fa7a20c44 (patch)
tree6b8a9557ac51b5fab5d2ad7611084cf0de6c57cf /format-common/src/main
parent2fcb285e276594842798be6990b92ba09e733f49 (diff)
all: reformat with Spotless again
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'format-common/src/main')
-rw-r--r--format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt9
-rw-r--r--format-common/src/main/kotlin/dev/msfjarvis/aps/util/totp/Otp.kt3
2 files changed, 8 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 a65e3494..96337bf7 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
@@ -115,11 +115,13 @@ constructor(
.lineSequence()
.filter { line ->
return@filter when {
- USERNAME_FIELDS.any { prefix -> line.startsWith(prefix, ignoreCase = true) } && !foundUsername -> {
+ USERNAME_FIELDS.any { prefix -> line.startsWith(prefix, ignoreCase = true) } &&
+ !foundUsername -> {
foundUsername = true
false
}
- line.startsWith("otpauth://", ignoreCase = true) || line.startsWith("totp:", ignoreCase = true) -> {
+ line.startsWith("otpauth://", ignoreCase = true) ||
+ line.startsWith("totp:", ignoreCase = true) -> {
false
}
else -> {
@@ -174,7 +176,8 @@ constructor(
private fun findUsername(): String? {
extraContentString.splitToSequence("\n").forEach { line ->
for (prefix in USERNAME_FIELDS) {
- if (line.startsWith(prefix, ignoreCase = true)) return line.substring(prefix.length).trimStart()
+ if (line.startsWith(prefix, ignoreCase = true))
+ return line.substring(prefix.length).trimStart()
}
}
return null
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 832529e9..65284441 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
@@ -23,7 +23,8 @@ internal object Otp {
check(STEAM_ALPHABET.size == 26)
}
- fun calculateCode(secret: String, counter: Long, algorithm: String, digits: String) = runCatching {
+ fun calculateCode(secret: String, counter: Long, algorithm: String, digits: String) =
+ runCatching {
val algo = "Hmac${algorithm.uppercase(Locale.ROOT)}"
val decodedSecret = BASE_32.decode(secret)
val secretKey = SecretKeySpec(decodedSecret, algo)