Method: App42::Util#compute_hmac

Defined in:
lib/util/util.rb

#compute_hmac(secret_key, sorted_params) ⇒ Object

Encoding and decoding of the queries are done using the Hmac Algorithm.

Parameters:

  • baseString
  • key


106
107
108
109
110
111
112
# File 'lib/util/util.rb', line 106

def compute_hmac(secret_key, sorted_params)
  signature =  Base64.encode64(HMAC::SHA1::digest(secret_key, sorted_params)).strip
  puts "Signature #{signature}"
  computed_hmac = CGI.escape(signature)
  puts "Computed Hmac #{computed_hmac}"
  computed_hmac
end