Quick Start
Create a simple biometric login interface using pure JavaScript. This example uses the lower-levelbiokey-core library for maximum control.
Installation
Complete Example
Here’s a full implementation with enrollment and authentication:How It Works
1. Enrollment Flow
When a user enrolls:- Generate a random challenge and user ID
- Call
navigator.credentials.create()to create a platform authenticator credential - User authenticates with their fingerprint/Face ID
- Derive a deterministic identity key from the credential’s
rawIdusing HKDF - Store the credential ID and public key in localStorage
2. Authentication Flow
When a user authenticates:- Retrieve the stored credential ID from localStorage
- Generate a new challenge
- Call
navigator.credentials.get()with the credential ID - User authenticates with their biometric
- Verify the authentication succeeded
3. Key Derivation
The identity key is derived using HKDF (HMAC-based Key Derivation Function):Running the Example
Using Vite (Recommended)
Using Python
Using Node.js
Important: WebAuthn requires HTTPS or localhost. Make sure you’re testing on
localhost or a secure origin.Browser Compatibility
This example uses the WebAuthn API with platform authenticators:- Chrome/Edge 87+
- Safari 14+
- Firefox 60+
- Touch ID (macOS)
- Face ID (iOS/iPadOS)
- Windows Hello (Windows)
- Fingerprint sensor (Android)
Next Steps
React Example
See how to integrate BioKey with React using hooks
Full-Stack Example
Build a complete client-server authentication system