Class: Bob::Webhooks

Inherits:
Object
  • Object
show all
Defined in:
lib/bob/webhooks.rb

Class Method Summary collapse

Class Method Details

.calculate_signature(body:, key: ENV.fetch('BOB_WEBHOOK_SECRET', nil)) ⇒ Object



5
6
7
8
# File 'lib/bob/webhooks.rb', line 5

def self.calculate_signature(body:, key: ENV.fetch('BOB_WEBHOOK_SECRET', nil))
  digest = OpenSSL::Digest.new('sha512')
  Base64.strict_encode64(OpenSSL::HMAC.digest(digest, key, body))
end