- Static sites and single-page applications
- Progressive Web Apps (PWAs)
- Electron/Tauri desktop apps
- Browser extensions
- Prototypes and demos
How It Works
In offline mode:- Credentials are stored locally in
localStorage - Authentication happens entirely in the browser using WebAuthn
- No network requests are made
- Each device maintains its own credential
Quick Start
Simply omit theserverUrl parameter:
Complete Example
Here’s a fully functional offline authentication app:React Offline Example
Storage Details
What’s Stored
BioKey stores the following inlocalStorage:
biokey:${rpId}
Example: biokey:example.com
Access Storage Directly
Device Fingerprinting
BioKey generates a stable device ID based on:- User agent string
- Browser language
- Screen dimensions
- Timezone
Use Cases
1. Static Site Authentication
Add authentication to a GitHub Pages site:2. Progressive Web App
PWA with offline authentication:3. Browser Extension
Secure extension settings:4. Electron App
Desktop app authentication:Limitations
No Multi-Device Sync
Credentials are device-specific. Users must enroll on each device separately. Solution: Use server mode if you need multi-device support.No User Association
Without a server, there’s no way to link credentials to specific users. Solution: Store additional user data separately inlocalStorage or IndexedDB.
Browser Data Clearing
Clearing browser data removes credentials. Solution:- Warn users before clearing data
- Provide easy re-enrollment
- Use IndexedDB for more persistent storage:
No Challenge Validation
Without a server, challenges aren’t validated against previous requests. Impact: Low security risk since authentication still requires biometric verification.Combining Offline and Server Modes
You can switch between modes:Best Practices
- Clear messaging - Tell users their credentials are device-specific
- Easy re-enrollment - Make it simple to enroll again if credentials are lost
- Graceful degradation - Provide fallback authentication methods
- Export option - Let users export their public key for backup
- Security notice - Remind users that offline mode has no server-side validation
Migration to Server Mode
To migrate from offline to server mode:Next Steps
Browser SDK
Learn about all SDK features
React Integration
Use with React applications
Server Setup
Add multi-device sync with a server
Examples
See more code examples