summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/UserPreference.kt11
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillStrategyDsl.kt3
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/autofill/oreo/FeatureAndTrustDetection.kt10
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/autofill/oreo/FormField.kt46
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/autofill/oreo/OreoAutofillService.kt2
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt3
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/config/SshjConfig.kt12
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/pwgen/RandomPasswordGenerator.kt3
8 files changed, 54 insertions, 36 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt
index e2cde88e..8938df00 100644
--- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt
@@ -95,8 +95,11 @@ class UserPreference : AppCompatActivity() {
if (!PasswordRepository.isGitRepo()) {
listOfNotNull(
- gitServerPreference, gitConfigPreference, sshKeyPreference,
- viewSshKeyPreference, clearSavedPassPreference
+ gitServerPreference,
+ gitConfigPreference,
+ sshKeyPreference,
+ viewSshKeyPreference,
+ clearSavedPassPreference,
).forEach {
it.parent?.removePreference(it)
}
@@ -119,12 +122,12 @@ class UserPreference : AppCompatActivity() {
autoFillAppsPreference,
autoFillDefaultPreference,
autoFillAlwaysShowDialogPreference,
- autoFillShowFullNamePreference
+ autoFillShowFullNamePreference,
)
oreoAutofillDependencies = listOfNotNull(
oreoAutofillDirectoryStructurePreference,
oreoAutofillDefaultUsername,
- oreoAutofillCustomPublixSuffixes
+ oreoAutofillCustomPublixSuffixes,
)
oreoAutofillCustomPublixSuffixes?.apply {
setOnBindEditTextListener {
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillStrategyDsl.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillStrategyDsl.kt
index ec333bec..cae84d54 100644
--- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillStrategyDsl.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillStrategyDsl.kt
@@ -232,7 +232,8 @@ class AutofillRule private constructor(
fun genericPassword(optional: Boolean = false, block: FieldMatcher.Builder.() -> Unit) {
require(matchers.none {
it.type in listOf(
- FillableFieldType.CurrentPassword, FillableFieldType.NewPassword
+ FillableFieldType.CurrentPassword,
+ FillableFieldType.NewPassword,
)
}) { "Every rule block can only have either genericPassword or {current,new}Password blocks" }
matchers.add(
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/FeatureAndTrustDetection.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/FeatureAndTrustDetection.kt
index 8864f877..5c8b6b3b 100644
--- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/FeatureAndTrustDetection.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/FeatureAndTrustDetection.kt
@@ -74,7 +74,7 @@ private val TRUSTED_BROWSER_CERTIFICATE_HASH = mapOf(
"org.mozilla.firefox_beta" to "p4tipRZbRJSy/q2edqKA0i2Tf+5iUa7OWZRGsuoxmwQ=",
"org.mozilla.focus" to "YgOkc7421k7jf4f6UA7bx56rkwYQq5ufpMp9XB8bT/w=",
"org.mozilla.klar" to "YgOkc7421k7jf4f6UA7bx56rkwYQq5ufpMp9XB8bT/w=",
- "org.torproject.torbrowser" to "IAYfBF5zfGc3XBd5TP7bQ2oDzsa6y3y5+WZCIFyizsg="
+ "org.torproject.torbrowser" to "IAYfBF5zfGc3XBd5TP7bQ2oDzsa6y3y5+WZCIFyizsg=",
)
private fun isTrustedBrowser(context: Context, appPackage: String): Boolean {
@@ -112,7 +112,7 @@ private val BROWSER_MULTI_ORIGIN_METHOD = mapOf(
"org.mozilla.firefox_beta" to BrowserMultiOriginMethod.WebView,
"org.mozilla.focus" to BrowserMultiOriginMethod.Field,
"org.mozilla.klar" to BrowserMultiOriginMethod.Field,
- "org.torproject.torbrowser" to BrowserMultiOriginMethod.WebView
+ "org.torproject.torbrowser" to BrowserMultiOriginMethod.WebView,
)
private fun getBrowserMultiOriginMethod(appPackage: String): BrowserMultiOriginMethod =
@@ -135,7 +135,7 @@ private val BROWSER_SAVE_FLAG = mapOf(
"org.mozilla.fennec_aurora" to 0,
"com.opera.mini.native" to 0,
"com.opera.mini.native.beta" to 0,
- "com.opera.touch" to 0
+ "com.opera.touch" to 0,
)
@RequiresApi(Build.VERSION_CODES.O)
@@ -162,7 +162,7 @@ private val FLAKY_BROWSERS = listOf(
"com.android.chrome",
"com.chrome.beta",
"com.chrome.canary",
- "com.chrome.dev"
+ "com.chrome.dev",
)
enum class BrowserAutofillSupportLevel {
@@ -170,7 +170,7 @@ enum class BrowserAutofillSupportLevel {
FlakyFill,
PasswordFill,
GeneralFill,
- GeneralFillAndSave
+ GeneralFillAndSave,
}
@RequiresApi(Build.VERSION_CODES.O)
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/FormField.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/FormField.kt
index 0d89624e..b78624e1 100644
--- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/FormField.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/FormField.kt
@@ -33,19 +33,19 @@ class FormField(
private val HINTS_USERNAME = listOf(
HintConstants.AUTOFILL_HINT_USERNAME,
- HintConstants.AUTOFILL_HINT_NEW_USERNAME
+ HintConstants.AUTOFILL_HINT_NEW_USERNAME,
)
private val HINTS_NEW_PASSWORD = listOf(
- HintConstants.AUTOFILL_HINT_NEW_PASSWORD
+ HintConstants.AUTOFILL_HINT_NEW_PASSWORD,
)
private val HINTS_PASSWORD = HINTS_NEW_PASSWORD + listOf(
- HintConstants.AUTOFILL_HINT_PASSWORD
+ HintConstants.AUTOFILL_HINT_PASSWORD,
)
private val HINTS_OTP = listOf(
- HintConstants.AUTOFILL_HINT_SMS_OTP
+ HintConstants.AUTOFILL_HINT_SMS_OTP,
)
@Suppress("DEPRECATION")
@@ -54,7 +54,7 @@ class FormField(
HintConstants.AUTOFILL_HINT_NAME,
HintConstants.AUTOFILL_HINT_PERSON_NAME,
HintConstants.AUTOFILL_HINT_PHONE,
- HintConstants.AUTOFILL_HINT_PHONE_NUMBER
+ HintConstants.AUTOFILL_HINT_PHONE_NUMBER,
)
private val ANDROID_TEXT_FIELD_CLASS_NAMES = listOf(
@@ -62,7 +62,7 @@ class FormField(
"android.widget.AutoCompleteTextView",
"androidx.appcompat.widget.AppCompatEditText",
"android.support.v7.widget.AppCompatEditText",
- "com.google.android.material.textfield.TextInputEditText"
+ "com.google.android.material.textfield.TextInputEditText",
)
private const val ANDROID_WEB_VIEW_CLASS_NAME = "android.webkit.WebView"
@@ -75,15 +75,24 @@ class FormField(
InputType.TYPE_CLASS_TEXT -> typeVariation in listOf(
InputType.TYPE_TEXT_VARIATION_PASSWORD,
InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD,
- InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD
+ InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD,
)
else -> false
}
}
- private val HTML_INPUT_FIELD_TYPES_USERNAME = listOf("email", "tel", "text")
- private val HTML_INPUT_FIELD_TYPES_PASSWORD = listOf("password")
- private val HTML_INPUT_FIELD_TYPES_OTP = listOf("tel", "text")
+ private val HTML_INPUT_FIELD_TYPES_USERNAME = listOf(
+ "email",
+ "tel",
+ "text",
+ )
+ private val HTML_INPUT_FIELD_TYPES_PASSWORD = listOf(
+ "password",
+ )
+ private val HTML_INPUT_FIELD_TYPES_OTP = listOf(
+ "tel",
+ "text",
+ )
private val HTML_INPUT_FIELD_TYPES_FILLABLE =
(HTML_INPUT_FIELD_TYPES_USERNAME + HTML_INPUT_FIELD_TYPES_PASSWORD + HTML_INPUT_FIELD_TYPES_OTP).toSet().toList()
@@ -95,20 +104,27 @@ class FormField(
"url_field", // Opera address bar
"location_bar_edit_text", // Samsung address bar
"search", "find", "captcha",
- "postal" // Prevent postal code fields from being mistaken for OTP fields
+ "postal", // Prevent postal code fields from being mistaken for OTP fields
)
private val PASSWORD_HEURISTIC_TERMS = listOf(
- "pass", "pswd", "pwd"
+ "pass",
+ "pswd",
+ "pwd",
)
private val USERNAME_HEURISTIC_TERMS = listOf(
- "alias", "e-mail", "email", "login", "user"
+ "alias",
+ "e-mail",
+ "email",
+ "login",
+ "user",
)
private val OTP_HEURISTIC_TERMS = listOf(
- "einmal", "otp"
+ "einmal",
+ "otp",
)
private val OTP_WEAK_HEURISTIC_TERMS = listOf(
- "code"
+ "code",
)
}
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/OreoAutofillService.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/OreoAutofillService.kt
index b6404c6e..fd2997d8 100644
--- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/OreoAutofillService.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/OreoAutofillService.kt
@@ -33,7 +33,7 @@ class OreoAutofillService : AutofillService() {
"com.android.settings.intelligence",
"com.android.systemui",
"com.oneplus.applocker",
- "org.sufficientlysecure.keychain"
+ "org.sufficientlysecure.keychain",
)
private const val DISABLE_AUTOFILL_DURATION_MS = 1000 * 60 * 60 * 24L
diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt
index 12d24758..a05da554 100644
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt
@@ -11,7 +11,6 @@ import android.text.InputType
import android.view.Menu
import android.view.MenuItem
import android.view.View
-import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.IntentSenderRequest
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
import androidx.activity.result.contract.ActivityResultContracts.StartIntentSenderForResult
@@ -59,7 +58,7 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
private var oldCategory: String? = null
private var copy: Boolean = false
- private val userInteractionRequiredResult: ActivityResultLauncher<IntentSenderRequest> = registerForActivityResult(StartIntentSenderForResult()) { result ->
+ private val userInteractionRequiredResult = registerForActivityResult(StartIntentSenderForResult()) { result ->
if (result.data == null) {
setResult(RESULT_CANCELED, null)
finish()
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/config/SshjConfig.kt b/app/src/main/java/com/zeapo/pwdstore/git/config/SshjConfig.kt
index 7ba246be..1ea0359c 100644
--- a/app/src/main/java/com/zeapo/pwdstore/git/config/SshjConfig.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/git/config/SshjConfig.kt
@@ -217,7 +217,7 @@ class SshjConfig : ConfigImpl() {
ECDHNistP.Factory521(),
ECDHNistP.Factory384(),
ECDHNistP.Factory256(),
- DHGexSHA256.Factory()
+ DHGexSHA256.Factory(),
)
}
@@ -228,7 +228,7 @@ class SshjConfig : ConfigImpl() {
SignatureECDSA.Factory384(),
SignatureECDSA.Factory521(),
SignatureRSA.Factory(),
- FactoryCERT()
+ FactoryCERT(),
)
}
@@ -242,7 +242,7 @@ class SshjConfig : ConfigImpl() {
PKCS8KeyFile.Factory(),
PKCS5KeyFile.Factory(),
OpenSSHKeyFile.Factory(),
- PuTTYKeyFile.Factory()
+ PuTTYKeyFile.Factory(),
)
}
@@ -251,7 +251,7 @@ class SshjConfig : ConfigImpl() {
cipherFactories = listOf(
BlockCiphers.AES128CTR(),
BlockCiphers.AES192CTR(),
- BlockCiphers.AES256CTR()
+ BlockCiphers.AES256CTR(),
)
}
@@ -260,13 +260,13 @@ class SshjConfig : ConfigImpl() {
Macs.HMACSHA2256(),
Macs.HMACSHA2256Etm(),
Macs.HMACSHA2512(),
- Macs.HMACSHA2512Etm()
+ Macs.HMACSHA2512Etm(),
)
}
private fun initCompressionFactories() {
compressionFactories = listOf(
- NoneCompression.Factory()
+ NoneCompression.Factory(),
)
}
}
diff --git a/app/src/main/java/com/zeapo/pwdstore/pwgen/RandomPasswordGenerator.kt b/app/src/main/java/com/zeapo/pwdstore/pwgen/RandomPasswordGenerator.kt
index e841ed76..67d8fc40 100644
--- a/app/src/main/java/com/zeapo/pwdstore/pwgen/RandomPasswordGenerator.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/pwgen/RandomPasswordGenerator.kt
@@ -22,14 +22,13 @@ object RandomPasswordGenerator {
* set, the password will not contain any symbols.
* - [PasswordGenerator.NO_AMBIGUOUS]: If set, the password will not contain any ambiguous
* characters.
- * - [PasswordGenerator.NO_VOWELS]: If set, the password will not contain any vowels.
*/
fun generate(targetLength: Int, pwFlags: Int): String? {
val bank = listOfNotNull(
PasswordGenerator.DIGITS_STR.takeIf { pwFlags hasFlag PasswordGenerator.DIGITS },
PasswordGenerator.UPPERS_STR.takeIf { pwFlags hasFlag PasswordGenerator.UPPERS },
PasswordGenerator.LOWERS_STR.takeIf { pwFlags hasFlag PasswordGenerator.LOWERS },
- PasswordGenerator.SYMBOLS_STR.takeIf { pwFlags hasFlag PasswordGenerator.SYMBOLS }
+ PasswordGenerator.SYMBOLS_STR.takeIf { pwFlags hasFlag PasswordGenerator.SYMBOLS },
).joinToString("")
var password = ""