Skip to main content

Python SDK for the FaceVault identity verification API

Project description

FaceVault Python SDK

PyPI version Python versions License: MIT Tests

Python client for the FaceVault identity verification API — privacy-first KYC with liveness detection, face matching, and document verification.

Features

  • Sync & async clients — use FaceVaultClient or AsyncFaceVaultClient
  • Webhook verification — HMAC-SHA256 signature validation
  • Typed models — dataclasses for sessions, status, and webhook events
  • Secure by default — HTTPS enforced, API keys validated, secrets redacted from logs
  • Lightweight — only depends on httpx

Installation

pip install facevault

Quick start

Sync

from facevault import FaceVaultClient

client = FaceVaultClient("fv_live_your_api_key")

# Create a verification session
session = client.create_session(external_user_id="user-123")
print(session.webapp_url)  # Send this URL to your user

# With proof of address required
session = client.create_session(external_user_id="user-123", require_poa=True)

# Check session status
status = client.get_session(session.session_id)
print(status.status)           # "in_progress", "passed", "failed", "review"
print(status.trust_score)      # 0-100 trust score
print(status.trust_decision)   # "accept", "review", "reject"

client.close()

Async

from facevault import AsyncFaceVaultClient

async def verify_user():
    async with AsyncFaceVaultClient("fv_live_your_api_key") as client:
        session = await client.create_session(external_user_id="user-123")
        print(session.webapp_url)

Webhook verification

from facevault import verify_signature, parse_event

# Verify the webhook signature
body = request.body
signature = request.headers["X-Signature"]

if verify_signature(body, signature, secret="your_webhook_secret"):
    event = parse_event(body)
    print(event.event)             # "verification.completed"
    print(event.session_id)
    print(event.face_match_passed)
    print(event.trust_score)       # 0-100
    print(event.trust_decision)    # "accept", "review", "reject"
    print(event.sanctions_hit)     # True/False

Error handling

from facevault import FaceVaultClient, AuthError, NotFoundError, RateLimitError

client = FaceVaultClient("fv_live_your_api_key")

try:
    session = client.get_session("nonexistent")
except AuthError:
    print("Invalid API key")
except NotFoundError:
    print("Session not found")
except RateLimitError:
    print("Too many requests")

Security

The SDK enforces security best practices out of the box:

  • HTTPS onlyhttp:// URLs are rejected at init to prevent credentials leaking over plaintext
  • Key validation — empty or whitespace-only API keys raise ValueError immediately
  • Secret redactionSession.__repr__ masks session_token and URL tokens, safe for logging
  • Client redactionFaceVaultClient.__repr__ masks the API key
  • Path traversal protectionget_session() validates session IDs

What's new in 1.0.0

  • require_poa parameter on create_session() — per-session proof of address override
  • trust_score and trust_decision on SessionStatus — unified 0-100 trust score
  • require_poa, poa, anti_spoofing, credential on SessionStatus
  • trust_score, trust_decision, sanctions_hit, poa on WebhookEvent
  • challenge_nonce on Session — capture integrity nonce

Documentation

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

facevault-1.0.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

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

facevault-1.0.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file facevault-1.0.0.tar.gz.

File metadata

  • Download URL: facevault-1.0.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for facevault-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1e09a70985167fc1bbc9c9915fb0136ca5d138f14890f27b2ce99a6acab1bf07
MD5 8a2b9d4bd3b6e7d6f96b508a93d666ac
BLAKE2b-256 19a81e541680acd66867092d3f31fdcb3c50e1e99f94cffb9236760146470e21

See more details on using hashes here.

File details

Details for the file facevault-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: facevault-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for facevault-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fdc5f39c7fc32376db4c1677e21b4bbd560b36662d3c2c183194f18f73e43d3b
MD5 5837ffdc2cecaeefe101c2f9780f1c85
BLAKE2b-256 48800dfa4fe096dd240c33d5f42f37b6c4ba75e4a2c7c35333e7c7d14c8826f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page