Skip to content

Instantly share code, notes, and snippets.

View NoobSolver's full-sized avatar
💪
Learning and Implementing

Gaurav Kumar Mathur NoobSolver

💪
Learning and Implementing
View GitHub Profile
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))
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()
if (ciphertextWrapper != null) {
// user has already enabled biometrics
} else {
// biometrics has not been enabled
}
@NoobSolver
NoobSolver / main.dart
Created March 6, 2020 17:01
Fibonacci sequence
void main() {
var i = 20;
print('fibonacci($i) = ${fibonacci(i)}');
}
int fibonacci(int n) {
return n < 2 ? n : (fibonacci(n - 1) + fibonacci(n - 2));
}