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