KSafe 2.2.1 is out, and biometrics just became tru...
# feed
i
KSafe 2.2.1 is out, and biometrics just became truly multiplatform. One API. Real biometric prompts. Every platform: Before version 2.2.1: Android: BiometricPrompt (fingerprint / face) iOS & macOS: Face ID / Touch ID At 2.2.1 you also get: 🆕 JVM Desktop: Touch ID on macOS, Windows Hello on Windows (x64 & ARM64) 🆕 Web (JS/WasmJS): the browser's WebAuthn platform authenticator Until now, "multiplatform biometrics" meant mobile... desktop and web silently passed through. From 2.2.1 they show the operating system's real authentication prompt, from the same common code, including session caching, so your user isn't re-prompted on every tap:
Copy code
// Device supports biometrics?
KSafeBiometrics.biometricsAvailableDirect(allowDeviceCredentialFallback = true) { available ->
    // if biometrics available on device
    if (available) {
        // Request biometric approval with 60second cooldown (don't request again for 60 seconds)
        KSafeBiometrics.verifyBiometricDirect(
            reason = "Confirm payment",
            authorizationDuration = BiometricAuthorizationDuration(60_000L)
        ) { success ->
            // If success is true -> approved biometrics! Complete the payment
            if (success) completePayment()
        }
    } else {
        println("DEBUG: biometrics not available")
    }
}
Also new:
biometricsAvailable()
tells you up front whether a real prompt exists on this device, so you can route to your own fallback flow. Strict biometrics-only mode and zero DI setup included. It's a standalone artifact: you can gate any action with it, even without using KSafe storage! 📦
implementation("eu.anifantakis:ksafe-biometrics:2.2.1")
github.com/ioannisa/KSafe
K 11
🤩 7