Skip to content

Instantly share code, notes, and snippets.

Avatar
💪
Learning and Implementing

Gaurav Kumar Mathur NoobSolver

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