feat/add some precheck
This commit is contained in:
parent
e480f77172
commit
dcd862180e
1 changed files with 13 additions and 5 deletions
|
@ -20,12 +20,17 @@ async def httpsig_checker(
|
|||
Check http signature
|
||||
"""
|
||||
payload = await request.json()
|
||||
logger.info(f"headers={request.headers}")
|
||||
logger.info(f"{payload=}")
|
||||
|
||||
parsec_signature = HttpSignature.parse_signature(
|
||||
request.headers.get("signature")
|
||||
)
|
||||
try:
|
||||
logger.info(f"headers={request.headers}")
|
||||
logger.info(f"{payload=}")
|
||||
|
||||
parsec_signature = HttpSignature.parse_signature(
|
||||
request.headers.get("signature")
|
||||
)
|
||||
except KeyError:
|
||||
logger.warning("Not signature headers")
|
||||
raise KeyError
|
||||
|
||||
actor_url = payload["actor"]
|
||||
async with httpx.AsyncClient() as client:
|
||||
|
@ -43,6 +48,9 @@ async def httpsig_checker(
|
|||
pubkey = _actor["publicKey"]["publicKeyPem"]
|
||||
except json.JSONDecodeError:
|
||||
raise ValueError
|
||||
except KeyError:
|
||||
logger.warning("actor gone? ")
|
||||
raise KeyError
|
||||
|
||||
body = await request.body()
|
||||
signture_string = HttpSignature.build_signature_string(
|
||||
|
|
Loading…
Reference in a new issue