Sha256: 15dd3c6ca113c6ca0f7ba6d6b18780f1584f1df796b06321ebfbba60b202c118

Contents?: true

Size: 597 Bytes

Versions: 36

Compression:

Stored size: 597 Bytes

Contents

# frozen_string_literal: true

module ShopifyApp
  module TestHelpers
    module WebhookVerificationHelper
      def authorized_webhook_verification_headers!(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

      def unauthorized_webhook_verification_headers!
        @request.headers["HTTP_X_SHOPIFY_HMAC_SHA256"] = "invalid_hmac"
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
shopify_app-22.5.2 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-22.5.1 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-22.5.0 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-22.4.0 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-22.3.1 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-22.3.0 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-22.2.1 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-22.2.0 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-22.1.0 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-22.0.1 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-22.00.0 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-21.10.0 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-21.9.0 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-21.8.1 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-21.8.0 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-21.7.0 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-21.6.0 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-21.5.0 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-21.4.1 lib/shopify_app/test_helpers/webhook_verification_helper.rb
shopify_app-21.4.0 lib/shopify_app/test_helpers/webhook_verification_helper.rb