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

@identityd/cardauth

v1.0.32

Published

yesid card authentication with card detection and ocr

Downloads

46

Readme

IDT-Camera-Web

Identity-Tech Web component is a javascript library to enable capturing of face and ID Cards. The library supports selfie and portrait capturing, ID Card scanning for OCR, and matching between face captured and face on the ID Card.

The library works with a server side APIs for OCR and face matching.

Installation

We support installation through NPM and by adding a script tag from our CDN

Install Via NPM

npm install @identityd/yesid-sdk

In your Ionic / React page or component, import the package this way


import '@identityd/yesid-sdk'

....

Install via a script tag


<script src="https://unpkg.com/@identityd/[email protected]/identityd.js" type="module"></script>

Dependencies

This library depend on external libraries for qr-code functionality, backend communication, and peer communication between components.

Dependencies via npm

Dependencies via Javascript

npm i @tensorflow/tfjs
npm i @teachablemachine/image
npm i axios
npm i qrious
npm i peerjs
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@teachablemachine/[email protected]/dist/teachablemachine-image.min.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrious/4.0.2/qrious.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/peerjs.min.js"></script>

Usage

Follow the following steps to add components to your page

Steps

1. Add needed tag to your page

For Face:
<idt-face-camera-web id="face" options="off" capture="manual" ></idt-face-camera-web>
For ID Card
<idt-card-camera-web id="card" type="card" cardtype="tz" options="off" scan="ocr"  capture="manual"></idt-card-camera-web>


<idt-card-camera-web id="card-back" type="card-back" cardtype="mz" options="off" scan="mrz" capture="manual" read="auto"></idt-card-camera-web>

Tag Options/Attributes

|Attribute |Description |Options | |----------------|-------------------------------|-----------------------------| |id |This id a common attribute to identify the element in your page|Optional| |options |This attribute is to allow for camera options to appear. You use options to decide which camera you want to showDefault: on|on | off| |mode |This specifies whether the camera should show when the page loads or should first show the placeholder with a button to start capturing. normal - shows the placeholder and a buttonlive - shows the camera on page loadDefault: normal|live | normal| |capture |This option allows for automatic capture.Default: manual|manual | auto| |scan |This tag only works for idt-card-camera-web component. This tag specifies which type of card scanning do you want to do. If not set, it will try to scan for all; ocr, mrz, bardcode, qrcodeDefault: all|orc | mrz | all| |type |This tag only works for idt-card-camera-web component. It specifies which side of the card do you want to displayDefault: card |card | card-back| |read |This tag only works for idt-card-camera-web component. If it is set to auto, the component will scan the card automatically after capturing. If it is set to manual, a button will show which will need to be clicked to read the cardDefault: manual|auto | manual| |deviceCamera |This specifies the page to be used to capture image from external device.|Optional example. camere_page.html| |liveliness |This option enables liveliness detection | true | false | |cardtype |This attribute defines the id type country.If set to mz the card detection feature will detect mozambique id cards. If it set to tz the card detectin feature will detect tanzanian id cards | mz | tz

2. Listen for events in your page / component

const  faceCameraWeb = document.querySelector('idt-face-camera-web');
faceCameraWeb.addEventListener('faceImageComputed', (e) => {
	const  data = e.detail;
});
const  cardCameraWeb = document.querySelector('idt-card-camera-web');
cardCameraWeb.addEventListener('cardImageComputed', (e) => {
	const  data = e.detail;
	// your code to process
});
const  scanResponse = document.querySelector('idt-card-camera-web');
cardCameraWeb.addEventListener('scanResponse', (e) => {
	const  data = e.detail;
	// your code to process
});

faceImageComputed, cardImageComputed, scanResponse are CustomEvent returning data — in e.response

Steps

In your page you can keep images state by declaring variable, and update the state of these variable on the image captured event callbacks. Then you can run matching as below.

function tryMatching() {
	if(faceImage && cardImage){
		matchFaces(cardImage, faceImage, function(data){
			document.getElementById("similarityValue").innerHTML= "<h2>"+data[0].similarity+"</h2>";
		});
	}
}

Notes

This library can be used with most JS frameworks

Please note that the library expects that the application is running on a secured channel (https)

Support

This library has been tested on the latest versions of Chrome, Edge, Firefox, and Safari. If any issues are found with some browsers, please notify us.

Keywords

WebComponent    WebRTC