Overview
TheBioKeyClient class provides a high-level interface for implementing WebAuthn-based biometric authentication in web applications. It handles credential creation, authentication, and identity management using platform authenticators (Face ID, Touch ID, Windows Hello, etc.).
Constructor
Options
Relying Party identifier. Must match your domain (e.g.,
"example.com").The rpId determines which domain credentials are bound to. It should be set to your root domain or a subdomain. WebAuthn credentials created with one rpId cannot be used with a different one.Human-readable name for your application.This name is displayed to users during biometric prompts and credential management. Choose a name that clearly identifies your application.
Optional backend server URL for server-side verification.When provided, the client will communicate with your backend server to:
- Register enrolled credentials during
enroll() - Fetch server-generated challenges during
authenticate() - Verify authentication results server-side
null for client-only authentication (no backend required).Usage Examples
Client-Only Authentication
Server-Backed Authentication
With Custom Domain
Storage Key
The client automatically generates a storage key for persisting identity information inlocalStorage:
getIdentity() and clearIdentity() methods to manage stored credentials.
Notes
- The
rpIdmust be a valid domain that matches or is a registrable suffix of the current origin - Credentials created with one
rpIdcannot be used with a differentrpId - The
serverUrlendpoints should implement the BioKey server protocol (see Server API documentation) - Identity data is stored in
localStorageand persists across browser sessions