"""Bearer-token guard for Bolna-facing tool endpoints.""" from fastapi import Header, HTTPException import config async def require_token(authorization: str = Header(default="")) -> None: if not config.BACKEND_API_TOKEN: return # auth disabled (local dev) token = authorization.removeprefix("Bearer ").strip() if token != config.BACKEND_API_TOKEN: raise HTTPException(status_code=401, detail="Invalid or missing API token")