Method: DiscoApp::WebhookService.valid_hmac?
- Defined in:
- app/services/disco_app/webhook_service.rb
.valid_hmac?(body, secret, hmac_to_verify) ⇒ Boolean
Return true iff the provided hmac_to_verify matches that calculated from the given data and secret.
5 6 7 |
# File 'app/services/disco_app/webhook_service.rb', line 5 def self.valid_hmac?(body, secret, hmac_to_verify) ActiveSupport::SecurityUtils.secure_compare(calculated_hmac(body, secret), hmac_to_verify.to_s) end |