mirror of
https://github.com/Corewala/Buran
synced 2025-01-03 05:34:28 +00:00
Touched up client cert settings
This commit is contained in:
parent
64f3308e1b
commit
93191e67c4
1 changed files with 3 additions and 2 deletions
|
@ -280,6 +280,7 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
|
|
||||||
|
clientCertPassword.dialogTitle = getString(R.string.client_certificate_password)
|
||||||
if (certPassword != null && certPassword.isNotEmpty()) {
|
if (certPassword != null && certPassword.isNotEmpty()) {
|
||||||
clientCertPassword.summary = getDots(certPassword)
|
clientCertPassword.summary = getDots(certPassword)
|
||||||
} else {
|
} else {
|
||||||
|
@ -307,7 +308,7 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
|
||||||
certificateCategory.addPreference(passwordInitVector)
|
certificateCategory.addPreference(passwordInitVector)
|
||||||
|
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P){
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P){
|
||||||
useBiometrics.isVisible = certPassword?.isNotEmpty() ?: false
|
useBiometrics.isVisible = (certPassword?.isNotEmpty() ?: false) or useBiometrics.isChecked
|
||||||
|
|
||||||
useBiometrics.setOnPreferenceChangeListener { _, newValue ->
|
useBiometrics.setOnPreferenceChangeListener { _, newValue ->
|
||||||
val biometricManager = BuranBiometricManager()
|
val biometricManager = BuranBiometricManager()
|
||||||
|
@ -333,7 +334,7 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
|
||||||
val initializationVector = encryptedData.initializationVector
|
val initializationVector = encryptedData.initializationVector
|
||||||
passwordInitVector.text = initializationVector.contentToString()
|
passwordInitVector.text = initializationVector.contentToString()
|
||||||
passwordCiphertext.text = ciphertext.contentToString()
|
passwordCiphertext.text = ciphertext.contentToString()
|
||||||
clientCertPassword.text = "encrypted"
|
clientCertPassword.text = null
|
||||||
}else{
|
}else{
|
||||||
val ciphertext = biometricManager.decodeByteArray(passwordCiphertext.text)
|
val ciphertext = biometricManager.decodeByteArray(passwordCiphertext.text)
|
||||||
clientCertPassword.text = biometricManager.decryptData(ciphertext, result.cryptoObject?.cipher!!)
|
clientCertPassword.text = biometricManager.decryptData(ciphertext, result.cryptoObject?.cipher!!)
|
||||||
|
|
Loading…
Reference in a new issue