Signet::OAuth1::HMACSHA1

Public Class Methods

generate_signature( base_string, client_credential_secret, token_credential_secret) click to toggle source
# File lib/signet/oauth_1/signature_methods/hmac_sha1.rb, line 14
def self.generate_signature(
    base_string, client_credential_secret, token_credential_secret)
  # Both the client secret and token secret must be escaped
  client_credential_secret =
    Signet::OAuth1.encode(client_credential_secret)
  token_credential_secret =
    Signet::OAuth1.encode(token_credential_secret)
  # The key for the signature is just the client secret and token
  # secret joined by the '&' character.  If the token secret is omitted,
  # the '&' must still be present.
  key = [client_credential_secret, token_credential_secret].join("&")
  return Base64.encode64(Digest::HMAC.digest(
    base_string, key, Digest::SHA1
  )).strip
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.