Sha256: e88cce0e659ab400a7e60db39d9516e8cc012e125d8a8e0d07f0b1f9a28906d0
Contents?: true
Size: 401 Bytes
Versions: 2
Compression:
Stored size: 401 Bytes
Contents
require 'openssl' class SignatureUtils SIGNATURE_HEADER = 'x-securenative'.freeze 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 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
securenative-0.1.17 | lib/securenative/utils/signature_utils.rb |
securenative-0.1.16 | lib/securenative/utils/signature_utils.rb |