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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@m-doc/photo-id

v1.1.0

Published

ISO/IEC TS 23220-4 PhotoID profile: namespaces and element identifiers

Readme

The PhotoID profile of ISO/IEC TS 23220-4:2026 Annex C: its namespaces, its element identifiers and encodings, and the conditional rule Table C.2 puts on the travel-document elements.

@m-doc/core reads and writes the document; this package says what belongs in it. It is pure data and functions, with no runtime dependencies at all — not even on @m-doc/core.

Part of m-doc. The browser playground issues PhotoIDs with it.

Installation

npm i @m-doc/photo-id

Namespaces

A PhotoID spreads its elements across three namespaces, which is the part worth knowing before reading claims:

import {
  PHOTO_ID_DOC_TYPE,               // 'org.iso.23220.photoid.1'
  PHOTO_ID_BASE_NAMESPACE,         // 'org.iso.23220.1'         — Table C.1, from 23220-2
  PHOTO_ID_NAMESPACE,              // 'org.iso.23220.photoid.1' — Table C.2, PhotoID's own
  PHOTO_ID_DATAGROUPS_NAMESPACE,   // 'org.iso.23220.datagroups.1' — ICAO 9303 data groups
  jurisdictionNamespace,           // jurisdictionNamespace('US-IA') → 'org.iso.23220.photoid.US-IA.1'
} from '@m-doc/photo-id'

Data groups are left as bytes: parsing ICAO 9303 is a separate concern.

Element identifiers and encodings

import {
  PHOTO_ID_MANDATORY_ELEMENTS,     // Table C.1, presence M
  PHOTO_ID_RECOMMENDED_ELEMENTS,   // Table C.1 recommends these
  PHOTO_ID_OPTIONAL_ELEMENTS,      // Table C.1, presence O
  PHOTO_ID_SPECIFIC_ELEMENTS,      // Table C.2 — PhotoID's own
  PHOTO_ID_ELEMENT_ENCODING,
  encodingFor,
  Sex,
} from '@m-doc/photo-id'

encodingFor('family_name')     // 'tstr'
encodingFor('birth_date')      // 'full-date'
encodingFor('portrait')        // 'bstr'
encodingFor('sex')             // 'uint'
encodingFor('age_over_18')     // 'bool' — any NN

Sex follows ISO/IEC 5218, with the profile's note that 9 means X rather than "not applicable":

Sex.NotKnown  // 0
Sex.Male      // 1
Sex.Female    // 2
Sex.X         // 9

The identifier types are exported too — PhotoIdBaseElementIdentifier, PhotoIdMandatoryElementIdentifier, PhotoIdSpecificElementIdentifier, PhotoIdEncoding, SexValue.

Profile checks

import { findMissingMandatoryElements, findTravelDocumentIssues } from '@m-doc/photo-id'

// Table C.1, presence M — against the base-namespace claims
findMissingMandatoryElements(baseClaims)

// Table C.2 makes these conditional: required once dg1 is present
findTravelDocumentIssues({ photoIdClaims, dataGroupClaims })
// → [{ element: 'travel_document_mrz', reason: 'travel_document_mrz is required when dg1 is present' }]

findTravelDocumentIssues takes both sets of claims because the condition spans namespaces: dg1 lives in the data-group namespace and the two elements it requires live in the PhotoID namespace. With no dg1, they are optional and it returns nothing.

findMissingMandatoryElements is a finding on a document that was meant to be complete. A presented PhotoID is allowed to disclose a subset.

Requirements

Node 20.19 or newer. Ships ESM and CJS, with type declarations for both.

License

Apache-2.0.