Module: Webhookdb::Intercom

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

Class Method Summary collapse

Class Method Details

.auth_headers(token) ⇒ Object



20
21
22
# File 'lib/webhookdb/intercom.rb', line 20

def self.auth_headers(token)
  return {"Intercom-Version" => "2.9", "Authorization" => "Bearer #{token}"}
end

.verify_webhook(data, hmac_header) ⇒ Object



15
16
17
18
# File 'lib/webhookdb/intercom.rb', line 15

def self.verify_webhook(data, hmac_header)
  calculated_hmac = "sha1=#{OpenSSL::HMAC.hexdigest('SHA1', self.client_secret, data)}"
  return ActiveSupport::SecurityUtils.secure_compare(calculated_hmac, hmac_header)
end