Skip to main content

tezz-auth (Python SDK)

Official Python SDK for Tezz Auth (account.tezzcorp.com).

  • End-to-End RSA-OAEP Encryption - passwords encrypted via cryptography before transmission
  • Multiple Account Conflict Resolution (TezzConflictError) with actionable choice branching
  • Anti-Enumeration & Per-User Lockout Protection
  • Type Hints & Dataclass Models (TezzUser, AuthResponse)
  • Automated Public Key Caching with TTL
  • Session Management & Connection Pooling via requests.Session

Installation

pip install tezz-auth

Quick Start

The SDK comes with https://account.tezzcorp.com pre-configured out of the box. You do not need to configure any URL.

from tezz_auth import TezzAuthClient

# Automatically connects to https://account.tezzcorp.com
client = TezzAuthClient()

Optional Custom Endpoint: If you are self-hosting or testing locally, you can optionally override base_url:

client = TezzAuthClient(base_url="https://auth.yourdomain.com")

Complete Usage Examples

1. Check Availability (Email or Phone)

is_available = client.check_availability("email", "rohit@example.com")
print(f"Email available: {is_available}")

2. User Registration & Multiple Account Conflict Resolution

When an account with the provided email or phone already exists, the SDK raises TezzConflictError containing conflict_field ('email', 'phone', or 'both'):

from tezz_auth import (
    TezzAuthClient,
    TezzConflictError,
    TezzValidationError,
    TezzRateLimitError,
)

client = TezzAuthClient()

try:
    reg = client.register(
        full_name="Rohit Sharma",
        email="rohit@example.com",
        phone_number="+919876543210",
        password="SecurePassword@123",
        confirm_password="SecurePassword@123",
    )
    print(f"[OK] User registered! UUID: {reg.user.uuid}")
    print(f"[OK] JWT Token: {reg.token}")

except TezzConflictError as e:
    print(f"[WARN] Account conflict ({e.conflict_field}): {e.message}")

    # Guide user based on which credential matched:
    if e.conflict_field == "email":
        print("  1. Sign in with rohit@example.com")
        print("  2. Reset password via email OTP")
        print("  3. Register with a different email")
    elif e.conflict_field == "phone":
        print("  1. Sign in with +919876543210")
        print("  2. Reset password via SMS OTP")
        print("  3. Register with a different phone number")
    elif e.conflict_field == "both":
        print("  1. Sign in to existing account")
        print("  2. Recover password")

except TezzValidationError as e:
    print(f"Validation error: {e.errors}")
except TezzRateLimitError as e:
    print(f"Rate limited: wait {e.lockout_seconds}s")

3. User Login

login = client.login("rohit@example.com", "SecurePassword@123")
print(f"Welcome back, {login.user.full_name}!")
print(f"Session Token: {login.token}")

4. Forgot Password Flow

# Step 1: Request OTP (email or SMS)
forgot = client.forgot_password(identifier="rohit@example.com", channel="email")
print(forgot.message)

# Step 2: Verify OTP and update password
reset = client.reset_password(
    identifier="rohit@example.com",
    channel="email",
    otp_code="123456",
    new_password="BrandNewPassword@456",
    confirm_new_password="BrandNewPassword@456",
)
print(reset.message)  # "Password has been reset successfully. You can now log in."

5. Fetch User Profile & Verification Status

# Fetch user profile, real-time verification status, and deletion schedule
profile = client.get_profile(token=user_token)
print(f"User Name: {profile.user.full_name}")
print(f"Email Verified: {profile.user.is_email_verified}")
print(f"Phone Verified: {profile.user.is_phone_verified}")

if profile.user.is_deletion_pending:
    print(f"Account deletion scheduled for: {profile.user.scheduled_purge_at}")

6. Cancel Pending Account Deletion

# Cancel pending 14-day deletion request
cancel_res = client.cancel_deletion(token=user_token)
print(cancel_res.message)  # "Account deletion request has been cancelled successfully."

7. Local RS256 JWT Verification (Offline)

import jwt

# Get cached server public key
public_key_pem = client.get_public_key()

try:
    payload = jwt.decode(
        user_jwt_token,
        public_key_pem,
        algorithms=["RS256"],
    )
    print("User UUID:", payload["sub"])
    print("User Email:", payload["email"])
except jwt.InvalidTokenError as e:
    print("Invalid token:", e)

Error Hierarchy

TezzAuthError (base)
 ├── TezzConflictError (status_code: 409, conflict_field: 'email' | 'phone' | 'both')
 ├── TezzRateLimitError (status_code: 429, remaining_attempts, lockout_seconds)
 └── TezzValidationError (status_code: 422, errors: List[dict])

License

MIT License - Copyright (c) 2026 TezzCorp Pvt. Ltd.

Metadata

Release files for tezz-auth 2.0.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 tezz-auth 2.0.0
File Size Uploaded
tezz_auth-2.0.0.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tezz-auth 2.0.0
File Interpreter ABI Platform
tezz_auth-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.1 kB

Release files / tezz_auth-2.0.0.tar.gz

Download URL tezz_auth-2.0.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c96416d3b8e597cb5b1fe4c78808438b2a95372ae3ec8e35d2e97b69806d423c
BLAKE2b-256 checksum
How to use checksums
ce9e0b525e36b1288a31ff993d56778609f73d8b027d9a420db23a9b43c40e57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / tezz_auth-2.0.0-py3-none-any.whl

Download URL tezz_auth-2.0.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e4deebfa00c227fa1368ea30d2bf014219f29136c273f8b43a7af6a2b8bc155
BLAKE2b-256 checksum
How to use checksums
7f0289ab2d27d83785527b2d7378b35d0c3b6bc059ac9779f32960b1423370ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.0

2 release 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