""" Hub middleware — rate limiting on auth endpoints. Uses slowapi (Starlette-compatible, token bucket algorithm). Limits applied to /v1/users/register and /v1/users/login to mitigate credential stuffing and registration floods. """ from slowapi import Limiter from slowapi.util import get_remote_address # Rate limiter instance — mounted on the FastAPI app in app.py limiter = Limiter(key_func=get_remote_address)