Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Verify
- # TODO: PUT YOUR API CLIENT SHARED SECRET
- SHARED_SECRET = ""
- def verify(data, hmac_header)
- digest = OpenSSL::Digest.new('sha256')
- calculated_hmac = Base64.strict_encode64(OpenSSL::HMAC.digest(digest, SHARED_SECRET, data)).strip
- puts "calc is: " + calculated_hmac
- ActiveSupport::SecurityUtils.secure_compare(hmac_header, calculated_hmac)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement