Zero-knowledge proof authentication SDK for Python
Project description
ZKAuth Python SDK
Zero-knowledge proof authentication for Python applications.
Installation
pip install zkauth-sdk
Quick Start
Basic Usage
from zkauth import ZKAuthClient
client = ZKAuthClient(
api_key="your-api-key",
base_url="https://zkauth-engine.vercel.app"
)
# Sign up a new user
signup_result = await client.sign_up(
email="user@example.com",
password="secure-password"
)
# Sign in
signin_result = await client.sign_in(
email="user@example.com",
password="secure-password"
)
if signin_result.success:
print(f"User authenticated: {signin_result.user.email}")
Django Integration
# settings.py
INSTALLED_APPS = [
# ... other apps
'zkauth.integrations.django',
]
ZKAUTH_CONFIG = {
'API_KEY': 'your-api-key',
'BASE_URL': 'https://zkauth-engine.vercel.app',
}
# views.py
from zkauth.integrations.django import zkauth_required
@zkauth_required
def protected_view(request):
user = request.zkauth_user
return JsonResponse({'user': user.email})
FastAPI Integration
from fastapi import FastAPI, Depends
from zkauth.integrations.fastapi import ZKAuthMiddleware, get_current_user
app = FastAPI()
# Add ZKAuth middleware
app.add_middleware(
ZKAuthMiddleware,
api_key="your-api-key",
base_url="https://zkauth-engine.vercel.app"
)
@app.get("/protected")
async def protected_route(user = Depends(get_current_user)):
return {"user": user.email}
Features
- ✅ Async/await support
- ✅ Django and FastAPI integrations
- ✅ Type hints with Pydantic models
- ✅ Comprehensive error handling
- ✅ Session management
- ✅ Device fingerprinting
- ✅ Python 3.8+ support
API Reference
See python.md for complete API documentation.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zkauth-sdk-1.0.0.tar.gz
(9.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zkauth-sdk-1.0.0.tar.gz.
File metadata
- Download URL: zkauth-sdk-1.0.0.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
501b176e0205f4a70011e7a038561a26427cadd5cccddf8398369ec1298ee53a
|
|
| MD5 |
cfd3d8825b084fdf929a93f1a2a93712
|
|
| BLAKE2b-256 |
cc47827cde74a2505f1d025d278e0ba9bd241c734de7e257deaab7527429c77d
|
File details
Details for the file zkauth_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: zkauth_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
098c3ba77b587e6b304201e8ec28c84bdd280dd89fa5b0ab7fce780f90fb17c1
|
|
| MD5 |
a65d4339425bb970a91fce1b6667f471
|
|
| BLAKE2b-256 |
99ec0522dd4c26f2210172b06b1d6e8c5ad7dbaa275e4f5d92853350043bf5aa
|