Skip to content

Simple Library to check German Identity Cards (Personalausweis und Reisepass)

License

Notifications You must be signed in to change notification settings

LILA-IT/ausweischeck

Repository files navigation

AusweisCheck 🇩🇪 (EU-ID Card Check)

NPM NPM GitHub Workflow Status styled with prettier Quality Gate Status Maintainability Rating Security Bugs Coverage Duplicated Lines (%)

✨ Features

Just plain typescript lib to check the validity of German ID card and passport numbers with the help of the serial number. Special thanks to Deniz Celebi (@derDeno) for the original implementation.

🔧 Installation

npm install ausweischeck
yarn add ausweischeck

🎬 Getting started

import { checkPerso, checkReisepass } from "ausweischeck";

const persoResult = checkPerso("L01X00T471");
const reisepassResult = checkReisepass("C01X00T478D", "en");

📜 API

checkPerso(idNumber: string, language?: "de" | "en"): AusweisCheckResult

This method checks for the validity of a German Personalausweis (ID card) number. The language parameter is optional and defaults to "de". The language parameter is only used for the error message.

Example:

const persoResult = checkPerso("L01X00T471");

console.log(persoResult);
// {
//   result: true,
//   ausweis: {
//     number: "L01X00T47",
//     type: "EU ID",
//   },
// }

checkEuId(idNumber: string): AusweisCheckResult

This method duplicates the checkPerso method. It defaults to the English error message. It's only there for usability reasons.

checkReisepass(idNumber: string, language?: "de" | "en"): AusweisCheckResult

This method checks for the validity of a German Reisepass (passport) number. The language parameter is optional and defaults to "de". The language parameter is only used for the error message.

Example:

const reisepassResult = checkReisepass("C01X00T478D");

console.log(reisepassResult);
// {
//   result: true,
//   ausweis: {
//     number: "C01X00T478",
//     type: "Passport",
//   },
// }

checkGermanPassport(idNumber: string): AusweisCheckResult

This method duplicates the checkReisepass method. It defaults to the English error message. It's only there for usability reasons.

🥂 License

MIT

About

Simple Library to check German Identity Cards (Personalausweis und Reisepass)

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published