[fix] expected byte, not str

This commit is contained in:
Laurent Peuch 2019-02-05 23:17:23 +01:00
parent 1b522269bb
commit 1c65204847

View file

@ -39,7 +39,7 @@ async def github(request):
abort(501)
# HMAC requires the key to be bytes, but data is string
mac = hmac.new(str(secret), msg=request.body, digestmod=hashlib.sha1)
mac = hmac.new(secret.encode(), msg=request.body, digestmod=hashlib.sha1)
if not hmac.compare_digest(str(mac.hexdigest()), str(signature)):
abort(403)