bioauth-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i bioauth-sdk

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

14.5 kB

Total Files

8

Last publish

Collaborators

  • justinsheare