Skip to content
/ tsemrtd Public

simple library for eMRTD. supports browsers, node, bun and more!

License

Notifications You must be signed in to change notification settings

li0ard/tsemrtd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

6498d6a · Feb 19, 2025

History

31 Commits
Aug 28, 2024
Feb 19, 2025
Feb 18, 2025
Feb 18, 2025
Sep 9, 2024
Aug 27, 2024
Oct 2, 2024
Oct 2, 2024
Feb 18, 2025
Feb 19, 2025
Feb 19, 2025
Aug 30, 2024
Aug 30, 2024

Repository files navigation

tsemrtd logo

tsemrtd
simple library for eMRTD datagroups
site  •  docs




Warning

tsemrtd is currently in alpha stage: the lib is not very stable yet, and there may be a lot of bugs feel free to try it out, though, any feedback is appreciated!

Features

  • Simple: Hides decoding process and provides simple and modern API
  • Type-Safe: Most of the APIs are strictly typed to help your workflow
  • Compliance: Fully complies with ICAO 9303 and ISO/IEC 19794 standards
  • Supports Bun, Node.js, Deno, Browsers, Cloudflare Workers
  • Supports CSCA masterlist's (ICAO PKD)

Installation

# from NPM
npm i @li0ard/tsemrtd

# from JSR
bunx jsr add @li0ard/tsemrtd 

Usage

Get MRZ

import { DG1 } from "@li0ard/tsemrtd"

let file = await Bun.file("EF_DG1.bin").bytes()
let data = DG1.load(Buffer.from(file))
console.log(data)
// P<D<<MUSTERMANN<<ERIKA<<<<<<<<<<<<<<<<<<<<<<
// C11T002JM4D<<9608122F1310317<<<<<<<<<<<<<<<6

Extract and save photo

import { DG2 } from "@li0ard/tsemrtd"

let file = await Bun.file("EF_DG2.bin").bytes()
let data = DG2.load(Buffer.from(file))

await Bun.write("image.jp2",data[0].imageData)

Supported DG's

Name Descripion
COM Manifest
DG1 MRZ Info
DG2 Face image
DG3 Fingerprint image (Optional)
DG4 Iris image (Optional)
DG5 Displayed image (Optional)
DG7 Signature image (Optional)
DG11 Additional personal data (Optional)
DG12 Additional document data (Optional)
DG14 EAC/PACE data (Conditionally mandatory)
DG15 Active authentication data (Conditionally mandatory)
SOD Security object of document

Library doesn't support datagroups #6,8,9,10,13,16 because they are defined for optional information for each state.

Links