Skip to content

Instantly share code, notes, and snippets.

View julianfalcionelli's full-sized avatar
🐉
Turning coffee into code

Julian Falcionelli julianfalcionelli

🐉
Turning coffee into code
View GitHub Profile
@juancruzgs
juancruzgs / !BiometricsManagerImpl.kt
Last active April 11, 2021 15:00
BiometricsPrompt full implementation
class BiometricsManagerImpl : BiometricsManager {
private val executor = MainThreadExecutor()
override fun authenticate(activity: FragmentActivity): Completable {
return Completable.create { emitter ->
val prompt = BiometricPrompt(
activity,
executor,
object : BiometricPrompt.AuthenticationCallback() {
@Diederikjh
Diederikjh / Cryptography.java
Last active May 24, 2024 04:08
Single class that handles encryption and decryption with keys using the Android `Keystore` API. Mostly inspired by this [blog post](https://medium.com/@ericfu/securely-storing-secrets-in-an-android-application-501f030ae5a3). This was tested with API 18 and 25 level emulator (and a level 23 device).
package com.example.yourapp;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.security.KeyPairGeneratorSpec;
import android.security.keystore.KeyGenParameterSpec;
import android.security.keystore.KeyProperties;
import android.support.annotation.RequiresApi;
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';