faceverify-sdk-node
v1.1.0
Published
SDK for interacting with FaceVerify.io API using Node.js
Downloads
13
Maintainers
Readme
Faceverify.io Node.js SDK
Faceverify.io provides a powerful identity verification solution for your applications. This SDK enables easy integration with the Faceverify.io service using Node.js. Whether you're building server-side applications or need backend verification for users, this SDK has you covered.
Table of Contents
Requirements
- Node.js 14.x or higher
- For Typescript users: Typescript 4.8 or higher
Installation
Using npm:
npm install faceverify-sdk-node
Using yarn:
yarn add faceverify-sdk-node
Using pnpm:
pnpm add faceverify-sdk-node
Getting Started
To get started with Faceverify, you'll need an account on Faceverify.io and obtain your API key and Secret Key. You can get these by logging into your account, navigating to the Integrations section, and creating a new integration.
1. Initialize the SDK
Initialize the SDK with your API key and Secret key:
import { FaceVerifySdkNode } from 'faceverify-sdk-node';
const faceVerify = new FaceVerifySdkNode({
apiKey: 'your-api-key',
secretKey: 'your-secret-key',
});
2. Create a Verification Session
To create a session, you can use the createSession
method. Here's an example:
const sessionData = await faceVerify.createSession({
country: 'US',
uniqueIdentifier: 'user123',
metaData: { additionalInfo: 'some-value' },
});
console.log('Session Data:', sessionData);
The createSession
method allows you to pass optional parameters such as country
, uniqueIdentifier
, and metaData
for more detailed verification.
API
The FaceVerifySdkNode
class exposes the following methods:
constructor({ apiKey: string, secretKey: string })
Initializes the SDK with the API and Secret keys.
createSession(options?: { country?: string, uniqueIdentifier?: string, metaData?: Record<string, any> }): Promise
Creates a new verification session. Optional parameters include:
country
: A string representing the user's country.uniqueIdentifier
: A unique identifier for the user or session.metaData
: Additional information for the session in the form of a key-value object.
generateHmac(httpMethod: string, url: string, body: string, contentType: string, xAuthClient: string, secretKey: string): string
Generates the HMAC signature used for secure communication with the Faceverify API.
validateKeys()
Validates that the SDK has been initialized with both the apiKey
and secretKey
. If either is missing, it throws an error.
Support and Feedback
If you have any questions or feedback, feel free to reach out to us at [email protected].
License
This project is licensed under the MIT license. See the LICENSE file for more details.