# NIKAME GENERATED — DO NOT EDIT DIRECTLY
import hmac
import hashlib
from fastapi import Request, HTTPException, Header

async def verify_signature(request: Request, x_signature: str = Header(...)):
    # In production, load this from secret management
    secret = b"webhook_secret_key"
    payload = await request.body()
    expected_signature = hmac.new(secret, payload, hashlib.sha256).hexdigest()
    
    if not hmac.compare_digest(expected_signature, x_signature):
        raise HTTPException(status_code=401, detail="Invalid signature")
    return True
