Module: ShopifyApp::TestHelpers::WebhookVerificationHelper
- Defined in:
- lib/shopify_app/test_helpers/webhook_verification_helper.rb
Instance Method Summary collapse
- #authorized_webhook_verification_headers!(params = {}) ⇒ Object
- #unauthorized_webhook_verification_headers!(params = {}) ⇒ Object
Instance Method Details
#authorized_webhook_verification_headers!(params = {}) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/shopify_app/test_helpers/webhook_verification_helper.rb', line 4 def (params = {}) digest = OpenSSL::Digest.new('sha256') secret = ShopifyApp.configuration.secret valid_hmac = Base64.encode64(OpenSSL::HMAC.digest(digest, secret, params.to_query)).strip @request.headers['HTTP_X_SHOPIFY_HMAC_SHA256'] = valid_hmac end |
#unauthorized_webhook_verification_headers!(params = {}) ⇒ Object
11 12 13 |
# File 'lib/shopify_app/test_helpers/webhook_verification_helper.rb', line 11 def (params = {}) @request.headers['HTTP_X_SHOPIFY_HMAC_SHA256'] = "invalid_hmac" end |