Module: Webhookdb::EmailOctopus

Includes:
Appydays::Configurable
Defined in:
lib/webhookdb/email_octopus.rb

Class Method Summary collapse

Class Method Details

.verify_webhook(data, hmac_header, webhook_secret) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/webhookdb/email_octopus.rb', line 16

def self.verify_webhook(data, hmac_header, webhook_secret)
  calculated_hmac = Webhookdb::Crypto.bin2hex(
    OpenSSL::HMAC.digest("sha256", webhook_secret, data),
  )
  verified = ActiveSupport::SecurityUtils.secure_compare("sha256=#{calculated_hmac}", hmac_header)
  return verified
end