trustvision-sdk

A SDK to interact with Trust Vision BE API

Usage no npm install needed!

<script type="module">
  import trustvisionSdk from 'https://cdn.skypack.dev/trustvision-sdk';
</script>

README

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