Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utils Method for signature verification #41

Open
bandraszyk opened this issue Jun 5, 2019 · 0 comments
Open

Utils Method for signature verification #41

bandraszyk opened this issue Jun 5, 2019 · 0 comments

Comments

@bandraszyk
Copy link

Maybe we shall consider adding utils method for handling signature verification.

require 'openssl'

  def verify_webhook
    calculated_hmac = OpenSSL::HMAC.hexdigest('sha256', SECRET, request.body.read)
    ActiveSupport::SecurityUtils.secure_compare(calculated_hmac, request.headers["X-Voucherify-Signature"])
  end
@bandraszyk bandraszyk changed the title Utils Method for webhooks Utils Method for signature verification Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant