HACKv0.1.0
Toolkit Reference

Middleware

Instead of decorating individual endpoints, mount HACK as ASGI middleware to protect entire routers.

python
from fastapi import FastAPI
from hack.toolkit import HackMiddleware

app = FastAPI()
app.add_middleware(HackMiddleware, protected_prefixes=["/api/premium"])

Middleware and decorators can be mixed. The decorator wins on a per-route basis.