This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onAuthenticationError(errorCode: Int, errString: CharSequence?) { | |
//scanning completed with unknown error | |
} | |
override fun onAuthenticationSucceeded(result: FingerprintManager.AuthenticationResult?) { | |
//scanning was successful and has match with one of registered on the device fingerprints | |
} | |
override fun onAuthenticationHelp(helpCode: Int, helpString: CharSequence?) { | |
//case when scanning was failed because of known reason (limit of scan attempts or dirt on the scanner's sensor). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val fmanager = FingerprintManagerCompat.from(getApplicationContext()) | |
fmanager.authenticate(cryptoObject, 0, cancellationSignal, authenticationCallback, null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Decryptor(private val storage: SharedPreferences) { | |
private val ANDROID_KEY_STORE = "AndroidKeyStore" | |
private val TRANSFORMATION = "AES/GCM/NoPadding" | |
private var keyStore: KeyStore? = null | |
init { | |
initKeyStore() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Encryptor(private val sharedPreferences: SharedPreferences) { | |
private val ANDROID_KEY_STORE = "AndroidKeyStore" | |
private var initVector: ByteArray? = null | |
private var encryption: ByteArray? = null | |
private val TRANSFORMATION = "AES/GCM/NoPadding" | |
@Throws(Exception::class) | |
fun encryptTextWithAES(alias: String, textToEncrypt: String): ByteArray? { | |
var alias = alias |