1
0
Fork 0
mirror of https://github.com/Corewala/Buran synced 2024-12-22 07:42:43 +00:00

Make biometric unlock only required once per session

This commit is contained in:
Corewala 2022-05-17 18:37:11 -04:00
parent e46ea379c3
commit a519a522cf

View file

@ -80,6 +80,8 @@ class GemActivity : AppCompatActivity() {
override fun openExternal(address: String) = openExternalLink(address) override fun openExternal(address: String) = openExternalLink(address)
}) })
private var decryptedCertPassword: String? = null
private var internetStatus: Boolean = false private var internetStatus: Boolean = false
private var initialised: Boolean = false private var initialised: Boolean = false
@ -418,14 +420,14 @@ class GemActivity : AppCompatActivity() {
if(prefs.getBoolean(Buran.PREF_KEY_CLIENT_CERT_ACTIVE, false)){ if(prefs.getBoolean(Buran.PREF_KEY_CLIENT_CERT_ACTIVE, false)){
builder builder
.setPositiveButton(getString(R.string.use_client_certificate).toUpperCase()) { _, _ -> .setPositiveButton(getString(R.string.use_client_certificate).toUpperCase()) { _, _ ->
if(prefs.getBoolean("use_biometrics", false)){ if(prefs.getBoolean("use_biometrics", false) and !decryptedCertPassword.isNullOrEmpty()){
biometricSecureRequest(state.uri.toString()) biometricSecureRequest(state.uri.toString())
}else{ }else{
model.request( model.request(
state.uri.toString(), state.uri.toString(),
prefs.getString( prefs.getString(
Buran.PREF_KEY_CLIENT_CERT_PASSWORD, Buran.PREF_KEY_CLIENT_CERT_PASSWORD,
null decryptedCertPassword
) )
) )
} }
@ -546,8 +548,9 @@ class GemActivity : AppCompatActivity() {
)!! )!!
) )
val certPassword = biometricManager.decryptData(ciphertext, result.cryptoObject?.cipher!!) decryptedCertPassword = biometricManager.decryptData(ciphertext, result.cryptoObject?.cipher!!)
model.request(address, certPassword)
model.request(address, decryptedCertPassword)
} }
} }