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 onResume() { | |
super.onResume() | |
if (ciphertextWrapper != null) { | |
if (SampleAppUser.fakeToken == null) { | |
showBiometricPromptForDecryption() | |
} else { | |
// The user has already logged in, so proceed to the rest of the app | |
// this is a todo for you, the developer | |
updateApp(getString(R.string.already_signedin)) |
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
binding.useBiometrics.setOnClickListener { | |
showBiometricPromptForEncryption() | |
} | |
.... | |
private fun showBiometricPromptForEncryption() { | |
val canAuthenticate = BiometricManager.from(applicationContext).canAuthenticate() | |
if (canAuthenticate == BiometricManager.BIOMETRIC_SUCCESS) { | |
val secretKeyName = SECRET_KEY_NAME | |
cryptographyManager = CryptographyManager() |
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
if (ciphertextWrapper != null) { | |
// user has already enabled biometrics | |
} else { | |
// biometrics has not been enabled | |
} |
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
void main() { | |
var i = 20; | |
print('fibonacci($i) = ${fibonacci(i)}'); | |
} | |
int fibonacci(int n) { | |
return n < 2 ? n : (fibonacci(n - 1) + fibonacci(n - 2)); | |
} |