14132 fix

This commit is contained in:
Arthur 2023-11-01 07:41:26 -07:00
parent aa8ed1194a
commit 36285db2ca

14
netbox/extras/webhooks.py Normal file
View File

@ -0,0 +1,14 @@
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'),
msg=request_body,
digestmod=hashlib.sha512
)
return hmac_prep.hexdigest()