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

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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

idverify-0.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

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

Hashes for idverify-0.1.0.tar.gz
Algorithm Hash digest
SHA256 96681199d642c2e1d1c2bc02c2c2912a339b5824f1431a710a455c25b450f16f
MD5 d330307b852d021623dda2197af80012
BLAKE2b-256 c7aa11c17dcaa7cc35be5804f277f467180abcfd8ac6794c870574d45c675a3f

See more details on using hashes here.

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

Hashes for idverify-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a97a29012aa93baf6ffd550c7d2d01c43980fcac0fbe8712c439ed6252e0d430
MD5 5f66aa3b56787893efd4b14b0ef4b6bb
BLAKE2b-256 4bc230e6c1037431fc0bfb268da9a7c2819ae330d298e2951f3684fecef71f3e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

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