idverify
ID verification library — OCR, MRZ parsing, screenshot detection, and age gate for government IDs.
Install
pip install idverify
Usage
from idverify import verify_id, check_age
with open('./passport.jpg', 'rb') as f:
buffer = f.read()
# Full verification
result = verify_id(buffer)
print(result.status) # "valid" | "expired" | "invalid"
print(result.documentType) # "passport" | "drivers_license" | ...
print(result.checksum) # "passed" | "failed" | "not_applicable"
print(result.screenshotDetected) # False
# Age gate only (no birthdate exposed)
age = check_age(buffer)
print(age.over18) # True
print(age.over21) # False
API
verify_id(buffer: bytes) -> VerificationResult
Accepts an image buffer (PNG, JPG, WebP). Returns:
| Field | Type | Description |
|---|---|---|
id |
str |
Unique scan UUID |
documentType |
str |
passport / drivers_license / national_id / unknown |
issuingCountry |
str |
ISO country code |
expiryDate |
str | None |
YYYY-MM-DD |
status |
str |
valid / expired / invalid |
checksum |
str |
passed / failed / not_applicable |
screenshotDetected |
bool |
EXIF-based detection |
confidence |
int |
0–100 |
over18 |
bool | None |
None if DOB not found |
over21 |
bool | None |
None if DOB not found |
check_age(buffer: bytes) -> AgeGateResult
Returns { over18: bool, over21: bool } without exposing the full birthdate.
How it works
- Preprocessing — OpenCV resizes, grayscales, normalizes, and sharpens the image
- OCR — pytesseract extracts all text
- MRZ parsing — looks for Machine Readable Zone lines, validates checksums with the
mrzpackage - Fallback extraction — regex-based date and country parsing if no MRZ found
- Screenshot detection — exifread checks for camera EXIF metadata (Make, Model)
- Age gate — calculates age from DOB without returning the raw date
Requirements
- Python 3.9+
- Tesseract OCR installed on your system
Install Tesseract
| OS | Command |
|---|---|
| macOS | brew install tesseract |
| Ubuntu/Debian | sudo apt-get install tesseract-ocr |
| Windows | Download from UB-Mannheim/tesseract |
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
idverify-0.1.0.tar.gz
(9.9 kB
view details)
Built Distribution
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
idverify-0.1.0-py3-none-any.whl
(10.2 kB
view details)
File details
Details for the file idverify-0.1.0.tar.gz.
File metadata
- Download URL: idverify-0.1.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96681199d642c2e1d1c2bc02c2c2912a339b5824f1431a710a455c25b450f16f
|
|
| MD5 |
d330307b852d021623dda2197af80012
|
|
| BLAKE2b-256 |
c7aa11c17dcaa7cc35be5804f277f467180abcfd8ac6794c870574d45c675a3f
|
File details
Details for the file idverify-0.1.0-py3-none-any.whl.
File metadata
- Download URL: idverify-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a97a29012aa93baf6ffd550c7d2d01c43980fcac0fbe8712c439ed6252e0d430
|
|
| MD5 |
5f66aa3b56787893efd4b14b0ef4b6bb
|
|
| BLAKE2b-256 |
4bc230e6c1037431fc0bfb268da9a7c2819ae330d298e2951f3684fecef71f3e
|