lib/mergent/request_validator.rb in mergent-0.2.0 vs lib/mergent/request_validator.rb in mergent-0.2.1
- old
+ new
@@ -4,16 +4,15 @@
class RequestValidator
def initialize(api_key)
@api_key = api_key || Mergent.api_key
end
- def build_signature_for(url, body)
- data = (url || "") + (body || "")
+ def build_signature_for(body)
digest = OpenSSL::Digest.new("sha1")
- Base64.strict_encode64(OpenSSL::HMAC.digest(digest, @api_key, data))
+ Base64.strict_encode64(OpenSSL::HMAC.digest(digest, @api_key, body || ""))
end
- def valid_signature?(url, body, signature)
- build_signature_for(url, body) == signature
+ def valid_signature?(body, signature)
+ build_signature_for(body) == signature
end
end
end