indycheck 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -2
- package/dist/index.d.ts +302 -0
- package/dist/index.js +1311 -0
- package/dist/zod.d.ts +41 -0
- package/dist/zod.js +43 -0
- package/package.json +38 -3
package/README.md
CHANGED
|
@@ -1,3 +1,118 @@
|
|
|
1
|
-
#
|
|
1
|
+
# indycheck
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Offline Indian ID validator — mobile, PAN, Aadhaar, GSTIN, IFSC, UPI, PIN code, TAN, CIN, LLPIN, Voter ID / EPIC and vehicle registration. Format + checksum only, no network, no government database.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install indycheck
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { validatePan, validateMobile, validateTan, generatePan } from "indycheck";
|
|
11
|
+
|
|
12
|
+
validatePan("ABCPE1234F"); // { valid: true, code: "VALID", parsed: { entity: "Individual", entity_code: "P" } }
|
|
13
|
+
validateMobile("+91 98765 43210"); // { valid: true, parsed: { normalized: "9876543210" } }
|
|
14
|
+
validateTan("AAAA12345B"); // { valid: true, parsed: { tan: "AAAA12345B" } }
|
|
15
|
+
generatePan("P"); // e.g. "XKQPW4821M" — mock test data only, never a real PAN
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Every validator returns `{ valid, code, reason_en, reason_hi, parsed }` and
|
|
19
|
+
never throws on bad input. `reason_hi` is Roman-script Hinglish, exactly
|
|
20
|
+
as the Rust core returns it.
|
|
21
|
+
|
|
22
|
+
## Validators (12)
|
|
23
|
+
|
|
24
|
+
| Function | Checks | `parsed` on success |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| `validateMobile` | 10 digits, first digit 6–9; `+91` / `91` / `0` prefix, spaces and hyphens allowed | `{ normalized }` |
|
|
27
|
+
| `validatePan` | `^[A-Z]{5}[0-9]{4}[A-Z]$` | `{ entity, entity_code }` |
|
|
28
|
+
| `validateAadhaar` | 12 digits, first digit 2–9, Verhoeff checksum | `{ masked }` |
|
|
29
|
+
| `validateGstin` | 15 chars: state code + PAN + entity char + `Z` + Mod-36 check digit | `{ state, state_code, pan }` |
|
|
30
|
+
| `validateIfsc` | `^[A-Z]{4}0[A-Z0-9]{6}$` — format only, no checksum | `{ bank_code, branch_code }` |
|
|
31
|
+
| `validateUpi` | `name@handle`, handle from a built-in list | `{ handle }` |
|
|
32
|
+
| `validatePincode` | 6 digits, first digit 1–9 | `{ pincode }` |
|
|
33
|
+
| `validateTan` | 4 letters + 5 digits + 1 letter — format only, no checksum | `{ tan }` |
|
|
34
|
+
| `validateCin` | 21 chars: `L`/`U` + 5 digits + 2 letters + 4 digits + 3 letters + 6 digits — format only, no checksum | `{ cin, listing, industry_code, state_code, year, company_type, registration_number }` |
|
|
35
|
+
| `validateLlpin` | 3 letters + 4 digits — format only, no checksum | `{ llpin }` |
|
|
36
|
+
| `validateVoterId` / `validateEpic` | 3 letters + 7 digits — format only, no checksum | `{ epic }` |
|
|
37
|
+
| `validateVehicle` / `validateVehicleRegistration` | e.g. `DL01AB1234`, `DL01A1234` — format only, no checksum | `{ registration, state_code, district, series, number }` |
|
|
38
|
+
|
|
39
|
+
Also available: `detect` (the Rust detect string in `parsed.type`) and
|
|
40
|
+
`validateMany`, and optional Zod schemas (`indycheck/zod`: `panSchema`,
|
|
41
|
+
`aadhaarSchema`, `tanSchema`, `cinSchema`, `llpinSchema`, `voterSchema` /
|
|
42
|
+
`epicSchema`, `vehicleSchema`, …).
|
|
43
|
+
|
|
44
|
+
## Options
|
|
45
|
+
|
|
46
|
+
`validateMobileWithOptions`, `validatePanWithOptions`,
|
|
47
|
+
`validateAadhaarWithOptions` and `validateGstinWithOptions` take an
|
|
48
|
+
optional partial `Options` object (`{ strict, allow_spaces_hyphens,
|
|
49
|
+
normalise_plus91, uppercase }`, all defaulting to `true`):
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { validateMobileWithOptions, lenientOptions } from "indycheck";
|
|
53
|
+
|
|
54
|
+
validateMobileWithOptions("5876543210", lenientOptions()); // valid: first-digit rule skipped
|
|
55
|
+
validateMobileWithOptions("+91 98765 43210", { normalise_plus91: false }); // INVALID_FORMAT
|
|
56
|
+
validatePanWithOptions("abcde1234f", { uppercase: false }); // INVALID_FORMAT
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Helpers: `defaultOptions()`, `lenientOptions()` (format only — skips
|
|
60
|
+
first-digit and checksum checks) and `noSpacesHyphensOptions()`. The
|
|
61
|
+
other validators have no options variants, in the Rust core either.
|
|
62
|
+
|
|
63
|
+
## Format / mask
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { formatPan, formatGstin, maskPan, maskMobile } from "indycheck";
|
|
67
|
+
|
|
68
|
+
formatPan("abcde 1234f"); // "ABCDE1234F" (null when the pattern does not match)
|
|
69
|
+
formatGstin("18aaapl1234c1zd"); // "18AAAPL1234C1ZD" — check digit NOT verified here
|
|
70
|
+
maskPan("ABCDE1234F"); // "ABCDE****F"
|
|
71
|
+
maskMobile("+91 98765 43210"); // "******3210"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`formatMobile` and `maskAadhaar` keep their older behaviour and return
|
|
75
|
+
a `ValidationResult` (same as `validateMobile` / `validateAadhaar`).
|
|
76
|
+
A non-empty mask result is **not** proof of validity — use the matching
|
|
77
|
+
`validate*` for that.
|
|
78
|
+
|
|
79
|
+
## Generators — TEST DATA ONLY
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { generatePan, generateAadhaar, generateGstin, generateMobile } from "indycheck";
|
|
83
|
+
|
|
84
|
+
generatePan("C"); // syntactically valid PAN, entity Company (unknown char -> "P")
|
|
85
|
+
generateAadhaar(); // 12 digits, correct Verhoeff check digit
|
|
86
|
+
generateGstin("18"); // syntactically valid GSTIN for Assam (unknown code -> "18")
|
|
87
|
+
generateMobile(); // 10 digits, first digit 6-9
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Warning: generated values are syntactically valid, not real issued
|
|
91
|
+
IDs.** They pass this library's own validators but were never issued
|
|
92
|
+
by UIDAI, Income Tax, GSTN or anyone else. Use them only in tests,
|
|
93
|
+
demos and form previews — never present them as a real person's ID.
|
|
94
|
+
Generators are intentionally unseeded: each call may return a
|
|
95
|
+
different value.
|
|
96
|
+
|
|
97
|
+
Note: PAN entity reporting is lenient — the 4th character is reported in
|
|
98
|
+
`parsed.entity`, or `"Unknown"` when it is not in the published entity
|
|
99
|
+
list (P, C, H, F, A, T, B, L, J, G), and the PAN is still format-valid.
|
|
100
|
+
So `ABCDE1234F` is valid with entity `"Unknown"`, not an error.
|
|
101
|
+
|
|
102
|
+
## Honest limits
|
|
103
|
+
|
|
104
|
+
- **Format + checksum only.** A `valid: true` result means the value is
|
|
105
|
+
well-formed and its checksum is correct — not that the ID exists or
|
|
106
|
+
belongs to anyone.
|
|
107
|
+
- No checks against UIDAI (Aadhaar), NSDL / Income Tax (PAN), GSTN
|
|
108
|
+
(GSTIN), any bank (IFSC), or any UPI provider. This package makes no
|
|
109
|
+
network requests at all.
|
|
110
|
+
- **PAN, IFSC, TAN, CIN, LLPIN, Voter ID and vehicle registration
|
|
111
|
+
numbers have no public checksum.** Only their format is checked.
|
|
112
|
+
The vehicle state-code letters are not checked against a list of
|
|
113
|
+
states, and a format-valid vehicle number does not prove the vehicle
|
|
114
|
+
exists.
|
|
115
|
+
- IFSC validation is format-only: it cannot tell you whether a branch
|
|
116
|
+
code really exists.
|
|
117
|
+
- UPI validation checks the handle against a built-in list of common
|
|
118
|
+
handles; a new or rare handle may be reported as unknown.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* indycheck — offline Indian ID validator (pure-TypeScript mirror).
|
|
3
|
+
*
|
|
4
|
+
* This file mirrors the Rust core in crates/indycheck/src/ exactly:
|
|
5
|
+
* same validators, same order of checks, same stable `code` values, same
|
|
6
|
+
* `reason_en` / `reason_hi` strings, same `parsed` shapes (see
|
|
7
|
+
* shared/spec.md). Behaviour is defined by shared/test-vectors.json
|
|
8
|
+
* together with the Rust code; as of the last check the two agree on all
|
|
9
|
+
* 245 vectors (verified by emulating the Rust source over the file), so
|
|
10
|
+
* the vector test below asserts every entry directly with no exceptions.
|
|
11
|
+
* If the Rust side drifts again, that test fails loudly instead of
|
|
12
|
+
* silently picking a side.
|
|
13
|
+
*
|
|
14
|
+
* The 12 validators are: mobile, PAN, Aadhaar, GSTIN, IFSC, UPI, PIN
|
|
15
|
+
* code, TAN, CIN, LLPIN, Voter ID / EPIC and vehicle registration.
|
|
16
|
+
* TAN, CIN, LLPIN, Voter ID, vehicle and IFSC have no public checksum:
|
|
17
|
+
* only their format is checked (say so wherever these are documented).
|
|
18
|
+
* `validate*WithOptions` exists only where the Rust core has it — mobile,
|
|
19
|
+
* PAN, Aadhaar and GSTIN (options.rs); the other validators take no
|
|
20
|
+
* options in Rust either. `formatPan` / `formatGstin` return
|
|
21
|
+
* `string | null` and `maskPan` / `maskMobile` return a plain string
|
|
22
|
+
* ("" when the format is invalid), exactly like the Rust functions —
|
|
23
|
+
* unlike the legacy `formatMobile` / `maskAadhaar` wrappers, which keep
|
|
24
|
+
* returning a `ValidationResult` for backwards compatibility.
|
|
25
|
+
* The `generate*` functions produce mock test data only: syntactically
|
|
26
|
+
* valid, never a real issued ID — see generate.rs and the README.
|
|
27
|
+
*
|
|
28
|
+
* Notes on the Rust contract reproduced here:
|
|
29
|
+
* - Success code is `VALID` (not `OK`). The full code set is:
|
|
30
|
+
* VALID, EMPTY, INVALID_LENGTH, INVALID_FORMAT, INVALID_CHECKSUM,
|
|
31
|
+
* INVALID_FIRST_DIGIT, INVALID_STATE_CODE, INVALID_ENTITY,
|
|
32
|
+
* INVALID_HANDLE, UNKNOWN_TYPE. `INVALID_TYPE` (non-string input) and
|
|
33
|
+
* `SOME_INVALID` (validateMany batch result) exist only in the JS/Python
|
|
34
|
+
* wrappers — Rust takes `&str` and returns a bare `Vec` for batches.
|
|
35
|
+
* - `reason_hi` is Roman-script Hinglish in the Rust core (e.g.
|
|
36
|
+
* "PAN khaali hai"), not Devanagari — reproduced verbatim, even though
|
|
37
|
+
* spec.md calls it Devanagari Hindi.
|
|
38
|
+
* - PAN entity checking is lenient by design (pan.rs, spec.md): the 4th
|
|
39
|
+
* character is reported in `parsed` (entity name, or "Unknown" when it
|
|
40
|
+
* is not in the published list) and the PAN is still format-valid.
|
|
41
|
+
* The canonical example ABCDE1234F is valid with entity "Unknown"
|
|
42
|
+
* (4th char D). `INVALID_ENTITY` is a reserved stable code, not
|
|
43
|
+
* emitted in v0.1.
|
|
44
|
+
* - `detect` returns the Rust detect string ("pan" | "aadhaar" | "gstin" |
|
|
45
|
+
* "ifsc" | "upi" | "mobile" | "pincode" | "tan" | "cin" | "llpin" |
|
|
46
|
+
* "voter" | "vehicle" | "unknown") in `parsed.type`.
|
|
47
|
+
* It is shape-based, not validity-based: detection can succeed while
|
|
48
|
+
* validation of the same input fails. Its order is fixed by lib.rs:
|
|
49
|
+
* `@` -> upi first; then a Verhoeff-valid 12-digit number -> aadhaar
|
|
50
|
+
* (including spaced / hyphenated Aadhaar, digits-only); then any
|
|
51
|
+
* normalisable mobile -> mobile; then CIN (21 chars); then by length
|
|
52
|
+
* (15 -> gstin, 12 digits -> aadhaar, 11 IFSC-pattern -> ifsc,
|
|
53
|
+
* 10 PAN-pattern -> pan, 10 TAN-pattern -> tan, 10 voter-pattern ->
|
|
54
|
+
* voter, 10 digits -> mobile, 7 LLPIN-pattern -> llpin, 6 digits ->
|
|
55
|
+
* pincode); then formatted mobiles, then PAN / TAN / voter / IFSC /
|
|
56
|
+
* LLPIN patterns, then vehicle. Note the code's order, not spec.md's
|
|
57
|
+
* one-line summary of it.
|
|
58
|
+
* - `formatMobile` returns the validateMobile result (parsed.normalized
|
|
59
|
+
* is the 10-digit string, Rust's `format_mobile` return). `maskAadhaar`
|
|
60
|
+
* returns the validateAadhaar result (parsed.masked). Unlike the Rust
|
|
61
|
+
* `mask_aadhaar` string function — which masks any 12-digit string,
|
|
62
|
+
* even one with a bad checksum — the JS/Python maskAadhaar only
|
|
63
|
+
* succeeds for a fully valid Aadhaar number.
|
|
64
|
+
* - UPI handle list, GSTIN state names (incl. 25/26) and PAN entity
|
|
65
|
+
* names are copied verbatim from crates/indycheck/src/data.rs and
|
|
66
|
+
* pan.rs (note: B -> "BODY", H -> "HUF", A -> "AOP").
|
|
67
|
+
*
|
|
68
|
+
* Honest limits: format + checksum only. Nothing here checks a number
|
|
69
|
+
* against UIDAI, NSDL / Income Tax, GSTN, a bank, or any other live
|
|
70
|
+
* database. A `valid: true` result means "well-formed and checksum-correct",
|
|
71
|
+
* not "this ID really exists / belongs to this person".
|
|
72
|
+
*
|
|
73
|
+
* Every validator returns `{ valid, code, reason_en, reason_hi, parsed }`
|
|
74
|
+
* and never throws on bad input.
|
|
75
|
+
*/
|
|
76
|
+
export interface ValidationResult<TParsed = unknown> {
|
|
77
|
+
valid: boolean;
|
|
78
|
+
code: string;
|
|
79
|
+
reason_en: string;
|
|
80
|
+
reason_hi: string;
|
|
81
|
+
parsed: TParsed | null;
|
|
82
|
+
}
|
|
83
|
+
/** Validation options — verbatim from crates/indycheck/src/options.rs.
|
|
84
|
+
* All fields default to `true`. Only mobile, PAN, Aadhaar and GSTIN
|
|
85
|
+
* have `validate*WithOptions` variants in the Rust core; the other
|
|
86
|
+
* validators take no options. */
|
|
87
|
+
export interface Options {
|
|
88
|
+
/** Enforce every rule, including first-digit rules and checksums.
|
|
89
|
+
* `false` skips those (format only). */
|
|
90
|
+
strict: boolean;
|
|
91
|
+
/** Strip spaces and hyphens before validating; `false` makes any
|
|
92
|
+
* space or hyphen an INVALID_FORMAT error. */
|
|
93
|
+
allow_spaces_hyphens: boolean;
|
|
94
|
+
/** A mobile may carry a `+91` / `91` / `0` prefix; `false` accepts
|
|
95
|
+
* only a bare 10-digit number. */
|
|
96
|
+
normalise_plus91: boolean;
|
|
97
|
+
/** Upper-case letter input before validating; `false` makes a
|
|
98
|
+
* lower-case letter fail the format check instead. */
|
|
99
|
+
uppercase: boolean;
|
|
100
|
+
}
|
|
101
|
+
/** parsed shapes follow shared/spec.md exactly. */
|
|
102
|
+
export interface MobileParsed {
|
|
103
|
+
normalized: string;
|
|
104
|
+
}
|
|
105
|
+
export interface PanParsed {
|
|
106
|
+
entity: string;
|
|
107
|
+
entity_code: string;
|
|
108
|
+
}
|
|
109
|
+
export interface AadhaarParsed {
|
|
110
|
+
masked: string;
|
|
111
|
+
}
|
|
112
|
+
export interface GstinParsed {
|
|
113
|
+
state: string;
|
|
114
|
+
state_code: string;
|
|
115
|
+
pan: string;
|
|
116
|
+
}
|
|
117
|
+
export interface IfscParsed {
|
|
118
|
+
bank_code: string;
|
|
119
|
+
branch_code: string;
|
|
120
|
+
}
|
|
121
|
+
export interface UpiParsed {
|
|
122
|
+
handle: string;
|
|
123
|
+
}
|
|
124
|
+
export interface PincodeParsed {
|
|
125
|
+
pincode: string;
|
|
126
|
+
}
|
|
127
|
+
export interface TanParsed {
|
|
128
|
+
tan: string;
|
|
129
|
+
}
|
|
130
|
+
export interface CinParsed {
|
|
131
|
+
cin: string;
|
|
132
|
+
listing: string;
|
|
133
|
+
industry_code: string;
|
|
134
|
+
state_code: string;
|
|
135
|
+
year: string;
|
|
136
|
+
company_type: string;
|
|
137
|
+
registration_number: string;
|
|
138
|
+
}
|
|
139
|
+
export interface LlpinParsed {
|
|
140
|
+
llpin: string;
|
|
141
|
+
}
|
|
142
|
+
export interface VoterParsed {
|
|
143
|
+
epic: string;
|
|
144
|
+
}
|
|
145
|
+
export interface VehicleParsed {
|
|
146
|
+
registration: string;
|
|
147
|
+
series_type: "state" | "bharat";
|
|
148
|
+
state_code?: string;
|
|
149
|
+
district?: string;
|
|
150
|
+
series: string;
|
|
151
|
+
number: string;
|
|
152
|
+
year?: string;
|
|
153
|
+
suffix?: string;
|
|
154
|
+
}
|
|
155
|
+
export interface DetectParsed {
|
|
156
|
+
type: string | null;
|
|
157
|
+
value: string | null;
|
|
158
|
+
result: ValidationResult | null;
|
|
159
|
+
}
|
|
160
|
+
export interface ValidateManyItemResult {
|
|
161
|
+
input: unknown;
|
|
162
|
+
type: string | null;
|
|
163
|
+
valid: boolean;
|
|
164
|
+
code: string;
|
|
165
|
+
reason_en: string;
|
|
166
|
+
reason_hi: string;
|
|
167
|
+
parsed: unknown;
|
|
168
|
+
}
|
|
169
|
+
export interface ValidateManyParsed {
|
|
170
|
+
results: ValidateManyItemResult[];
|
|
171
|
+
total: number;
|
|
172
|
+
validCount: number;
|
|
173
|
+
invalidCount: number;
|
|
174
|
+
}
|
|
175
|
+
export declare const PAN_ENTITY_TYPES: Record<string, string>;
|
|
176
|
+
export declare const GSTIN_STATE_NAMES: Record<string, string>;
|
|
177
|
+
/** Common UPI handles, verbatim from crates/indycheck/src/data.rs. */
|
|
178
|
+
export declare const UPI_HANDLES: string[];
|
|
179
|
+
export declare const DEFAULT_OPTIONS: Options;
|
|
180
|
+
/** Strict validation (the default): every rule enforced. */
|
|
181
|
+
export declare function defaultOptions(): Options;
|
|
182
|
+
/** Lenient validation: format only — first-digit and checksum checks
|
|
183
|
+
* are skipped. */
|
|
184
|
+
export declare function lenientOptions(): Options;
|
|
185
|
+
/** Start from the defaults and turn off space/hyphen tolerance. */
|
|
186
|
+
export declare function noSpacesHyphensOptions(): Options;
|
|
187
|
+
export declare function validateMobile(input: unknown): ValidationResult<MobileParsed>;
|
|
188
|
+
/** Same as `validateMobile`, with caller-controlled `Options`.
|
|
189
|
+
* With `strict: false` the first-digit rule is skipped (format only). */
|
|
190
|
+
export declare function validateMobileWithOptions(input: unknown, options?: Partial<Options>): ValidationResult<MobileParsed>;
|
|
191
|
+
export declare function formatMobile(input: unknown): ValidationResult<MobileParsed>;
|
|
192
|
+
export declare function formatMobileWithOptions(input: unknown, options?: Partial<Options>): ValidationResult<MobileParsed>;
|
|
193
|
+
/** Masks a mobile number as `******3210` (6 asterisks + last 4 digits).
|
|
194
|
+
* Returns an empty string when the input is not a valid-format mobile
|
|
195
|
+
* number. A non-empty result is not proof of validity. */
|
|
196
|
+
export declare function maskMobile(input: unknown): string;
|
|
197
|
+
export declare function validatePan(input: unknown): ValidationResult<PanParsed>;
|
|
198
|
+
/** Same as `validatePan`, with caller-controlled `Options`.
|
|
199
|
+
* For PAN, `strict`/`lenient` make no difference (there is no checksum or
|
|
200
|
+
* first-digit rule to skip); `uppercase` and `allow_spaces_hyphens` do. */
|
|
201
|
+
export declare function validatePanWithOptions(input: unknown, options?: Partial<Options>): ValidationResult<PanParsed>;
|
|
202
|
+
/** Formats a PAN: upper-cases it and strips spaces/hyphens.
|
|
203
|
+
* Returns `"ABCDE1234F"` when the result matches the PAN pattern,
|
|
204
|
+
* otherwise `null`. */
|
|
205
|
+
export declare function formatPan(input: unknown): string | null;
|
|
206
|
+
/** Masks a PAN as `ABCDE****F` (first 5 chars, 4 asterisks, last char).
|
|
207
|
+
* Returns an empty string when the input is not a valid-format PAN.
|
|
208
|
+
* A non-empty result is not proof of validity — use `validatePan`. */
|
|
209
|
+
export declare function maskPan(input: unknown): string;
|
|
210
|
+
export declare function maskAadhaarString(input: string): string;
|
|
211
|
+
export declare function validateAadhaar(input: unknown): ValidationResult<AadhaarParsed>;
|
|
212
|
+
/** Same as `validateAadhaar`, with caller-controlled `Options`.
|
|
213
|
+
* With `strict: false` the first-digit and Verhoeff checksum checks are
|
|
214
|
+
* skipped (12 digits only). With `allow_spaces_hyphens: false`, spaces
|
|
215
|
+
* or hyphens in the input are an `INVALID_FORMAT` error. */
|
|
216
|
+
export declare function validateAadhaarWithOptions(input: unknown, options?: Partial<Options>): ValidationResult<AadhaarParsed>;
|
|
217
|
+
export declare function maskAadhaar(input: unknown): ValidationResult<AadhaarParsed>;
|
|
218
|
+
export declare function validateGstin(input: unknown): ValidationResult<GstinParsed>;
|
|
219
|
+
/** Same as `validateGstin`, with caller-controlled `Options`.
|
|
220
|
+
* With `strict: false` the Mod-36 check-digit check is skipped (format
|
|
221
|
+
* and state code still checked). With `allow_spaces_hyphens: false`,
|
|
222
|
+
* spaces or hyphens in the input are an `INVALID_FORMAT` error. */
|
|
223
|
+
export declare function validateGstinWithOptions(input: unknown, options?: Partial<Options>): ValidationResult<GstinParsed>;
|
|
224
|
+
/** Formats a GSTIN: upper-cases it and strips spaces/hyphens.
|
|
225
|
+
* Returns the formatted GSTIN when its structure is in place (state
|
|
226
|
+
* code, PAN part and `Z`); the check digit is NOT verified here —
|
|
227
|
+
* so a `formatGstin` result can still fail `validateGstin`.
|
|
228
|
+
* Returns `null` otherwise. */
|
|
229
|
+
export declare function formatGstin(input: unknown): string | null;
|
|
230
|
+
export declare function validateIfsc(input: unknown): ValidationResult<IfscParsed>;
|
|
231
|
+
export declare function validateUpi(input: unknown): ValidationResult<UpiParsed>;
|
|
232
|
+
export declare function validatePincode(input: unknown): ValidationResult<PincodeParsed>;
|
|
233
|
+
export declare function validateTan(input: unknown): ValidationResult<TanParsed>;
|
|
234
|
+
export declare function validateCin(input: unknown): ValidationResult<CinParsed>;
|
|
235
|
+
export declare function validateLlpin(input: unknown): ValidationResult<LlpinParsed>;
|
|
236
|
+
export declare function validateVoterId(input: unknown): ValidationResult<VoterParsed>;
|
|
237
|
+
/** Alias for `validateVoterId`: EPIC is the name printed on the card. */
|
|
238
|
+
export declare function validateEpic(input: unknown): ValidationResult<VoterParsed>;
|
|
239
|
+
export declare function validateVehicle(input: unknown): ValidationResult<VehicleParsed>;
|
|
240
|
+
/** Alias for `validateVehicle`. */
|
|
241
|
+
export declare function validateVehicleRegistration(input: unknown): ValidationResult<VehicleParsed>;
|
|
242
|
+
/** Generates a syntactically valid PAN for the given entity character
|
|
243
|
+
* (`P`, `C`, `H`, `F`, `A`, `T`, `B`, `L`, `J` or `G`).
|
|
244
|
+
* An unknown entity character falls back to `P` (Individual).
|
|
245
|
+
* TEST DATA ONLY — not a real issued PAN. */
|
|
246
|
+
export declare function generatePan(entity?: unknown): string;
|
|
247
|
+
/** Generates a syntactically valid 12-digit Aadhaar number (first digit
|
|
248
|
+
* 2-9, correct Verhoeff check digit).
|
|
249
|
+
* TEST DATA ONLY — not a real issued Aadhaar number. */
|
|
250
|
+
export declare function generateAadhaar(): string;
|
|
251
|
+
/** Generates a syntactically valid GSTIN for the given 2-digit state code
|
|
252
|
+
* (e.g. `"18"` for Assam). An unknown state code falls back to `"18"`.
|
|
253
|
+
* TEST DATA ONLY — not a real issued GSTIN. */
|
|
254
|
+
export declare function generateGstin(stateCode?: unknown): string;
|
|
255
|
+
/** Generates a syntactically valid Indian mobile number (10 digits,
|
|
256
|
+
* first digit 6-9). TEST DATA ONLY — not a real person's number. */
|
|
257
|
+
export declare function generateMobile(): string;
|
|
258
|
+
/** The Rust `detect` string for a trimmed input (lib.rs order). */
|
|
259
|
+
export declare function detectType(input: string): string;
|
|
260
|
+
export declare function detect(input: unknown): ValidationResult<DetectParsed>;
|
|
261
|
+
export declare function validateMany(inputs: unknown): ValidationResult<ValidateManyParsed>;
|
|
262
|
+
declare const _default: {
|
|
263
|
+
validateMobile: typeof validateMobile;
|
|
264
|
+
validatePan: typeof validatePan;
|
|
265
|
+
validateAadhaar: typeof validateAadhaar;
|
|
266
|
+
validateGstin: typeof validateGstin;
|
|
267
|
+
validateIfsc: typeof validateIfsc;
|
|
268
|
+
validateUpi: typeof validateUpi;
|
|
269
|
+
validatePincode: typeof validatePincode;
|
|
270
|
+
validateTan: typeof validateTan;
|
|
271
|
+
validateCin: typeof validateCin;
|
|
272
|
+
validateLlpin: typeof validateLlpin;
|
|
273
|
+
validateVoterId: typeof validateVoterId;
|
|
274
|
+
validateEpic: typeof validateEpic;
|
|
275
|
+
validateVehicle: typeof validateVehicle;
|
|
276
|
+
validateVehicleRegistration: typeof validateVehicleRegistration;
|
|
277
|
+
validateMobileWithOptions: typeof validateMobileWithOptions;
|
|
278
|
+
validatePanWithOptions: typeof validatePanWithOptions;
|
|
279
|
+
validateAadhaarWithOptions: typeof validateAadhaarWithOptions;
|
|
280
|
+
validateGstinWithOptions: typeof validateGstinWithOptions;
|
|
281
|
+
formatMobile: typeof formatMobile;
|
|
282
|
+
formatMobileWithOptions: typeof formatMobileWithOptions;
|
|
283
|
+
formatPan: typeof formatPan;
|
|
284
|
+
formatGstin: typeof formatGstin;
|
|
285
|
+
maskAadhaar: typeof maskAadhaar;
|
|
286
|
+
maskPan: typeof maskPan;
|
|
287
|
+
maskMobile: typeof maskMobile;
|
|
288
|
+
generatePan: typeof generatePan;
|
|
289
|
+
generateAadhaar: typeof generateAadhaar;
|
|
290
|
+
generateGstin: typeof generateGstin;
|
|
291
|
+
generateMobile: typeof generateMobile;
|
|
292
|
+
defaultOptions: typeof defaultOptions;
|
|
293
|
+
lenientOptions: typeof lenientOptions;
|
|
294
|
+
noSpacesHyphensOptions: typeof noSpacesHyphensOptions;
|
|
295
|
+
detect: typeof detect;
|
|
296
|
+
detectType: typeof detectType;
|
|
297
|
+
validateMany: typeof validateMany;
|
|
298
|
+
UPI_HANDLES: string[];
|
|
299
|
+
PAN_ENTITY_TYPES: Record<string, string>;
|
|
300
|
+
GSTIN_STATE_NAMES: Record<string, string>;
|
|
301
|
+
};
|
|
302
|
+
export default _default;
|