Skip to main content

Aegis Auth - Python SDK

Aegis Auth is a unified identity management system providing memory-safe Rust-based authentication. Consolidation of disparate identity providers into a single canonical source.

Aegis Auth by Navchetna Technologies.
Securing the future of decentralized identity.
© 2026 Standard Core v3.


Official Python SDK for the Aegis Authentication System. Supports traditional authentication, WebAuthn/Passkeys, MFA, and more.

Installation

pip install aegis-auth-navchetna

Quick Start

from aegis_auth import AegisAuth

# Initialize the client
aegis = AegisAuth(api_key="your-api-key-here")

# Login
try:
    response = aegis.login("user@example.com", "password")
    print(f"Logged in: {response['user']['email']}")
except Exception as e:
    print(f"Login failed: {e}")

# Check authentication status
if aegis.is_authenticated():
    print("User is authenticated")
    user = aegis.get_user()
    print(f"Current user: {user['email']}")

Authentication Methods

Email/Password Authentication

# Login
response = aegis.login("user@example.com", "password")
print(f"Access token: {response['access_token']}")

# Register
response = aegis.register(
    email="user@example.com",
    password="securePassword123",
    first_name="John",
    last_name="Doe"
)
print("Registration successful")

# Logout
aegis.logout()

Password Reset

# Request password reset
aegis.forgot_password("user@example.com")
print("Password reset email sent")

# Reset password with token
aegis.reset_password("reset-token", "newPassword123")
print("Password reset successful")

Multi-Factor Authentication (MFA)

# Enable MFA
mfa_data = aegis.enable_mfa()
print(f"QR Code: {mfa_data['qr_code']}")
print(f"Secret: {mfa_data['secret']}")
print(f"Backup codes: {mfa_data['backup_codes']}")

# Verify MFA code
aegis.verify_mfa("123456")
print("MFA verified")

# Disable MFA
aegis.disable_mfa("123456")
print("MFA disabled")

User Profile Management

# Get profile
profile = aegis.get_profile()
print(f"User profile: {profile}")

# Update profile
updated_profile = aegis.update_profile({
    "first_name": "Jane",
    "last_name": "Smith",
    "phone": "+1234567890"
})
print("Profile updated")

Event Handling

# Register event handlers
def on_login(user):
    print(f"User logged in: {user['email']}")

def on_logout():
    print("User logged out")

def on_error(error_data):
    print(f"Error: {error_data['error']}")

aegis.on('login', on_login)
aegis.on('logout', on_logout)
aegis.on('error', on_error)

Token Management

# Check authentication status
if aegis.is_authenticated():
    print("User is authenticated")

# Get current user
user = aegis.get_user()
if user:
    print(f"Current user: {user['email']}")

# Get access token
token = aegis.get_access_token()
if token:
    print(f"Access token: {token}")

# Manual token refresh
try:
    response = aegis.refresh_access_token()
    print("Token refreshed successfully")
except Exception as e:
    print(f"Token refresh failed: {e}")

Configuration

from aegis_auth import AegisAuth

# Basic configuration
aegis = AegisAuth(api_key="your-api-key")

# Custom base URL
aegis = AegisAuth(
    api_key="your-api-key",
    base_url="https://your-aegis-instance.com"
)

# Using convenience function
from aegis_auth import create_client

aegis = create_client(api_key="your-api-key")

Error Handling

from aegis_auth import AegisAuth, AegisAuthError

aegis = AegisAuth(api_key="your-api-key")

try:
    aegis.login("user@example.com", "wrongpassword")
except AegisAuthError as e:
    if "Invalid credentials" in str(e):
        print("Please check your email and password")
    elif "Network" in str(e):
        print("Please check your internet connection")
    else:
        print(f"Authentication error: {e}")
except Exception as e:
    print(f"Unexpected error: {e}")

Advanced Usage

Custom Request Headers

# The SDK automatically handles API key and authorization headers
# For custom headers, you can extend the session:

aegis.session.headers.update({
    'Custom-Header': 'value'
})

Automatic Token Refresh

The SDK automatically refreshes tokens 1 minute before expiry. You can listen for refresh events:

def on_token_refresh(user):
    print(f"Token refreshed for user: {user['email']}")

aegis.on('token_refresh', on_token_refresh)

Requirements

  • Python 3.7+
  • requests >= 2.25.0

Security Best Practices

  1. Never expose your API key in client-side code or version control
  2. Use environment variables to store sensitive configuration
  3. Implement proper error handling to avoid exposing sensitive information
  4. Use HTTPS in production environments
  5. Implement logout functionality to clear tokens when users sign out

Support


Aegis Auth by Navchetna Technologies
Securing the future of decentralized identity
© 2026 Standard Core v3

License

MIT License - see LICENSE file for details.

Metadata

Release files for aegis-auth-navchetna 1.0.2

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

Source distribution (sdist)

Source distribution for aegis-auth-navchetna 1.0.2
File Size Uploaded Provenance
aegis_auth_navchetna-1.0.2.tar.gz 4.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aegis-auth-navchetna 1.0.2
File Interpreter ABI Platform
aegis_auth_navchetna-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / aegis_auth_navchetna-1.0.2.tar.gz

Download URL aegis_auth_navchetna-1.0.2.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3d820fa2d3ec4629f9b40227ad1516a51c886776dd318645b3368f6c7d198ebc
BLAKE2b-256 checksum
How to use checksums
892822c2e4dc2fef56026bdc318c16da0e3f4fadda125bd2e4731d7ebc88556d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / aegis_auth_navchetna-1.0.2-py3-none-any.whl

Download URL aegis_auth_navchetna-1.0.2-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5157a8e7071310b70ed1693983c0efbfc57e9f41d907a80faab3292f0a949059
BLAKE2b-256 checksum
How to use checksums
65be513095755d9255c10f54a47b995a57f549cba62e9d561c5dd0daa4620e3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for aegis-auth-navchetna 1.0.2

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.

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