kmp-biometric-auth

Implements biometric authentication for Kotlin Multiplatform using BiometricPrompt and LocalAuthentication.

2|Updated Jun 6, 2026
One-click install
npx skills add https://github.com/ronjunevaldoz/kmp-agent-skills --skill kmp-biometric-auth-ronjunevaldoz
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: kmp-biometric-auth
Source: https://github.com/ronjunevaldoz/kmp-agent-skills/tree/main/skills/kmp-biometric-auth
Command: npx skills add https://github.com/ronjunevaldoz/kmp-agent-skills --skill kmp-biometric-auth-ronjunevaldoz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding fingerprint or Face ID authentication to a Kotlin Multiplatform app normally requires writing platform-specific code twice and leaking Android or iOS APIs into shared ViewModels. This Skill provides a complete pattern for isolating biometric logic behind an expect/actual abstraction with a sealed result type. ## Core Features & Use Cases - Shared BiometricResult type: A sealed class in commonMain covering Success, Cancelled, Fallback, Error, NotAvailable, and NotEnrolled states. - expect/actual BiometricAuthenticator: Android implementation using BiometricPrompt with BiometricManager capability checks, and iOS implementation using LAContext.evaluatePolicy bridged via suspendCoroutine. - Graceful fallback: Supports device PIN/password fallback when biometrics are unavailable or not enrolled, with strong vs weak biometric strength selection. - Use Case: Protect a payment confirmation screen — the ViewModel calls canAuthenticate(), triggers the prompt, and handles every result state without importing any platform API. ## Quick Start Add biometric authentication to my KMP app so users confirm sensitive actions with fingerprint or Face ID, falling back to device PIN when biometrics are unavailable.

Frequently Asked Questions about kmp-biometric-auth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add biometric authentication to a Kotlin Multiplatform app?▼

Define a sealed BiometricResult type in commonMain and an expect/actual BiometricAuthenticator with canAuthenticate and authenticate methods. Android uses BiometricPrompt with BiometricManager; iOS uses LAContext.evaluatePolicy bridged through suspendCoroutine.

How to use BiometricPrompt with device credential fallback on Android?▼

Combine BIOMETRIC_STRONG with DEVICE_CREDENTIAL in setAllowedAuthenticators on the PromptInfo builder. Check availability first with BiometricManager.canAuthenticate, and omit the negative button when device credentials are allowed.

Does LAContext evaluatePolicy work with Kotlin Multiplatform?▼

Yes, LAContext is callable from iosMain via Kotlin/Native interop. Wrap evaluatePolicy in suspendCoroutine to convert its callback into a suspending function, and map LAError codes like LAErrorUserCancel and LAErrorBiometryNotEnrolled to your result type.

Why does the biometric prompt show nothing on some devices?▼

This happens when canAuthenticate is not checked before showing the prompt and the device has no enrolled biometrics. Always verify capability first and show a clear message directing users to device settings for the NotEnrolled case.

When should I use weak vs strong biometric strength?▼

Use BiometricStrength.Strong for security-sensitive actions like payments or credential access, since class 2 weak biometrics such as low-end face unlock are not considered secure. Weak strength is acceptable only for low-risk convenience gating.