Fix otp key uppercase label #909

This commit is contained in:
J-Jamet committed 2021-03-05 15:14:52 +01:00
1 parent 4ecb8d4483
commit 5839f51f44
1 file changed
+1 -3
@@ -321,11 +321,9 @@ object OtpEntryFields {
return try {
// KeeOtp string format
val query = breakDownKeyValuePairs(plainText)
otpElement.setBase32Secret(query[SEED_KEY] ?: "")
otpElement.digits = query[DIGITS_KEY]?.toIntOrNull() ?: OTP_DEFAULT_DIGITS
otpElement.period = query[STEP_KEY]?.toIntOrNull() ?: TOTP_DEFAULT_PERIOD
otpElement.type = OtpType.TOTP
true
} catch (exception: Exception) {
@@ -413,7 +411,7 @@ object OtpEntryFields {
val output = HashMap<String, String>()
for (element in elements) {
val pair = element.split("=".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
output[pair[0]] = pair[1]
output[pair[0].toLowerCase(Locale.ENGLISH)] = pair[1]
}
return output
}