Skip to content

Utils Method for signature verification #41

@bandraszyk

Description

@bandraszyk

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions