Class: Castle::Webhooks::Verify

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

Overview

Verify a webhook

Class Method Summary collapse

Class Method Details

.call(webhook, config = nil) ⇒ Object

Checks if webhook is valid

Parameters:



11
12
13
14
15
16
# File 'lib/castle/webhooks/verify.rb', line 11

def call(webhook, config = nil)
  config ||= Castle.config
  expected_signature = compute_signature(webhook, config)
  signature = webhook.env['HTTP_X_CASTLE_SIGNATURE']
  verify_signature(signature, expected_signature)
end