diff options
author | Dan Ho <igaryhe@gmail.com> | 2019-03-15 22:49:14 +0800 |
---|---|---|
committer | Dan Ho <igaryhe@gmail.com> | 2019-03-15 22:49:14 +0800 |
commit | 9137dadcbd7427569f85d6349ddb0190c1c09bb7 (patch) | |
tree | 12daa319e1f4667e747c6a7c8e15d71be0f03fff /app/src | |
parent | f5139320dbb8be38af7b5b519a29cd06ec5cd30a (diff) |
minor spelling mistake fix
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt | 12 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt | 3 |
2 files changed, 9 insertions, 6 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt b/app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt index 2b1f1eee..392bc749 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt @@ -11,7 +11,7 @@ import java.io.UnsupportedEncodingException class PasswordEntry(private val content: String) { val password: String val username: String? - val digits: String? + val digits: String val totpSecret: String? val totpPeriod: Long val totpAlgorithm: String @@ -87,11 +87,13 @@ class PasswordEntry(private val content: String) { return null } - private fun findOtpDigits(decryptedContent: String): String? { + private fun findOtpDigits(decryptedContent: String): String { decryptedContent.split("\n".toRegex()).forEach { line -> - if (line.startsWith("optauth://totp/") || - line.startsWith("otpauth://hotp/")) - return Uri.parse(line).getQueryParameters("digits").toString() + if (line.startsWith("otpauth://totp/") || + line.startsWith("otpauth://hotp/") && + Uri.parse(line).getQueryParameter("digits") != null) { + return Uri.parse(line).getQueryParameter("digits")!! + } } return "6" } diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt index dc9d399f..4e3b756c 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt @@ -316,7 +316,8 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound { entry.totpSecret, Date().time / (1000 * entry.totpPeriod), entry.totpAlgorithm, - entry.digits) + entry.digits + ) } else { // we only want to calculate and show HOTP if the user requests it crypto_copy_otp.setOnClickListener { |