Class: LucidShopify::VerifyCallback
- Inherits:
-
Object
- Object
- LucidShopify::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.
18 19 20 21 22 23 24 |
# File 'lib/lucid_shopify/verify_callback.rb', line 18 def call(params) params = params.to_h.transform_keys(&:to_s) digest = OpenSSL::Digest::SHA256.new digest = OpenSSL::HMAC.hexdigest(digest, LucidShopify.config.shared_secret, encoded_params(params)) raise Error, 'invalid signature' unless digest == params['hmac'] end |