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. 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 1.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 1.0.0
File Size Uploaded
tezz_auth-1.0.0.tar.gz 7.2 kB Details

Built distribution (wheel)

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

Total release size: 14.0 kB

Release files / tezz_auth-1.0.0.tar.gz

Download URL tezz_auth-1.0.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bc86a05d933c4e5bbfcd89f261d0976a95d92fc605d6935108a5224766815591
BLAKE2b-256 checksum
How to use checksums
d3b4813705505150892130a2a9349aee8ece45a9faf13021e16ab2d85c1d4487
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-1.0.0-py3-none-any.whl

Download URL tezz_auth-1.0.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a899cbbc8036d287048a0f595a6577980b73a2e717c4011d25678843bc8144c
BLAKE2b-256 checksum
How to use checksums
ceaa764ef3396843f295fcbd472cc53a736d80e397bcbbb8f093ee00a72675b4
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

2.0.0

2 release files

This release

1.0.0 This release

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