Skip to main content

indycheck

Offline Indian ID validator — one Rust core, every language.

CI License: MIT Rust

indycheck validates, formats, masks and decodes Indian identifiers — offline, zero network calls, zero runtime dependencies in the core. One Rust core ships to Rust, JavaScript/TypeScript (WASM), Python (PyO3), and later Kotlin/Swift (UniFFI) and Go (C API), so every language returns the same answer for the same input.

What it validates

ID Check Checksum?
Mobile 10 digits, starts 6–9, +91/91/0 normalisation —
PAN 5 letters + 4 digits + 1 letter, 4th char = entity type No public checksum exists — format only
Aadhaar 12 digits, first digit 2–9 Verhoeff (UIDAI algorithm)
GSTIN 15 chars: state code + PAN + Z + check digit Mod-36 Luhn
IFSC 4 letters + 0 + 6 alphanumeric No checksum exists — format only
UPI name@handle against a maintained handle list —
PIN code 6 digits, first 1–9 —
TAN 4 letters + 5 digits + 1 letter No checksum — format only
CIN 21 chars, company identity number No checksum — format only
LLPIN 3 letters + 4 digits No checksum — format only
Voter ID (EPIC) 3 letters + 7 digits No checksum — format only
Vehicle registration e.g. DL01AB1234 No checksum — format only

Every validator returns a ValidationResult — never throws on bad input:

{ "valid": true, "code": "VALID", "reason_en": "PAN format is valid. PAN has no public checksum, so this only checks the format", "reason_hi": "PAN ka format sahi hai. PAN ka koi public checksum nahi hai, isliye sirf format check hua hai", "parsed": { "entity": "Individual", "entity_code": "P" } }

Honest limits — read this first

indycheck is format + checksum validation only. It is NOT KYC verification.

  • It does not connect to UIDAI, NSDL, GSTN, or any government API.
  • It cannot confirm a document is genuine, active, or belongs to anyone.
  • A valid: true result means "this string is well-formed" — nothing more.
  • PAN and IFSC have no publicly documented checksum, so only structure is checked.
  • Never use it to claim an identity is verified. See SECURITY.md.

Install

# Rust
cargo add indycheck

# JavaScript / TypeScript (WASM)
npm install indycheck

# Python
pip install indycheck

Quick start

use indycheck::{validate_pan, validate_gstin, validate_aadhaar};

let pan = validate_pan("ABCDE1234F");
assert!(pan.valid); // entity: Unknown (4th char D is not a published entity code)

let gstin = validate_gstin("18ABCDE1234F1ZZ"); // state 18 = Assam
assert!(gstin.valid);
assert_eq!(gstin.parsed["state"], "Assam");

let aadhaar = validate_aadhaar("234567890124");
assert!(aadhaar.valid);
import { validatePan, validateGstin, maskAadhaar } from "indycheck";

validatePan("ABCDE1234F"); // { valid: true, code: "VALID", ... }
maskAadhaar("234567890124"); // "XXXX XXXX 0124"
from indycheck import validate_pan, validate_gstin

validate_pan("ABCDE1234F")["valid"]  # True
validate_gstin("18ABCDE1234F1ZZ")["parsed"]["state"]  # "Assam"

More control

use indycheck::{Options, validate_pan_with_options};

let opts = Options::lenient(); // skip checksum checks, allow spaces/hyphens
let r = validate_pan_with_options("abcde 1234 f", opts);
  • Options: strict / lenient, allow_spaces_hyphens, normalise_plus91, uppercase — see docs.
  • Format & mask: format_pan, format_gstin, format_mobile, mask_pan (ABCDE****F), mask_mobile (******3210), mask_aadhaar (XXXX XXXX 0124).
  • Auto-detect: detect("18ABCDE1234F1ZZ") → "gstin".
  • Bulk: validate_many(&[...]) — one call for thousands of values (fast across the WASM/FFI boundary).
  • Test data: generate_pan(), generate_aadhaar(), generate_gstin("18"), generate_mobile(), generate_vehicle(), generate_vehicle_bharat() — syntactically valid test data only, never real IDs.
  • CLI: cargo run -p indycheck -- validate pan ABCDE1234F — see CLI docs.

Framework integrations

  • TypeScript: Zod schemas in packages/js/src/zod.ts (panSchema, aadhaarSchema, gstinSchema, …), React Hook Form / Yup compatible.
  • Python: Pydantic v2 types in packages/python/src/indycheck/pydantic.py (optional, lazy import).

Docs & playground

Project structure

indycheck/
├── crates/indycheck/        # pure Rust core — the only place validation logic lives
├── crates/indycheck-wasm/   # wasm-bindgen → npm
├── crates/indycheck-py/     # PyO3 + maturin → PyPI
├── crates/indycheck-napi/   # napi-rs → npm (Phase 2 packaging)
├── crates/indycheck-uniffi/ # UniFFI → Kotlin/Swift (Phase 3, scaffold)
├── crates/indycheck-ffi/    # C API → Go (last, scaffold)
├── packages/js/             # TS wrapper + Zod
├── packages/python/         # thin Python wrapper + Pydantic
├── shared/test-vectors.json # 254 cases — the contract every language must pass
├── shared/spec.md           # API + error-code spec
└── website/                 # Astro 5 + Starlight docs + landing + playground

The contract: shared/test-vectors.json is run by Rust, Python and JS. If a binding diverges, the tests fail.

Development

cargo fmt --all
cargo clippy --workspace --all-targets   # 0 warnings
cargo test --workspace                   # 54 tests
wasm-pack build --target web --manifest-path crates/indycheck-wasm/Cargo.toml
python3 -m maturin build --manifest-path crates/indycheck-py/pyproject.toml
cd website && npm install && npm run build

See CONTRIBUTING.md and shared/spec.md.

Changelog

See CHANGELOG.md. Releases use release-plz for crates.io; npm/PyPI follow the same version in lockstep (semver).

License

MIT — see LICENSE. Author: dusmamud.

Metadata

Release files for indycheck 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for indycheck 0.2.2
File Interpreter ABI Platform Actions
indycheck-0.2.2-cp310-abi3-manylinux_2_34_x86_64.whl CPython 3.10 abi3 Linux glibc 2.34+ x86-64 Details for indycheck-0.2.2-cp310-abi3-manylinux_2_34_x86_64.whl

Release files / indycheck-0.2.2-cp310-abi3-manylinux_2_34_x86_64.whl

Download URL indycheck-0.2.2-cp310-abi3-manylinux_2_34_x86_64.whl
Size 333.9 kB
Tags CPython 3.10 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
43f15a2a1852685e97ee81d876b051c52a7b18b75f974e165d8a2a2389159bb5
BLAKE2b-256 checksum
How to use checksums
c03464b78eaa0514ac61fdf40746423a7af4e494e99b9750ed128bb781b5ffc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Security for indycheck 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

1 file in this release has been uploaded with provenance metadata.

Attestation for indycheck-0.2.2-cp310-abi3-manylinux_2_34_x86_64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page