1.0.0 • Published 5 years ago

trustvision-sdk v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

Trust Vision JavaScript SDK

A JavaScript SDK to interact with Trust Vision API

Installation

npm install tv-api-js-sdk --save

or

yarn add tv-api-js-sdk

Usage

Before getting into the development, you should have an Access Key and a Secret Key from Trust Vison Team.

Create an instance of SDK:

import { TvAPI, HttpClient } from 'tv-api-js-sdk';

const httpClient = new HttpClient({
  accessKey: '<your access key>';
  keySecret: '<your secret key>';
  domain: '<your api domain>';
});

const tvSDK = new TvSDK(httpClient);

Upload image:

  const file = document.getElementById('#yourFileInput').files[0];
  const imageLabel = 'id_card.vn.cmnd_old.front';

  tvSDK.uploadImage(file, imageLabel)
    .then((res) => {
      console.log(res); // get image_id
    });

Compare faces:

  tvSDK.compareFaces('<Image 1 Id>', '<Image 2 Id>')
    .then((res) => {
      console.log(res); // request id
    })

Get compare result:

  tvSDK.getCompareFacesResult('<Request Id on Compare Faces step>')
    .then((res) => {
      console.log(res); // request id
    })

Development

Run Test:

npm test

Run Test with watch:

npm run test:watch

Build files:

npm run build