AuthGuard
AuthGuard is a Python library for building TOTP and WebAuthn authentication flows.
It provides:
- TOTP enrollment, verification, and recovery-code helpers
- WebAuthn registration and authentication services
- in-memory, SQLite, Redis, and PostgreSQL storage backends
- a small, typed service surface built around a
src/package layout
Installation
Install the library:
pip install authguard
For local development:
pip install -e ".[dev]"
Quick Start
import asyncio
from authguard import AuthService, Config, MemoryStorage, User
async def main() -> None:
storage = MemoryStorage()
config = Config(
RP_ID="example.com",
RP_NAME="Example App",
RP_ORIGINS=("https://example.com",),
)
auth = AuthService(storage=storage, config=config)
user = User(id="user-123", name="alice@example.com", display_name="Alice")
enrollment = await auth.totp.begin_enrollment(
user_id=user.id,
user_name=user.name,
)
print(enrollment.provisioning_uri)
registration_options = await auth.webauthn.begin_registration(user=user)
print(registration_options.rp.id)
asyncio.run(main())
Public API
Top-level imports:
from authguard import AuthService, Config, MemoryStorage, User, get_storage
Available storage backends:
MemoryStorageSQLiteStorageRedisStoragePostgreSQLStorage
Running Tests
pytest -q tests/unit
Metadata
Release files for authguard-lib 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| authguard_lib-0.1.0.tar.gz | 16.7 kB | Without provenance | Details for authguard_lib-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| authguard_lib-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for authguard_lib-0.1.0-py3-none-any.whl |
Total release size: 47.6 kB
Release files / authguard_lib-0.1.0.tar.gz
| Download URL | authguard_lib-0.1.0.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac12ad1e1a0d46c39bd7d37e06f40e327966d5b757de2e72da4b4f6f42716664
|
|
BLAKE2b-256 checksum How to use checksums |
b2271ab122f42eea6de2e9352e79d3c527eecbb824524f50c774c80e214a622b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / authguard_lib-0.1.0-py3-none-any.whl
| Download URL | authguard_lib-0.1.0-py3-none-any.whl |
|---|---|
| Size | 30.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9c6a4084a0b51e184686201d4a32610029629274a111c4e2c77e4d51aa76469
|
|
BLAKE2b-256 checksum How to use checksums |
33583c2aa6dd5db3b77c479e4e714d4e5a4d1d384d49462570cd61559b50cc80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Security for authguard-lib 0.1.0
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.