{"_id":"@cakfan/valid-id","_rev":"3-ea4535991f6ffccfc7e284266625a132","name":"@cakfan/valid-id","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"@cakfan/valid-id","version":"0.1.0","keywords":["nik","npwp","nib","indonesia","identity","validation","kyc","dukcapil","tax"],"license":"MIT","_id":"@cakfan/valid-id@0.1.0","maintainers":[{"name":"cakfan","email":"cakfangaming@gmail.com"}],"bin":{"valid-id":"dist/cli.js"},"dist":{"shasum":"ff8592561044ea1938793e3d18781f2da2b725e5","tarball":"https://registry.npmjs.org/@cakfan/valid-id/-/valid-id-0.1.0.tgz","fileCount":23,"integrity":"sha512-hpsLePe1MVuM+MZboxxwLlLNd5DtihcJdcWRqR4lV4OE+EcKvXwG/bwhreLXGyCJ/qu2B8Id5XwcMZLTylvhIQ==","signatures":[{"sig":"MEYCIQDsGW9rBx8IVLtFKOyZUlGqSK4aG2BgrUpch0A6hbW9WgIhAN0SyxYEGgZMy3heOjtBgnf2sH6KltVTS1WB90xZk+ad","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":373478},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"09700631a2f057765cfeab334b5bb9b49a575ace","scripts":{"test":"bun test","build":"bun run build.ts","prepublishOnly":"bun run build"},"_npmUser":{"name":"cakfan","email":"cakfangaming@gmail.com"},"_npmVersion":"11.6.2","description":"Validate and parse Indonesian identity numbers (NIK, NPWP, NIB) — format validation only, no official verification.","directories":{},"_nodeVersion":"26.5.0","_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/valid-id_0.1.0_1787161472878_0.654705189916009","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@cakfan/valid-id","version":"0.1.2","keywords":["nik","npwp","nib","indonesia","identity","validation","kyc","dukcapil","tax"],"license":"MIT","_id":"@cakfan/valid-id@0.1.2","maintainers":[{"name":"cakfan","email":"cakfangaming@gmail.com"}],"homepage":"https://github.com/cakfan/valid-id#readme","bugs":{"url":"https://github.com/cakfan/valid-id/issues"},"bin":{"valid-id":"dist/cli-entry.js"},"dist":{"shasum":"5d8eebc479a3f0d0f71ef60f456e1bbae796229d","tarball":"https://registry.npmjs.org/@cakfan/valid-id/-/valid-id-0.1.2.tgz","fileCount":23,"integrity":"sha512-spKoVRtaOq1kVO3xJmdLT4bq/O5/LoUbMxPmf3poZALLInn8H4Ft9WQTgnfYQc6LTChtMA4Vh89TOiSfKu8jDQ==","signatures":[{"sig":"MEUCIQCMNcV6BaQ8L9b2bzgoSVFbQjDZ7F7KrZjV2nDAiNaDTwIgVaOPgkVm1e07EDXih9nVTpMKcPm356Lz+1ZC1iahr68=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@cakfan%2fvalid-id@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":375280},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"b3a9fe574067703bde4d5c5eb96b8e46d56f4f23","scripts":{"test":"bun test","build":"bun run build.ts","prepublishOnly":"bun run build"},"_npmUser":{"name":"cakfan","email":"cakfangaming@gmail.com"},"repository":{"url":"git+https://github.com/cakfan/valid-id.git","type":"git"},"_npmVersion":"10.8.2","description":"Validate and parse Indonesian identity numbers (NIK, NPWP, NIB) — format validation only, no official verification.","directories":{},"_nodeVersion":"20.20.2","_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/valid-id_0.1.2_1787165964771_0.5169115488484313","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@cakfan/valid-id","version":"0.1.3","main":"./dist/index.js","module":"./dist/index.js","devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"repository":{"type":"git","url":"git+https://github.com/cakfan/valid-id.git"},"description":"Validate and parse Indonesian identity numbers (NIK, NPWP, NIB) — format validation only, no official verification.","bin":{"valid-id":"dist/cli-entry.js"},"keywords":["nik","npwp","nib","indonesia","identity","validation","kyc","dukcapil","tax"],"license":"MIT","scripts":{"build":"bun run build.ts","test":"bun test","prepublishOnly":"bun run build"},"types":"./dist/index.d.ts","_id":"@cakfan/valid-id@0.1.3","gitHead":"6f16505d7bcea4355e49c4555145bca62974a6ef","bugs":{"url":"https://github.com/cakfan/valid-id/issues"},"homepage":"https://github.com/cakfan/valid-id#readme","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-903Mf03NXIYHVODFTMo9rEyhqKDMC/a3OOY8WnKg4nIy44uP3x3nweNdgqcuxUof/ZA8/AEILvlcy3Zerd/UHw==","shasum":"9b3195b083127ae1167f8446c3d1c9fbd1331fc3","tarball":"https://registry.npmjs.org/@cakfan/valid-id/-/valid-id-0.1.3.tgz","fileCount":23,"unpackedSize":375280,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@cakfan%2fvalid-id@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCriTfPCZCz/GIgJusuyjUdnfv6wYxsfkl1yaG271b6oQIgSOdiDaasOcCsZWuvtRQ+t++uoZVOpFtqVxN3r7/3aZA="}]},"_npmUser":{"name":"cakfan","email":"cakfangaming@gmail.com"},"directories":{},"maintainers":[{"name":"cakfan","email":"cakfangaming@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/valid-id_0.1.3_1787165991441_0.4983000886212636"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-19T17:44:32.623Z","modified":"2026-08-19T18:59:51.955Z","0.1.0":"2026-08-19T17:44:33.054Z","0.1.2":"2026-08-19T18:59:24.931Z","0.1.3":"2026-08-19T18:59:51.598Z"},"bugs":{"url":"https://github.com/cakfan/valid-id/issues"},"license":"MIT","homepage":"https://github.com/cakfan/valid-id#readme","keywords":["nik","npwp","nib","indonesia","identity","validation","kyc","dukcapil","tax"],"repository":{"type":"git","url":"git+https://github.com/cakfan/valid-id.git"},"description":"Validate and parse Indonesian identity numbers (NIK, NPWP, NIB) — format validation only, no official verification.","maintainers":[{"name":"cakfan","email":"cakfangaming@gmail.com"}],"readme":"# @cakfan/valid-id\n\n[![npm version](https://img.shields.io/npm/v/@cakfan/valid-id)](https://www.npmjs.com/package/@cakfan/valid-id)\n[![license](https://img.shields.io/npm/l/@cakfan/valid-id)](https://github.com/cakfan/valid-id/blob/main/LICENSE)\n\nValidate and parse Indonesian identity numbers — NIK, NPWP, and NIB — in JavaScript and TypeScript.\n\nZero dependencies. Works in Node.js, Bun, Deno, and the browser.\n\n## Features\n\n- **NIK validation** — format, region codes (Kemendagri 2025), birth date, gender extraction\n- **NPWP validation** — auto-detects old (15-digit), new 16-digit, and NIK-based formats with Luhn checksum\n- **NIB validation** — 13-digit format check for Nomor Induk Berusaha\n- **CLI support** — run via `npx @cakfan/valid-id`\n- **TypeScript** — full type definitions included\n- **Zero dependencies** — no network calls, all validation is local\n- **Input normalization** — accepts dots, dashes, and spaces\n\n## Table of Contents\n\n- [Install](#install)\n- [Quick Start](#quick-start)\n- [Usage](#usage)\n  - [Library](#library)\n  - [CLI](#cli)\n- [API Reference](#api-reference)\n- [Region Data](#region-data)\n- [Use Cases](#use-cases)\n- [Limitations](#limitations)\n- [License](#license)\n\n## Install\n\n```bash\nnpm install @cakfan/valid-id\n```\n\nAlso available with bun, yarn, or pnpm:\n\n```bash\nbun add @cakfan/valid-id\nyarn add @cakfan/valid-id\npnpm add @cakfan/valid-id\n```\n\n## Quick Start\n\n```typescript\nimport { validateNik, validateNpwp, validateNib } from \"@cakfan/valid-id\";\n\nvalidateNik(\"3171061501900001\");    // { valid: true, data: { region, birthDate, ... } }\nvalidateNpwp(\"01.300.066.6-091.000\"); // { valid: true, format: \"old_15\", ... }\nvalidateNib(\"1234567890123\");        // { valid: true }\n```\n\n## Usage\n\n### Library\n\n```typescript\nimport { validateNik, validateNpwp, validateNib } from \"@cakfan/valid-id\";\n\n// Validate NIK (Nomor Induk Kependudukan)\nconst nik = validateNik(\"3171 0615 0190 0001\"); // spaces are auto-stripped\nif (nik.valid) {\n  console.log(nik.data.region.provinceName); // \"DKI JAKARTA\"\n  console.log(nik.data.region.regencyName);  // \"KOTA ADM. JAKARTA PUSAT\"\n  console.log(nik.data.region.districtName); // \"MENTENG\"\n  console.log(nik.data.birthDate.year);      // 1990\n  console.log(nik.data.birthDate.month);     // 1\n  console.log(nik.data.birthDate.day);       // 15\n  console.log(nik.data.birthDate.gender);    // \"male\"\n}\n\n// Validate NPWP (Nomor Pokok Wajib Pajak)\nconst npwp = validateNpwp(\"01.300.066.6-091.000\"); // dots and dashes are auto-stripped\nif (npwp.valid) {\n  console.log(npwp.format);              // \"old_15\"\n  console.log(npwp.data.taxpayerType);   // \"Instansi Pemerintah\"\n  console.log(npwp.data.kppCode);        // \"091\"\n  console.log(npwp.data.branchCode);     // \"000\"\n}\n\n// Validate NIB (Nomor Induk Berusaha)\nconst nib = validateNib(\"1234567890123\");\nif (nib.valid) {\n  console.log(\"NIB format is valid\");\n}\n```\n\n### CLI\n\n```bash\nnpx @cakfan/valid-id nik 3171061501900001\nnpx @cakfan/valid-id npwp 01.300.066.6-091.000\nnpx @cakfan/valid-id nib 1234567890123\n```\n\nExample output:\n\n```\n✓ NIK valid\n  Provinsi    : DKI JAKARTA (31)\n  Kab/Kota    : KOTA ADM. JAKARTA PUSAT (3171)\n  Kecamatan   : MENTENG (317106)\n  Tgl Lahir   : 15-01-1990\n  Gender      : Laki-laki\n```\n\n## API Reference\n\n### `validateNik(nik: string): NikValidationResult`\n\nValidates a 16-digit NIK (Nomor Induk Kependudukan). Checks format, region codes against the Kemendagri database, and birth date validity. Extracts parsed data including gender (via the +40 rule for females).\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `valid` | `boolean` | Whether the NIK is valid |\n| `reason` | `string?` | Explanation if invalid |\n| `data.region` | `NikRegionInfo` | Province, regency, district (code + name) |\n| `data.birthDate` | `BirthDateInfo` | Day, month, year, gender, Date object |\n| `data.sequenceNumber` | `number` | Last 4 digits |\n\n### `validateNpwp(npwp: string): NpwpValidationResult`\n\nValidates an NPWP (Nomor Pokok Wajib Pajak). Auto-detects format:\n\n| Format | Digits | Description |\n|--------|--------|-------------|\n| `old_15` | 15 | Traditional NPWP with Luhn checksum |\n| `new_16` | 16 | New format (starts with `0`) with Luhn checksum |\n| `new_nik` | 16 | NIK-based NPWP (validated as NIK) |\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `valid` | `boolean` | Whether the NPWP is valid |\n| `format` | `NpwpFormat` | Detected format |\n| `reason` | `string?` | Explanation if invalid |\n| `data.taxpayerType` | `string?` | Taxpayer category |\n| `data.kppCode` | `string?` | Tax office code |\n| `data.branchCode` | `string?` | Branch code (\"000\" = head office) |\n\n### `validateNib(nib: string): NibValidationResult`\n\nValidates a 13-digit NIB (Nomor Induk Berusaha). Format check only.\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `valid` | `boolean` | Whether the NIB format is valid |\n| `reason` | `string?` | Explanation if invalid |\n\n### `extractBirthDateFromNik(digits: string): BirthDateInfo | null`\n\nLower-level function to extract birth date from the 6-digit date portion of a NIK (digits 7-12). Handles the +40 rule for females.\n\n## Region Data\n\nNIK validation includes a static database of Indonesian region codes (Kemendagri 2025):\n\n- 34 provinces\n- 488 regencies/cities\n- 6,635 districts\n\nSource: Kepmendagri No. 300.2.2-2138 Tahun 2025.\n\n> **Note**: 4 newly formed Papua provinces (BPS codes 92, 95, 96, 97) do not yet have official Kemendagri codes and are excluded from validation.\n\n## Use Cases\n\n- **KYC forms** — validate user identity numbers during registration\n- **Backend validation** — verify NIK/NPWP format before database insertion\n- **Fintech onboarding** — check taxpayer identification numbers\n- **E-commerce** — validate buyer/seller identity for compliance\n- **Government apps** — validate citizen identification numbers\n- **Tax filing** — verify NPWP format before submission\n\n## Limitations\n\n- **Format validation only** — does not verify against official government databases (Dukcapil, DJP, OSS)\n- **No network calls** — all validation is local, using static data bundled in the package\n- **NIB has no checksum** — only 13-digit format is validated; authenticity cannot be verified locally\n- **Region codes may become outdated** — new regencies/districts (pemekaran wilayah) require a package update\n\n## License\n\nMIT\n","readmeFilename":"README.md"}