Skip to content

Instantly share code, notes, and snippets.

@leafusergithub
Last active December 8, 2021 17:09
Show Gist options
  • Save leafusergithub/93458e6dbec4d6efc84bf18936953f54 to your computer and use it in GitHub Desktop.
Save leafusergithub/93458e6dbec4d6efc84bf18936953f54 to your computer and use it in GitHub Desktop.
Alerts verify event
# Sign the request body received with your secret
expected_sig = hmac.digest(msg=request_body_bytes,
key=bytes('your secret', 'utf-8'),
digest='sha256')
# Get the signature in the X-Leaf-Signature header
request_sig = base64.b64decode(sig_header)
# Compare both
hmac.compare_digest(expected_sig, request_sig)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment