Skip to content
This repository was archived by the owner on Jan 14, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/onfido/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ module Configuration
us: "api.us.onfido.com"
}.freeze

attr_accessor :api_key, :region, :open_timeout, :read_timeout, :api_version
attr_accessor :api_key, :region, :open_timeout, :read_timeout, :api_version,
:webhook_token

def self.extended(base)
base.reset
Expand All @@ -16,6 +17,7 @@ def configure

def reset
self.api_key = nil
self.webhook_token = nil
self.region = nil
self.open_timeout = 30
self.read_timeout = 80
Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/resources/webhook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def all(page: 1, per_page: 20)
# As well as being a normal resource, Onfido::Webhook also supports
# verifying the authenticity of a webhook by comparing the signature on the
# request to one computed from the body
def self.valid?(request_body, request_signature, token)
def self.valid?(request_body, request_signature, token = Onfido.webhook_token)
if [request_body, request_signature, token].any?(&:nil?)
raise ArgumentError, "A request body, request signature and token " \
"must be provided"
Expand Down