1.0.2 • Published 8 months ago

@tegence/tani-web-sdks v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

@tegence/tani-web-sdks

A React TypeScript SDK for face enrollment, facial recognition, face comparison, and liveness check.

šŸ“Œ Installation

Install the SDK using npm or yarn:

npm install @tegence/tani-web-sdks
# or
yarn add @tegence/tani-web-sdks

šŸš€ Usage

1ļøāƒ£ Initialize the SDK

Before using the components, create an instance of TaniAuth with your API key and Group ID.

import { TaniAuth } from "@tegence/tani-web-sdks";

const taniAuth = new TaniAuth("your-api-key", "your-group-id");

2ļøāƒ£ Enroll a User (Face Enrollment)

import { EnrollUser } from "@tegence/tani-web-sdks";

<EnrollUser
  authInstance={taniAuth}
  onSuccess={(data) => console.log("Enrollment successful", data)}
/>;

āœ… Response:

{
  "message": "Person created successfully",
  "person_details": {
      "person_id": "ca18a8c6-00eb-4b8d-string",
      "client_id": "string",
      "group_id": "d2ea1214-22fd-4512-9844-string",
      "person_name": "john doe",
      "person_email": "johndoe@email.com",
  },
  "image_details": {
    "name": "john doe",
    "image_url": "image url",
    "person_id": "string",
  }
}

3ļøāƒ£ Face Recognition (Identify a Face)

import { FaceRecognition } from "@tegence/tani-web-sdks";

<FaceRecognition
  authInstance={taniAuth}
  onSuccess={(result) => console.log("Face recognized:", result)}
/>;

āœ… Response Shape:

{
  "message": "We found a match for the uploaded image",
  "similarity_score": 88.99883838838,
  "potential_match": "John Doe",
}

4ļøāƒ£ Face Comparison (Compare Two Faces)

import { CompareFaces } from "@tegence/tani-web-sdks";

<CompareFaces
  authInstance={taniAuth}
  imageUrl="https://image.com"
  onSuccess={(data) => console.log("Faces match", data)}
/>;

āœ… Response Shape:

{
  "message": "The images you uploaded are the same person",
  "similarity_score": 0.7556397799150376
}

5ļøāƒ£ Liveness Check (Verify If the Face Is Real)

import { LivenessCheck } from "@tegence/tani-web-sdks";

<LivenessCheck 
  onSuccess={(data) => console.log("liveness checked", data)}
/>;

āœ… Response Shape:

{
  "blink_detected": false,
  "mouth_open_detected": false,
  "head_movement_detected": false,
  "is_live": false
}

šŸŽØ Styling

To apply styles, import the SDK's CSS file in your project:

import "@tegence/tani-web-sdks/dist/styles.css";

šŸ“– Additional Notes

  • Ensure you have a valid API key and Group ID for authentication.
  • The SDK is designed to be React-compatible and framework-agnostic.
  • Components provide a callback function (onSuccess) to handle responses.

šŸ“„ License

This project is licensed under the MIT License.