class SecureNative::Utils::SignatureUtils
Constants
- SIGNATURE_HEADER
Public Class Methods
valid_signature?(api_key, payload, header_signature)
click to toggle source
# File lib/securenative/utils/signature_utils.rb, line 8 def self.valid_signature?(api_key, payload, header_signature) key = api_key.encode('utf-8') body = payload.encode('utf-8') calculated_signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha512'), key, body) calculated_signature.eql? header_signature rescue StandardError false end