minor spelling mistake fix

This commit is contained in:
Dan Ho 2019-03-15 22:49:14 +08:00
parent f5139320db
commit 9137dadcbd
2 changed files with 9 additions and 6 deletions

View file

@ -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"
}

View file

@ -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 {