mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-19 22:18:17 -06:00
14132 fix
This commit is contained in:
parent
aa8ed1194a
commit
36285db2ca
14
netbox/extras/webhooks.py
Normal file
14
netbox/extras/webhooks.py
Normal 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()
|
Loading…
Reference in New Issue
Block a user