Validate and decode national ID numbers — extract structured data from government-issued personal IDs
Project description
nidx
Validate and extract information from national ID numbers across multiple countries.
The core library is written in Rust with zero dependencies and provides bindings for Python and JavaScript/WASM.
Supported countries
| Country | Module | Extracted fields |
|---|---|---|
| Albania | albania |
Date of birth, sex, national status |
Installation
Rust
[dependencies]
nidx = "0.1"
Optional serde support:
[dependencies]
nidx = { version = "0.1", features = ["serde"] }
Python
pip install nidx
JavaScript / TypeScript
npm install nidx
Usage
Rust
use nidx::albania;
use nidx::Sex;
fn main() {
let info = albania::decode("J00101999W").unwrap();
println!("{}", info.birthday); // 1990-01-01
println!("{}", info.sex); // M
println!("{}", info.is_national); // true
assert!(albania::is_valid("J00101999W"));
assert!(!albania::is_valid("invalid"));
}
Python
from nidx import albania
info = albania.decode("J00101999W")
print(info.birthday) # 1990-01-01
print(info.sex) # M
print(info.is_national) # True
print(info.year) # 1990
print(info.month) # 1
print(info.day) # 1
assert albania.is_valid("J00101999W")
assert not albania.is_valid("invalid")
decode raises ValueError on invalid input.
JavaScript
import { albaniaDecode, albaniaIsValid } from "nidx";
const info = albaniaDecode("J00101999W");
console.log(info.birthday); // "1990-01-01"
console.log(info.sex); // "M"
console.log(info.isNational); // true
console.log(info.year); // 1990
console.log(info.month); // 1
console.log(info.day); // 1
console.log(albaniaIsValid("J00101999W")); // true
console.log(albaniaIsValid("invalid")); // false
albaniaDecode throws on invalid input.
API
Each country module exposes decode(nid) -> NidInfo and is_valid(nid) -> bool.
Albania
albania::decode(nid) validates and decodes a 10-character Albanian NID string. Input is case-insensitive.
NidInfo fields:
| Field | Rust | Python | JavaScript |
|---|---|---|---|
| Date of birth (ISO 8601) | birthday: Date |
birthday: str |
birthday: string |
| Year | birthday.year: u16 |
year: int |
year: number |
| Month | birthday.month: u8 |
month: int |
month: number |
| Day | birthday.day: u8 |
day: int |
day: number |
| Sex | sex: Sex |
sex: str |
sex: string |
| National | is_national: bool |
is_national: bool |
isNational: boolean |
Contributing
See CONTRIBUTING.md.
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nidx-0.1.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: nidx-0.1.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 130.8 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a52bf2b36d59e07707d2341e037e22319a8b193d743dd6a328ba3a7175ed80b6
|
|
| MD5 |
4aca96613bd51ad54df433dfcc70bde1
|
|
| BLAKE2b-256 |
807bff51cddd7feb67f10e7ab0a67d2c3c04946deec8fb40f77b8f11d136b33b
|
Provenance
The following attestation bundles were made for nidx-0.1.0-cp312-cp312-win_amd64.whl:
Publisher:
release.yml on dedal-io/nidx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nidx-0.1.0-cp312-cp312-win_amd64.whl -
Subject digest:
a52bf2b36d59e07707d2341e037e22319a8b193d743dd6a328ba3a7175ed80b6 - Sigstore transparency entry: 1003781850
- Sigstore integration time:
-
Permalink:
dedal-io/nidx@36a352fbb92ec618b739d4cb67da1904b33c8f0e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dedal-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@36a352fbb92ec618b739d4cb67da1904b33c8f0e -
Trigger Event:
push
-
Statement type:
File details
Details for the file nidx-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: nidx-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 273.2 kB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ad33042afe6f9adc84a5499ac3c54b37177246d12da7bb0a51653cc292f30a3
|
|
| MD5 |
2db5db82404f8873c7b5960938a58dbb
|
|
| BLAKE2b-256 |
026b36575ffb458522970974080c3d09f93447cf7f7e5556c8c1861f3d9c6064
|
Provenance
The following attestation bundles were made for nidx-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl:
Publisher:
release.yml on dedal-io/nidx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nidx-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl -
Subject digest:
8ad33042afe6f9adc84a5499ac3c54b37177246d12da7bb0a51653cc292f30a3 - Sigstore transparency entry: 1003781852
- Sigstore integration time:
-
Permalink:
dedal-io/nidx@36a352fbb92ec618b739d4cb67da1904b33c8f0e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dedal-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@36a352fbb92ec618b739d4cb67da1904b33c8f0e -
Trigger Event:
push
-
Statement type:
File details
Details for the file nidx-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: nidx-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 241.3 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4025e099e9e2d5f187c2f39ec79a2a2cdc2f285ee9b4acb4933deb7f69d8c4d7
|
|
| MD5 |
4e1b8435dedc08666e60060a371c5ea3
|
|
| BLAKE2b-256 |
1c19b5101484b73662ff7f2cb663da5d5de59b3340528056a47577fd3af6a67e
|
Provenance
The following attestation bundles were made for nidx-0.1.0-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
release.yml on dedal-io/nidx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nidx-0.1.0-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
4025e099e9e2d5f187c2f39ec79a2a2cdc2f285ee9b4acb4933deb7f69d8c4d7 - Sigstore transparency entry: 1003781844
- Sigstore integration time:
-
Permalink:
dedal-io/nidx@36a352fbb92ec618b739d4cb67da1904b33c8f0e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dedal-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@36a352fbb92ec618b739d4cb67da1904b33c8f0e -
Trigger Event:
push
-
Statement type: