Sha256: 5a8442f1330f3667f87179393e7dbae4f95783e069dfddcbc6f741fcfd7e4329
Contents?: true
Size: 495 Bytes
Versions: 11
Compression:
Stored size: 495 Bytes
Contents
# frozen_string_literal: true module SecureNative module Utils class SignatureUtils SIGNATURE_HEADER = 'x-securenative' 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 end end
Version data entries
11 entries across 11 versions & 1 rubygems