From c3141df775aa1ef2799ea9cb57ac0aefec13254a Mon Sep 17 00:00:00 2001
From: Jimmy <me@jimmy.nz>
Date: Wed, 23 Feb 2022 10:25:19 +0000
Subject: [PATCH] Check json

---
 app/dependencies.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/app/dependencies.py b/app/dependencies.py
index 9717c6e..8770c94 100644
--- a/app/dependencies.py
+++ b/app/dependencies.py
@@ -6,11 +6,12 @@ from fastapi.exceptions import HTTPException
 async def auth_hook(request: Request):
     try:
         text = await request.body()
-
+        json = await request.json()
     except:
         raise HTTPException(status_code=204, detail="Missing or bad content")
-    header_signature = request.headers.get('X-Hub-Signature')
 
+
+    header_signature = request.headers.get('X-Hub-Signature')
     if not header_signature:
         raise HTTPException(status_code=400, detail="Missing signature")
 
@@ -27,6 +28,7 @@ async def auth_hook(request: Request):
     mac = hmac.new(secret_key.encode(), msg=text, digestmod='sha1')
 
     # verify the digest matches the signature
+    print(f'{mac.hexdigest()} {signature}')
     if not hmac.compare_digest(mac.hexdigest(), signature):
         raise HTTPException(status_code=403, detail="Unauthorized")