[feat] inbox checker add logger
This commit is contained in:
parent
6cd142a0a0
commit
157073a4a7
1 changed files with 6 additions and 4 deletions
|
@ -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,
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue