Class: Lucid::Shopify::VerifyCallback
- Inherits:
-
Object
- Object
- Lucid::Shopify::VerifyCallback
- Defined in:
- lib/lucid/shopify/verify_callback.rb
Constant Summary collapse
- Error =
Class.new(Error)
Instance Method Summary collapse
-
#call(params) ⇒ Object
Verify that the callback request originated from Shopify.
Instance Method Details
#call(params) ⇒ Object
Verify that the callback request originated from Shopify.
17 18 19 20 21 22 23 |
# File 'lib/lucid/shopify/verify_callback.rb', line 17 def call(params) params = params.to_h.transform_keys(&:to_s) digest = OpenSSL::Digest::SHA256.new digest = OpenSSL::HMAC.hexdigest(digest, Shopify.config.shared_secret, encoded_params(params)) raise Error, 'invalid signature' unless digest == params['hmac'] end |