Metadata-Version: 2.4
Name: phlow-auth
Version: 0.0.5
Summary: JWT authentication middleware for AI agents with Supabase integration
Project-URL: Documentation, https://prassanna.io/phlow/
Project-URL: Issues, https://github.com/prassanna-ravishankar/phlow/issues
Project-URL: Source, https://github.com/prassanna-ravishankar/phlow
Author: Prassanna Ravishankar
License-Expression: MIT
Keywords: a2a,agent,authentication,jwt,middleware,phlow,supabase
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
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 :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: a2a-sdk>=0.2.11
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pyjwt>=2.8.0
Requires-Dist: supabase>=2.0.0
Requires-Dist: typing-extensions>=4.0.0
Provides-Extra: dev
Requires-Dist: black>=23.0.0; extra == 'dev'
Requires-Dist: flake8>=6.0.0; extra == 'dev'
Requires-Dist: isort>=5.12.0; extra == 'dev'
Requires-Dist: mypy>=1.5.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: twine>=4.0.0; extra == 'dev'
Provides-Extra: django
Requires-Dist: django>=4.2.0; extra == 'django'
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.100.0; extra == 'fastapi'
Provides-Extra: flask
Requires-Dist: flask>=2.3.0; extra == 'flask'
Description-Content-Type: text/markdown

# Phlow Auth Python

JWT authentication middleware for AI agents with Supabase integration.

## Installation

```bash
pip install phlow-auth
```

## Quick Start

```python
from phlow_auth import PhlowMiddleware, PhlowConfig, AgentCard

# Configure your agent
config = PhlowConfig(
    supabase_url="https://your-project.supabase.co",
    supabase_anon_key="your-anon-key",
    agent_card=AgentCard(
        name="My Agent",
        description="AI assistant agent",
        service_url="https://my-agent.com",
        skills=["chat", "analysis"],
        metadata={"agent_id": "my-agent-id", "public_key": "your-public-key"}
    ),
    private_key="your-private-key"
)

# Initialize middleware
phlow = PhlowMiddleware(config)

# Use as decorator with FastAPI
from fastapi import FastAPI, Request

app = FastAPI()

@app.post("/api/chat")
@phlow.authenticate()
async def chat(request: Request):
    # Access agent context
    agent = request.phlow.agent
    supabase = request.phlow.supabase
    return {"message": f"Hello from {agent.name}"}
```

## Features

- **JWT Authentication** - Verify A2A Protocol JWT tokens
- **Agent Storage** - Store and retrieve agent cards from Supabase
- **RLS Helpers** - Generate basic Row Level Security policies
- **Event Logging** - Track authentication events
- **Multi-Framework** - Works with FastAPI, Flask, and Django

## Development

```bash
# Clone the repository
git clone https://github.com/prassanna-ravishankar/phlow.git
cd phlow/packages/phlow-auth-python

# Install development dependencies
uv sync --extra dev

# Run tests
uv run pytest

# Format code
uv run black src tests
uv run isort src tests

# Type checking
uv run mypy src
```

## Documentation

- 📖 Documentation: https://prassanna.io/phlow/
- 🐛 Issues: https://github.com/prassanna-ravishankar/phlow/issues
- 💬 Discussions: https://github.com/prassanna-ravishankar/phlow/discussions

## License

MIT License - see LICENSE file for details.