Skip to content
Browse files

Using OpenSSL over the Ruby "hmac-sha1" gem

  • Loading branch information...
1 parent 2a5770b commit 37b4a447827c56c3de5de66de13caff32a7ed452 @shayne shayne committed May 9, 2011
Showing with 3 additions and 3 deletions.
  1. +0 −1 instagram.gemspec
  2. +3 −2 lib/instagram/client/subscriptions.rb
View
1 instagram.gemspec
@@ -13,7 +13,6 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('faraday_middleware', '~> 0.3.1')
s.add_runtime_dependency('multi_json', '~> 0.0.5')
s.add_runtime_dependency('hashie', '~> 1.0.0')
- s.add_runtime_dependency('ruby-hmac', '~> 0.4.0')
s.authors = ["Shayne Sweeney"]
s.description = %q{A Ruby wrapper for the Instagram REST and Search APIs}
s.post_install_message =<<eos
View
5 lib/instagram/client/subscriptions.rb
@@ -1,4 +1,4 @@
-require 'hmac-sha1'
+require 'openssl'
module Instagram
class Client
@@ -127,7 +127,8 @@ def process_subscription(json, options={}, &block)
if !client_secret
raise ArgumentError, "client_secret must be set during configure"
end
- verify_signature = HMAC::SHA1.hexdigest(client_secret, json)
+ digest = OpenSSL::Digest::Digest.new('sha1')
+ verify_signature = OpenSSL::HMAC.hexdigest(digest, client_secret, json)
if options[:signature] != verify_signature
raise Instagram::InvalidSignature, "invalid X-Hub-Signature does not match verify signature against client_secret"

0 comments on commit 37b4a44

Please sign in to comment.
Something went wrong with that request. Please try again.