Skip to content

chore: support HMAC-SHA256 webhook signatures in RequestValidator - #987

Merged
shrutiburman merged 1 commit into
mainfrom
hmac-sha256-request-validator
Nov 4, 2026
Merged

shrutiburman merged 1 commit into
mainfrom
hmac-sha256-request-validator

Conversation

@sbansla

@sbansla sbansla commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds HMAC-SHA256 support to RequestValidator, for webhooks Twilio signs with a SharedKey.

Changes

  • validate(...) and compute_signature(...) take an optional algorithm: HMAC_SHA1 (default) or HMAC_SHA256.
  • New get_signature_algorithm(header) reads the algorithm from X-Twilio-Webhooks-Signature-Settings. It defaults to HMAC_SHA1.
  • New constants for the header names and algorithms.
  • An unsupported algorithm makes validate return False with a logged warning.
  • Existing calls are unchanged and still use HMAC-SHA1.

@shrutiburman
shrutiburman merged commit 416dc91 into main Nov 4, 2026
9 checks passed
@shrutiburman
shrutiburman deleted the hmac-sha256-request-validator branch November 4, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants