1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

15 lines
348 B
Python
Raw Normal View History

import hashlib
import hmac
def generate_signature(request_body, secret):
"""
Return a cryptographic signature that can be used to verify the authenticity of webhook data.
"""
hmac_prep = hmac.new(
key=secret.encode('utf8'),
2020-04-29 00:06:26 -04:00
msg=request_body,
digestmod=hashlib.sha512
)
return hmac_prep.hexdigest()