Skip to content

About

A passport code generator.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Repository files navigation

Germknödel

A passport code generator. Generates passport codes like this:

26109Q5FB7D<<9203147X2205142<<<<<<<<<<<<<<<6

I wrote the basic script as a terrible dev console snippet and then got almost lost in building a neat NodeJS command-line tool from it.

Currently, only German passport codes are supported.

Contributions for other countries and document types are welcome!

The package name was an unconscious play of words because I still own a German passport while living in Austria where Germknödel are hugely popular. (And delicious, btw.)

Now the name got stuck. Sorry. 🤷🏻‍

Installation

npm --global install germknoedel

Also published on JSR for use from Deno or Bun: deno add jsr:@p3k/germknoedel, or import directly via jsr:@p3k/germknoedel.

Usage

germknoedel --help

Examples

germknoedel --authority 3533 --gender female 1970-01-01 2019-12-31

germknoedel --serial 6068T5DH1

germknoedel --format json

germknoedel --query '*'

Library usage

calculate and validate are also exported for use from JavaScript directly – validate fills in defaults and normalizes things like a human-readable gender ("female") into the single-character code calculate expects:

import { calculate, validate } from 'germknoedel';

const { serial, gender, dateOfBirth, dateOfExpiry } = validate({
  serial: '3533IIY6Z',
  gender: 'female',
  dateOfBirth: '1970-01-01',
  dateOfExpiry: '2019-12-31'
});

calculate(serial, gender, dateOfBirth, dateOfExpiry);
// → "3533IIY6Z3D<<7001017F1912319<<<<<<<<<<<<<<<8"

Runtime compatibility

Tested directly under Node.js, Deno and Bun – the CLI and the library exports both run correctly on all three.

Bun needs no extra flags. Deno, secure by default, needs permissions granted explicitly:

  • Importing the library (calculate, validate) only needs --allow-read, to load the bundled authority data.
  • Running the CLI additionally needs --allow-env – required by chalk's own CI-environment detection, not by anything in this package – and --allow-net too, if using --update.
deno run --allow-read --allow-env bin/germknoedel.js 1970-01-01 2019-12-31

Kudos

About

A passport code generator.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages