Metadata-Version: 2.4
Name: flyfun-common
Version: 0.3.6
Summary: Shared user management and auth for flyfun services
Project-URL: Homepage, https://flyfun.aero
Project-URL: Repository, https://github.com/roznet/flyfun-common
Author-email: Brice Rosenzweig <brice@ro-z.net>
License-Expression: MIT
License-File: LICENSE
Keywords: auth,fastapi,flyfun,oauth
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Requires-Dist: authlib>=1.3
Requires-Dist: cryptography>=42.0
Requires-Dist: fastapi>=0.109
Requires-Dist: httpx
Requires-Dist: itsdangerous
Requires-Dist: pyjwt>=2.8
Requires-Dist: sqlalchemy>=2.0
Provides-Extra: dev
Requires-Dist: httpx; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Description-Content-Type: text/markdown

# flyfun-common

Shared user management and authentication library for [flyfun](https://flyfun.aero) services.

Provides OAuth login (Google, Apple), JWT session management, user database models, and API token administration — all as reusable FastAPI components.

## Installation

```bash
pip install flyfun-common
```

## Usage

```python
from fastapi import FastAPI
from flyfun_common.auth import create_auth_router
from flyfun_common.db import init_db

app = FastAPI()

# Initialize database
init_db()

# Mount the auth router
app.include_router(create_auth_router())
```

## Configuration

All configuration is via environment variables:

| Variable | Required | Description |
|----------|----------|-------------|
| `JWT_SECRET` | Production | Secret key for signing JWT tokens |
| `DATABASE_URL` | No | SQLAlchemy database URL (defaults to local SQLite) |
| `ENVIRONMENT` | No | `production` or `development` (default) |
| `COOKIE_DOMAIN` | No | Cookie domain for cross-subdomain SSO |
| `GOOGLE_CLIENT_ID` | No | Google OAuth client ID |
| `GOOGLE_CLIENT_SECRET` | No | Google OAuth client secret |
| `APPLE_CLIENT_ID` | No | Apple Sign In service ID |
| `APPLE_TEAM_ID` | No | Apple Developer Team ID |
| `APPLE_KEY_ID` | No | Apple Sign In key ID |
| `APPLE_PRIVATE_KEY` | No | Apple Sign In private key (PEM) |
| `CREDENTIAL_ENCRYPTION_KEY` | Production | Fernet key for encrypting stored credentials |

## License

MIT
