Trust Boundaries
BioKey divides the authentication system into trusted and untrusted zones:On-Device (Trusted Zone)
Platform Authenticator- Secure enclave or trusted execution environment (TEE)
- Biometric sensor (fingerprint, Face ID, iris)
- Credential private keys stored in hardware
- PRF computation (V2) happens in secure element
- Browser-provided cryptographic primitives
- Mediates access to platform authenticator
- Enforces origin and RP ID binding
- Returns public credential data and PRF outputs
- V2 (PRF): Hardware-backed, never exposed
- V1 (HKDF): Computed in browser via Web Crypto API
- Identity Key stored in
localStorage(orIndexedDB)
Why localStorage is acceptable: The Identity Key is a public key in BioKey’s model. It can be re-derived from biometric authentication, so local storage compromise doesn’t expose the biometric or enable impersonation (the attacker still needs the server challenge).
Server-Side (Untrusted Zone)
The server is explicitly untrusted and stores only:- Public Identity Keys (64-char hex strings)
- User IDs (for account linking)
- Device IDs (for multi-device tracking)
- Challenge nonces (time-limited, single-use)
- Biometric data (never leaves device)
- Credential private keys (stored in device secure element)
- PRF secrets (computed in hardware, never exposed)
- Ability to authenticate without user’s biometric
What BioKey Protects Against
✅ Credential Theft via Server Breach
Traditional password system:✅ Vendor Lock-In
Traditional passkey (FIDO2/WebAuthn):✅ Replay Attacks
BioKey uses challenge-response protocol to prevent replay:- Challenge is already consumed (single-use)
- Challenge expires after 5 minutes
- Challenge tied to specific authentication flow
✅ Cross-Origin Abuse
WebAuthn’s RP ID (Relying Party Identifier) binds credentials to a specific origin:example.com cannot be used on evil.com:
- Browser enforces origin matching
- Credential is origin-bound at creation
- Prevents phishing via credential reuse
Subdomain considerations:
rp.id can be set to a parent domain (e.g., example.com for app.example.com and auth.example.com), allowing credential sharing across subdomains. This must be configured intentionally.What BioKey Does NOT Protect Against
❌ Compromised Device
If the device is rooted/jailbroken or has malware:- Use device attestation (checks device integrity)
- Require biometric re-authentication for sensitive operations
- Implement anomaly detection (unusual IP, device fingerprint changes)
- Revoke compromised device’s public key server-side
❌ PIN Fallback
WebAuthn permits device PIN as a fallback authenticator:| Platform | PIN Fallback Behavior |
|---|---|
| iOS/macOS | Allows passcode after failed biometric attempts |
| Android | Allows PIN/pattern after 5 failed fingerprint attempts |
| Windows Hello | Allows PIN as alternative authentication method |
- Android:
BiometricPromptwithBIOMETRIC_STRONG(blocks PIN) - iOS:
LAContextwithbiometryOnlypolicy
❌ Cross-Sensor Attacks
Different hardware sensors produce different credentials:- User must enroll each device separately
- Lost device requires re-enrollment on new device
- No “bring your biometric to any device” portability
Multi-device accounts: Servers can link multiple Identity Keys to one user account, allowing seamless multi-device access while maintaining device-specific cryptographic isolation.
❌ Biometric Compromise
Biometrics are irrevocable:- High-resolution photo of fingerprint (lifted from surface)
- 3D-printed finger (requires sophisticated attack)
- Deepfake face (for Face ID, requires liveness detection bypass)
- Coerced authentication (physical duress)
- Liveness detection: Platform authenticators implement liveness checks (e.g., Face ID requires attention, fingerprints detect conductivity)
- Multi-finger enrollment: Enroll backup fingers, revoke compromised finger’s credential
- Server-side revocation: Delete public key from server to permanently invalidate compromised identity
- Anomaly detection: Monitor authentication patterns (location, device, time)
- Hybrid authentication: Require additional factor for high-risk operations (email OTP, recovery code)
V2 (PRF) vs V1 (rawId-HKDF) Security Comparison
| Aspect | V2 (PRF) | V1 (rawId-HKDF) |
|---|---|---|
| Secret material | Hardware-backed, never exposed | Derived from observable rawId |
| Attack surface | Secure enclave only | rawId visible in WebAuthn responses |
| Cryptographic strength | ✅ High (hardware PRF) | ⚠️ Medium (depends on rawId entropy) |
| Server observation | ❌ Server never sees PRF output | ⚠️ Server sees rawId during enrollment/auth |
| Recommended usage | Production systems | Fallback only |
rawId. With knowledge of the HKDF parameters (biokey-v1-salt, biokey-identity-seed), they could derive the same Identity Key.
Challenge Security
Challenges prevent replay attacks and ensure real-time authentication:Challenge Properties
| Property | Specification | Security Rationale |
|---|---|---|
| Length | 32 bytes (256 bits) | Prevents brute-force guessing |
| Randomness | crypto.getRandomValues() | Cryptographically secure RNG |
| Single-use | Deleted after first verify | Prevents replay |
| Expiration | 5 minutes | Limits window for MITM attacks |
| Encoding | 64-char hex | URL-safe, easy transmission |
Challenge Flow
Server-Side Challenge Storage
Production considerations: Use Redis or database for distributed systems. Clean up expired challenges periodically to prevent memory leaks.
Data Privacy
What is Stored Where?
| Data | Client (Device) | Server | Notes |
|---|---|---|---|
| Biometric data | ✅ Secure element | ❌ Never | Never leaves device |
| Credential private key | ✅ Secure element | ❌ Never | Hardware-protected |
| PRF output (V2) | ❌ Re-derived | ❌ Never | Computed on-demand |
| Identity Key | ✅ localStorage | ✅ As public key | Can be re-derived |
| Credential ID | ✅ localStorage | ❌ Optional | Needed for authentication |
| User ID | ✅ localStorage | ✅ Yes | Links identity to account |
| Device ID | ✅ Generated | ✅ Yes | Tracks enrolled devices |
| Challenges | ❌ No | ✅ Temporary | Single-use, 5-min TTL |
GDPR & Privacy Compliance
BioKey’s architecture inherently supports privacy regulations: Right to erasure (“right to be forgotten”):- Server stores only public keys (not biometrics, not private keys)
- No PII required (user ID can be pseudonymous)
- No tracking of authentication attempts (optional audit logs)
- Biometric used exclusively for authentication
- Identity Key derived for single purpose (user verification)
- No cross-service tracking (RP ID bound to origin)
Secure Implementation Checklist
When implementing BioKey, ensure:- Always attempt V2 (PRF) first, fall back to V1 only if PRF unsupported
- Verify re-derived key matches stored publicKey before sending challenge to server
- Use HTTPS everywhere — BioKey requires secure context for WebAuthn
- Implement challenge expiration (5 minutes recommended)
- Enforce single-use challenges (delete after first verification)
- Validate RP ID matches your domain (prevents cross-origin abuse)
- Store Identity Key in localStorage (or IndexedDB), not sessionStorage
- Implement public key revocation (delete from server to disable identity)
- Monitor authentication anomalies (unusual IP, device changes, frequency)
- Consider device attestation for high-security applications
- Test on multiple platforms (Android, iOS, macOS, Windows)
- Handle PRF unavailability gracefully (clear fallback UX)
- Document multi-device enrollment for users
- Implement account recovery (email OTP, recovery codes for device loss)
Threat Model Summary
| Threat | Protected? | Mitigation |
|---|---|---|
| Server breach | ✅ Yes | Only public keys stored |
| Replay attack | ✅ Yes | Single-use, time-limited challenges |
| Vendor lock-in | ✅ Yes | Deterministic client-side derivation |
| Cross-origin abuse | ✅ Yes | WebAuthn RP ID binding |
| MITM attack | ✅ Yes | HTTPS + key verification |
| Device compromise | ❌ No | Assume trusted device + secure element |
| PIN fallback | ❌ No | OS controls fallback behavior |
| Biometric compromise | ❌ No | Irrevocable + liveness detection |
| Physical coercion | ❌ No | Out of scope for cryptographic protocol |
Next Steps
Protocol Specification
Full technical specification of the BioKey protocol
Quick Start
Implement BioKey in your application