lib/gocardless_pro/webhook.rb
# Validates that a webhook was genuinely sent by GoCardless by computing its
# signature using the body and your webhook endpoint secret, and comparing that with
# the signature included in the `Webhook-Signature` header
#
# @option options [String] :request_body the request body
# @option options [String] :signature_header the signature included in the request,
#   found in the `Webhook-Signature` header
# @option options [String] :webhook_endpoint_secret the webhook endpoint secret for
#   your webhook endpoint, as configured in your GoCardless Dashboard
# @return [Boolean] whether the webhook's signature is valid
# @raise [ArgumentError] if a required keyword argument is not provided or is not
#   of the required type
Validates that a webhook was genuinely sent by GoCardless by computing its
signature using the body and your webhook endpoint secret, and comparing that with
the signature included in the `Webhook-Signature` header
Validates that a webhook was genuinely sent by GoCardless by computing its signature using the body and your webhook endpoint secret and comparing that with the signature included in the ` Webhook - Signature ` header
def signature_valid?(options = {})
        validate_options!(options)
        computed_signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'),
                                                     options[:webhook_endpoint_secret],
                                                     options[:request_body])
        secure_compare(options[:signature_header], computed_signature)
      end
def signature_valid? ( options = { } ) validate_options! ( options ) computed_signature = OpenSSL :: HMAC . hexdigest ( OpenSSL :: Digest . new ( 'sha256' ) , options [ :webhook_endpoint_secret ] , options [ :request_body ] ) secure_compare ( options [ :signature_header ] , computed_signature ) end
Validates that a webhook was genuinely sent by GoCardless by computing its
signature using the body and your webhook endpoint secret, and comparing that with
the signature included in the `Webhook-Signature` header
Validates that a webhook was genuinely sent by GoCardless by computing its signature using the body and your webhook endpoint secret and comparing that with the signature included in the ` Webhook - Signature ` header
whether the webhook's signature is valid
whether the webhook ' s signature is valid
Boolean
[ArgumentError] if a required keyword argument is not provided or is not of the required type
[ ArgumentError ] if a required keyword argument is not provided or is not of the required type
options
:webhook_endpoint_secret the webhook endpoint secret for your webhook endpoint, as configured in your GoCardless Dashboard
: webhook_endpoint_secret the webhook endpoint secret for your webhook endpoint as configured in your GoCardless Dashboard