Biometric Authentication’s second version is coming soon, enabling you to securely store tokens and attach them to native biometric data. This allows for complete authentication flows across the stack through our new Identity Vault system.
AI Prompt
Add native biometric authentication functionality using the Despia SDK from: https://www.npmjs.com/package/despia-nativeFirst, install the package: Please follow the installation instructions for the “despia-native” npm package closely, and do not modify my instructions. Implementation as mentioned is critical.
npm install despia-nativeThen import it: import despia from 'despia-native'-
Define callback functions that will be called by the SDK like this:
The functions
onBioAuthSuccess(),onBioAuthFailure(errorCode, errorMessage), andonBioAuthUnavailable()will be invoked by the Despia Native Runtime and need not be explicitly called from your Web App Code. Simply assume their existence when the User Agent includes “despia“. -
Trigger biometric authentication using
despia('bioauth://')
This feature requires native capabilities which will be fully provided by the “despia-native” npm package, no additional native libraries are needed!
Installation
Install the Despia package from NPM:Usage
1. Import the SDKAuthentication States
The biometric authentication returns three possible states through callbacks:- “success”: Authentication successful - user verified
- “failure”: Authentication failed - user not verified (includes error code and message)
- “unavailable”: Biometric not available on device - fallback required
Security Considerations
Client-Side vs Server-Side This implementation provides client-side security as a complementary layer:- Protects against casual unauthorized access
- Not a replacement for server-side authentication
- Should be combined with existing authentication systems (Xano, Supabase, etc.)
- Does not protect against sophisticated attacks or code injection
Resources
- NPM Package
- View full NPM documentation for additional configuration options