COSCUP-ap-demo/demo/utils/checker.py

20 lines
449 B
Python
Raw Normal View History

2023-06-13 08:14:28 +02:00
"""Request checker"""
2023-06-13 08:11:29 +02:00
from flask import Request, abort
from demo.httpsig import HttpSignature
def inbox_prechecker(
request: Request,
) -> bool:
2023-06-13 08:14:28 +02:00
"""Inbox request prechecker"""
2023-06-13 08:11:29 +02:00
try:
payload = request.headers
parsec_signature = HttpSignature.parse_signature(
payload["signature"]
)
print(parsec_signature)
except KeyError:
abort(401, "Missing signature key!")
return True