18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/coinbase_commerce/webhooks.rb', line 18
def self.(payload, , secret)
unless [payload, , secret].all?
raise CoinbaseCommerce::Errors::WebhookInvalidPayload.new(
"Missing payload or signature",
, http_body: payload)
end
expected_sig = compute_signature(payload, secret)
unless secure_compare(expected_sig, )
raise CoinbaseCommerce::Errors::SignatureVerificationError.new(
"No signatures found matching the expected signature for payload",
, http_body: payload
)
end
true
end
|