Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -25,23 +25,23 @@ async def handle_webhook(
|
|
25 |
@app.post("/webhooks")
|
26 |
async def handle_event_notifications(
|
27 |
request: Request,
|
28 |
-
x_hub_signature_256: Optional[str] = Header(None) # Header for signature verification
|
29 |
):
|
30 |
-
# Read and verify the request body
|
31 |
-
body = await request.body()
|
32 |
|
33 |
-
# Verify the X-Hub-Signature-256 header
|
34 |
-
if not x_hub_signature_256:
|
35 |
-
|
36 |
|
37 |
-
# Compute the expected signature
|
38 |
-
expected_signature = (
|
39 |
-
|
40 |
-
|
41 |
-
)
|
42 |
-
|
43 |
-
if not hmac.compare_digest(expected_signature, x_hub_signature_256):
|
44 |
-
|
45 |
|
46 |
# Parse the JSON payload
|
47 |
payload = await request.json()
|
|
|
25 |
@app.post("/webhooks")
|
26 |
async def handle_event_notifications(
|
27 |
request: Request,
|
28 |
+
# x_hub_signature_256: Optional[str] = Header(None) # Header for signature verification
|
29 |
):
|
30 |
+
# # Read and verify the request body
|
31 |
+
# body = await request.body()
|
32 |
|
33 |
+
# # Verify the X-Hub-Signature-256 header
|
34 |
+
# if not x_hub_signature_256:
|
35 |
+
# raise HTTPException(status_code=400, detail="Missing X-Hub-Signature-256 header")
|
36 |
|
37 |
+
# # Compute the expected signature
|
38 |
+
# expected_signature = (
|
39 |
+
# "sha256="
|
40 |
+
# + hmac.new(VERIFY_TOKEN.encode(), body, hashlib.sha256).hexdigest()
|
41 |
+
# )
|
42 |
+
|
43 |
+
# if not hmac.compare_digest(expected_signature, x_hub_signature_256):
|
44 |
+
# raise HTTPException(status_code=403, detail="Signature verification failed")
|
45 |
|
46 |
# Parse the JSON payload
|
47 |
payload = await request.json()
|