From 157073a4a77400e86053fc38b00a11290615c58c Mon Sep 17 00:00:00 2001 From: SouthFox Date: Thu, 27 Jul 2023 22:11:43 +0800 Subject: [PATCH] [feat] inbox checker add logger --- demo/utils/checker.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/demo/utils/checker.py b/demo/utils/checker.py index 6309a0a..474e417 100644 --- a/demo/utils/checker.py +++ b/demo/utils/checker.py @@ -4,17 +4,19 @@ import json from flask import Request, abort from demo.httpsig import HttpSignature, SignedData from demo.actor import fetch_actor +from app import logger def inbox_prechecker( request: Request, ) -> bool: """Inbox request prechecker""" - payload = request.headers - ap_body = request.data + headers = request.headers + payload = request.data + logger.debug(f"new request {payload=}\n{headers=}") try: parsed_signature = HttpSignature.parse_signature( - payload["signature"] + headers["signature"] ) except KeyError: abort(401, "Missing signature key!") @@ -34,7 +36,7 @@ def inbox_prechecker( method = request.method, path = request.path, signed_list = parsed_signature["headers"], - body_digest = HttpSignature.calculation_digest(ap_body), + body_digest = HttpSignature.calculation_digest(payload), headers = request.headers, )