Merge pull request #572 from timcraft/webhook

Parse webhook payload after verifying the signature header
This commit is contained in:
Brandur 2017-08-18 10:11:51 -07:00 committed by GitHub
commit a19dfed759

View File

@ -7,12 +7,10 @@ module Stripe
# This may raise JSON::ParserError if the payload is not valid JSON, or
# SignatureVerificationError if the signature verification fails.
def self.construct_event(payload, sig_header, secret, tolerance: DEFAULT_TOLERANCE)
data = JSON.parse(payload, symbolize_names: true)
event = Event.construct_from(data)
Signature.verify_header(payload, sig_header, secret, tolerance: tolerance)
event
data = JSON.parse(payload, symbolize_names: true)
Event.construct_from(data)
end
module Signature