Skip to main content

idverify

ID verification library — OCR, MRZ parsing, screenshot detection, and age gate for government IDs.

Built by ᗰᗩOᑌ · GitHub

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

  1. Preprocessing — OpenCV resizes, grayscales, normalizes, and sharpens the image
  2. OCR — pytesseract extracts all text
  3. MRZ parsing — looks for Machine Readable Zone lines, validates checksums with the mrz package
  4. Fallback extraction — regex-based date and country parsing if no MRZ found
  5. Screenshot detection — exifread checks for camera EXIF metadata (Make, Model)
  6. 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

Metadata

Release files for idverify 0.1.0

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

Source distribution (sdist)

Source distribution for idverify 0.1.0
File Size Uploaded Provenance Actions
idverify-0.1.0.tar.gz 9.9 kB Without provenance Details for idverify-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for idverify 0.1.0
File Interpreter ABI Platform Actions
idverify-0.1.0-py3-none-any.whl Python 3 none any Details for idverify-0.1.0-py3-none-any.whl

Total release size: 20.1 kB

Release files / idverify-0.1.0.tar.gz

Download URL idverify-0.1.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
96681199d642c2e1d1c2bc02c2c2912a339b5824f1431a710a455c25b450f16f
BLAKE2b-256 checksum
How to use checksums
c7aa11c17dcaa7cc35be5804f277f467180abcfd8ac6794c870574d45c675a3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / idverify-0.1.0-py3-none-any.whl

Download URL idverify-0.1.0-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a97a29012aa93baf6ffd550c7d2d01c43980fcac0fbe8712c439ed6252e0d430
BLAKE2b-256 checksum
How to use checksums
4bc230e6c1037431fc0bfb268da9a7c2819ae330d298e2951f3684fecef71f3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for idverify 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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