ausweischeck v1.1.1
AusweisCheck 🇩🇪 (EU-ID Card Check)
✨ 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.