Metadata-Version: 2.4
Name: authguard-lib
Version: 0.1.0
Summary: Authentication helpers for WebAuthn and TOTP flows.
Keywords: authentication,mfa,passkeys,totp,webauthn
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: aiosqlite>=0.20.0
Requires-Dist: asyncpg>=0.29.0
Requires-Dist: cryptography>=41.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pyotp>=2.9.0
Requires-Dist: redis>=5.0.0
Requires-Dist: webauthn>=2.0.0
Provides-Extra: dev
Requires-Dist: build>=1.2.0; extra == 'dev'
Requires-Dist: fastapi>=0.135.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: uvicorn>=0.35.0; extra == 'dev'
Description-Content-Type: text/markdown

# 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:

```bash
pip install authguard
```

For local development:

```bash
pip install -e ".[dev]"
```

## Quick Start

```python
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:

```python
from authguard import AuthService, Config, MemoryStorage, User, get_storage
```

Available storage backends:

- `MemoryStorage`
- `SQLiteStorage`
- `RedisStorage`
- `PostgreSQLStorage`


## Running Tests

```bash
pytest -q tests/unit
```
