Sha256: 5e5fdc094f3c6c8e774ff86dd3c85dff1613f117ce56c87764cf20c7290ad1d3

Contents?: true

Size: 574 Bytes

Versions: 1

Compression:

Stored size: 574 Bytes

Contents

module EventSubEvents
  class WebhookController < ActionController::Base

    if Rails.application.config.action_controller.default_protect_from_forgery
      skip_before_action :verify_authenticity_token
    end

    def event
      EventSubEvents.instrument(verified_event)
      head :ok
    rescue EventSubEvents::SignatureVerificationError => e
      render plain: e, status: :bad_request
    end

    private

    def verified_event
      verifier = EventSubEvents::SignatureVerifier.new(request)
      verifier.reconstruct_event if verifier.verify
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
event_sub_events-0.1.0 app/controllers/event_sub_events/webhook_controller.rb