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 = Castle.config) ⇒ Object

Checks if webhook is valid

Parameters:



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

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