10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/telestream_cloud/api_authentication.rb', line 10
def self.generate_signature(verb, request_uri, host, secret_key, params_given={})
params = {}; params_given.each {|k,v| params[k.to_s] = v }
query_string = canonical_querystring(params)
string_to_sign = verb.to_s.upcase + "\n" +
host.downcase + "\n" +
request_uri + "\n" +
query_string
hmac = HMAC::SHA256.new( secret_key )
hmac.update( string_to_sign )
Base64.encode64(hmac.digest).chomp
end
|