Why does this signature verification logic fail intermittently during high-volume event ingestion? I am building a Python consumer for Genesys Cloud webhooks to feed sentiment models. I extract the x-genesys-signature header and compare it against an HMAC-SHA256 of the raw body using my client secret. Occasional mismatches occur despite valid secrets.
import hmac, hashlib
sig = request.headers.get('x-genesys-signature')
expected = hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()
assert sig == expected
Is there a specific timestamp validation requirement I am missing?