aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-05-10 19:21:39 +0530
committerGitHub <noreply@github.com>2020-05-10 19:21:39 +0530
commit041cf00510a75042223d1857660fc7f1dff958ef (patch)
tree1b56e67e2b71afe23ac51b680b62ad778272f162 /app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt
parent94dc92f8d70870b57a7f8c4fe8adef152c1211ce (diff)
downloadHardenedPass-041cf00510a75042223d1857660fc7f1dff958ef.tar.gz
HardenedPass-041cf00510a75042223d1857660fc7f1dff958ef.zip
Treewide codestyle cleanup (#765)
- Updated gitignore and checked in the IDE's codestyle config - Removed spotless as the underlying ktlint backend has failed to resolve the super frustrating import order bug[1] in nearly a year - Reformat the entire codebase based on the previously committed code style configuration. 1: https://github.com/pinterest/ktlint/issues/527
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt27
1 files changed, 14 insertions, 13 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt b/app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt
index fa1055f1..b7670742 100644
--- a/app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt
@@ -14,6 +14,7 @@ import java.io.UnsupportedEncodingException
* A single entry in password store.
*/
class PasswordEntry(private val content: String) {
+
val password: String
val username: String?
val digits: String
@@ -109,8 +110,8 @@ class PasswordEntry(private val content: String) {
private fun findOtpDigits(decryptedContent: String): String {
decryptedContent.split("\n".toRegex()).forEach { line ->
if ((line.startsWith("otpauth://totp/") ||
- line.startsWith("otpauth://hotp/")) &&
- Uri.parse(line).getQueryParameter("digits") != null) {
+ line.startsWith("otpauth://hotp/")) &&
+ Uri.parse(line).getQueryParameter("digits") != null) {
return Uri.parse(line).getQueryParameter("digits")!!
}
}
@@ -120,7 +121,7 @@ class PasswordEntry(private val content: String) {
private fun findTotpPeriod(decryptedContent: String): Long {
decryptedContent.split("\n".toRegex()).forEach { line ->
if (line.startsWith("otpauth://totp/") &&
- Uri.parse(line).getQueryParameter("period") != null) {
+ Uri.parse(line).getQueryParameter("period") != null) {
return java.lang.Long.parseLong(Uri.parse(line).getQueryParameter("period")!!)
}
}
@@ -130,7 +131,7 @@ class PasswordEntry(private val content: String) {
private fun findTotpAlgorithm(decryptedContent: String): String {
decryptedContent.split("\n".toRegex()).forEach { line ->
if (line.startsWith("otpauth://totp/") &&
- Uri.parse(line).getQueryParameter("algorithm") != null) {
+ Uri.parse(line).getQueryParameter("algorithm") != null) {
return Uri.parse(line).getQueryParameter("algorithm")!!
}
}
@@ -166,15 +167,15 @@ class PasswordEntry(private val content: String) {
companion object {
@VisibleForTesting(otherwise = PRIVATE)
val USERNAME_FIELDS = arrayOf(
- "login:",
- "username:",
- "user:",
- "account:",
- "email:",
- "name:",
- "handle:",
- "id:",
- "identity:"
+ "login:",
+ "username:",
+ "user:",
+ "account:",
+ "email:",
+ "name:",
+ "handle:",
+ "id:",
+ "identity:"
)
}
}