fix: gate passphrase cache behind authenticator availability

Fixes #2783
This commit is contained in:
Harsh Shandilya 2023-11-29 19:39:25 +05:30
parent 9b7175a555
commit 891455d7a7
No known key found for this signature in database
2 changed files with 3 additions and 1 deletions

View file

@ -8,6 +8,7 @@ package app.passwordstore.ui.settings
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import app.passwordstore.R import app.passwordstore.R
import app.passwordstore.ui.pgp.PGPKeyListActivity import app.passwordstore.ui.pgp.PGPKeyListActivity
import app.passwordstore.util.auth.BiometricAuthenticator
import app.passwordstore.util.extensions.launchActivity import app.passwordstore.util.extensions.launchActivity
import app.passwordstore.util.features.Feature import app.passwordstore.util.features.Feature
import app.passwordstore.util.settings.PreferenceKeys import app.passwordstore.util.settings.PreferenceKeys
@ -33,6 +34,7 @@ class PGPSettings(private val activity: FragmentActivity) : SettingsProvider {
persistent = true persistent = true
} }
switch(Feature.EnablePGPPassphraseCache.configKey) { switch(Feature.EnablePGPPassphraseCache.configKey) {
enabled = BiometricAuthenticator.canAuthenticate(activity)
titleRes = R.string.pref_passphrase_cache_title titleRes = R.string.pref_passphrase_cache_title
summaryRes = R.string.pref_passphrase_cache_summary summaryRes = R.string.pref_passphrase_cache_summary
defaultValue = false defaultValue = false

View file

@ -136,7 +136,7 @@
<string name="pref_pgp_key_manager_title">Key manager</string> <string name="pref_pgp_key_manager_title">Key manager</string>
<string name="pref_pgp_ascii_armor_title">Encrypt in ASCII armor mode</string> <string name="pref_pgp_ascii_armor_title">Encrypt in ASCII armor mode</string>
<string name="pref_passphrase_cache_title">Enable passphrase caching</string> <string name="pref_passphrase_cache_title">Enable passphrase caching</string>
<string name="pref_passphrase_cache_summary">WARNING: this feature is functional but very experimental.</string> <string name="pref_passphrase_cache_summary">WARNING: this feature is functional but very experimental. Requires an active screen lock.</string>
<!-- PasswordGenerator fragment --> <!-- PasswordGenerator fragment -->
<string name="pwgen_title">Generate Password</string> <string name="pwgen_title">Generate Password</string>