Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mrz-scan

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mrz-scan

Server side mrz (Machine Readable Zone) scanner.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
284
increased by6.37%
Maintainers
1
Weekly downloads
 
Created
Source

mrz-scanner

Server side mrz scanner.

Using mrz-detection written for NodeJS by Daniel Kostro and Michaël Zasso.

Based on mrz-scanner

Refactored by ProjectINT because original package was to big for lambda function

Install

yarn add mrz-scan
      OR
npm i mrz-scan

Get formatted response

// @flow
const mrzScanner = require('mrz-scan');

type Result = ?{ // undefined if errored
  number: string,
  validDate: string,
  birthDate: string,
  name: string,
  surname: string,
};

// Pass [Buffer](https://nodejs.org/api/buffer.html) to mrzScanner
const result: Result = await mrzScanner(Buffer);

Or you can get all fields with original === true option

// @flow
const mrzScanner = require('mrz-scan');

type Fields = {
  documentCode: string,
  issuingState: string,
  lastName: string,
  firstName: string,
  documentNumber: string,
  documentNumberCheckDigit: string,
  nationality: string,
  birthDate: string,
  birthDateCheckDigit: string,
  sex: string,
  expirationDate: string,
  expirationDateCheckDigit: string,
  personalNumber: string,
  personalNumberCheckDigit: string,
  compositeCheckDigit: string,
}

type FullResult = ?{ // undefined if errored
  format: string, // TD1, TD2, TD3
  details: Array<{
    label: string,
    field: $Values<Fields>,
    value: string,
    valid: boolean,
    ranges: Array<[number, number]>,
    line: number,
    start: number,
    end: number,
  }>,
  fields: Fields,
  valid: boolean,
}

const fullResult: FullResult = const result = await mrzScanner(Buffer, { original: true });

Supported image formats

Supported image formats The following formats can be loaded by image-js:

  • PNG (8 or 16 bits, color or greyscale, with or without alpha)
  • JPEG
  • TIFF (8 or 16 bits, greyscale)

Keywords

FAQs

Package last updated on 29 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc