Package Exports
- bioauth-sdk
- bioauth-sdk/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bioauth-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
BioAuth SDK
The BioAuth SDK provides a simple interface for integrating biometric authentication into your applications.
Installation
Using npm
npm install bioauth-sdk
Then import in your project:
import BioAuthSDK from '@/sdk';
Initialization
Initialize the SDK with your API key:
const auth = new BioAuthSDK({
apiKey: 'YOUR_API_KEY',
baseURL: 'https://api.bioauth.com/v1' // Optional, defaults to production
});
Core Functionality
Biometric Verification
Verify a user's biometric data:
const result = await auth.verifyBiometric({
faceImage: 'base64-encoded-image',
voiceSample: 'base64-encoded-audio',
userId: 'user-123'
});
API Key Management
Create, list, and revoke API keys:
// Create a new API key
const newKey = await auth.createApiKey('My New Key');
// List API keys
const keys = await auth.listApiKeys(limit, offset);
// Revoke an API key
await auth.revokeApiKey('key-id');
Error Handling
All methods throw errors that can be caught with try/catch:
try {
await auth.verifyBiometric(...);
} catch (error) {
console.error('Verification failed:', error);
}
TypeScript Support
The SDK is fully typed with TypeScript definitions included.
Example Usage
import BioAuthSDK from '@/sdk';
async function main() {
const auth = new BioAuthSDK({
apiKey: 'YOUR_API_KEY'
});
try {
// Verify biometrics
const verificationResult = await auth.verifyBiometric({
faceImage: 'base64-encoded-image',
voiceSample: 'base64-encoded-audio',
userId: 'user-123'
});
// Create API key
const newApiKey = await auth.createApiKey('My New Key');
console.log('Verification Result:', verificationResult);
console.log('New API Key:', newApiKey);
} catch (error) {
console.error('Error:', error);
}
}
main();
License
MIT