baton/backend/middleware.py

13 lines
345 B
Python
Raw Normal View History

2026-03-20 20:44:00 +02:00
from __future__ import annotations
from fastapi import Header, HTTPException
from backend import config
async def verify_webhook_secret(
x_telegram_bot_api_secret_token: str = Header(default=""),
) -> None:
if x_telegram_bot_api_secret_token != config.WEBHOOK_SECRET:
raise HTTPException(status_code=403, detail="Forbidden")