npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

idcheckio

v2.2.0

Published

NodeJS client library for idcheck.io API

Downloads

34

Readme

IDCHECKIO

The ID document checking NodeJS library.

IDCHECKIO logo

Web application : https://idcheck.io

Mashape REST API : https://market.mashape.com/ariadnext/idcheck-io-api

Swagger REST API : https://api.idcheck.io/swagger/#/

Python Client library : https://github.com/ariadnext/IDCheckIO

Provided by : http://www.ariadnext.com

Account

To create your account an credit, contact us by email with your needs at : [email protected]

Installation

Simply...

npm install idcheckio --save

Usage

Fast path :

var Idcheckio = require('idcheckio').idcheckio;

// your idcheckio account.
var config = { user:'[email protected]', pwd:'mypwd' };
var idcheckio = new Idcheckio( config );

idcheckio.analyseMRZ( 'P<UTOBANDERAS<<LILIAN<<<<<<<<<<<<<<<<<<<<<<<', 
        			  '01234567894UTO8001014F2501017<<<<<<<<<<<<<06', 
        			  '', function(err, result){
   if(err){ throw err; }
	console.log(JSON.stringify(result,0,2));
}

complete config json

{
	user : '[email protected]',   // MANDATORY
	pwd  : 'mypassword',				      // MANDATORY
	language : 'EN' || 'FR',               // default: EN
	protocol : 'https' || 'http',          // default: https
	host : 'api.idcheck.io',               // default: api.idcheck.io
	port : '443'                           // default: 443
}

analyseMRZ

Analyse MRZ lines, get result of the analysis into callback.

  • Firsts parameters are the three lines of MRZ, complete lines with ''.
  • async : true || false : requete en mode asynchrone ( voir analyseStatus & analyseResult )

Get a pdf report from the uid in result and the getReport section.

idcheckio.analyseMRZ( 'P<UTOBANDERAS<<LILIAN<<<<<<<<<<<<<<<<<<<<<<<', 
        			  '01234567894UTO8001014F2501017<<<<<<<<<<<<<06', 
        			  '', function(err, AnalyseResultObject){
   if(err){ throw err; }
	console.log(JSON.stringify(AnalyseResultObject,0,2));
}, async = false );

The AnalyseResultObject is described below.

analyseImage

Analyse an image (pdf, jpg, png, tiff), get result of the analysis into callback.

  • MANDATORY First parameter is the document face ( the MRZ is visible ) encoded in base64.
  • Secound parameter is the document back ( face without MRZ ), '' if no face.
  • async : true || false : requete en mode asynchrone ( voir analyseStatus & analyseResult )

Get a pdf report from the uid in result and the getReport section.

idcheckio.analyseImage( bufFront.toString('base64'),
                       bufBack.toString('base64'),
                       function(err, AnalyseResultObject){
            if(err) { throw err; }
            console.log(JSON.stringify(AnalyseResultObject,0,2));
        }, async = false );

The AnalyseResultObject is described below.

getReport

Get a PDF Report with the result of analysis.

This function can be called after analyseMRZ() or analyseImage(), with uid parameter returned by these functions.

The ReportObject returned is described below.

idcheckio.getReport( '1234009234',
                function(err, res ){
                    if(err) { throw err; }
                    console.log(JSON.stringify(result,0,2));
                    fs.writeFileSync("./test/testReport.pdf", res.report, 'base64');
                });
               
               

analysisStatus

For asynchronous requests : get the analysis status.

This function can be called after analyseMRZ() or analyseImage(), with uid parameter returned by these functions.

  • wait parameter : Specify the maximum wait time (in ms) to wait for task completion before returning. This parameter can be used to reduce the number of time that the user will have to poll the server before detecting task completion.

The TaskDetail returned is described below.

idcheckio.analysisStatus( '1234009234', 
								wait = 1000,
                function(err, res ){
                    if(err) { throw err; }
                    console.log(JSON.stringify(result,0,2));
                });

analysisResult

For asynchronous AND synchronous requests : get the analysis result when analysis finished.

This function can be called after analyseMRZ() or analyseImage(), with the UID parameter returned by these functions.

Some optional parameters : (default false)

  • rectoImageCropped : flag for requesting the cropped image of the sumitted frontImage
  • signatureImageCropped : flag for requesting the signature image of the document
  • faceImageCropped : flag for requesting the cropped image of the holder's face

The AnalyseResultObject returned is described below.

idcheckio.analysisResult( '1234009234', 
								rectoImageCropped = true,
								signatureImageCropped = false, 
								faceImageCropped = false,
                function(err, res ){
                    if(err) { throw err; }
                    console.log(JSON.stringify(result,0,2));
                }
          );

Test

A test folder is accessible and works with your test logins that we provided.

cd test/
// fill the idcio_config object with your logins into test.js
npm test	

Dependencies

Need NodeJS > v0.10.0

Objects

AnalyseResultObject

Exemple of result :

{
  "uid": "1234009234",
  "analysisRefUid": "1234660",
  "checkReportSummary": {
    "check": [
      {
        "identifier": "SUMMARY_ID_IDENTIFIED",
        "titleMsg": "Document identification",
        "resultMsg": "Identified document",
        "result": "OK"
      },
      {
        "identifier": "SUMMARY_ID_FALSIFIED",
        "titleMsg": "Document falsification detection",
        "resultMsg": "The document seems to be falsified",
        "result": "ERROR"
      },
      {
        "identifier": "SUMMARY_ID_SPECIMEN",
        "titleMsg": "Sample document detection",
        "resultMsg": "Sample document",
        "result": "ERROR"
      },
      {
        "identifier": "SUMMARY_ID_EXPIRED",
        "titleMsg": "Document expiration",
        "resultMsg": "Not expired",
        "result": "OK"
      }
    ]
  },
  "documentClassification": {
    "idType": "P"
  },
  "documentDetail": {
    "emitCountry": "UTO",
    "documentNumber": "012345678",
    "extraInfos": [
      {
        "dataKey": "EXPIRATION_DATE",
        "dataValue": "10/50/F2",
        "title": "Expiration date"
      },
      {
        "dataKey": "PERSONAL_NUMBER",
        "dataValue": "7",
        "title": "Personal number"
      }
    ]
  },
  "holderDetail": {
    "lastName": [
      "BANDERAS"
    ],
    "firstName": [
      "LILIAN"
    ],
    "nationality": "4UT",
    "gender": "X",
    "extraInfos": [
      {
        "dataKey": "BIRTH_DATE",
        "dataValue": "10/00/O8",
        "title": "Date of birth"
      }
    ]
  },
  "mrz": {
    "line1": "P<UTOBANDERAS<<LILIAN<<<<<<<<<<<<<<<<<<<<<<<",
    "line2": "01234567894UTO8001014F2501017<<<<<<<<<<<<<06"
  }
}

ReportObject

{ uid: '1234920434',
  analysisRefUid: '1234447',
  report: 'JVBERi0x....UVPRgo='
 }

TaskDetail

{
  "uid": "1234920434",
  "accepted": "2016-08-22T12:09:20.566+0000",
  "started": "2016-08-22T12:09:20.566+0000",
  "ended": "2016-08-22T12:09:20.742+0000",
  "redirectUrl": "https://api-test.idcheck.io/rest/v0/result/1234920434"
}

TODO

  • exemple folder with sample client code (almost same as /test/test.js)