lib/rack/simple_auth/hmac.rb in rack-simple_auth-0.0.6 vs lib/rack/simple_auth/hmac.rb in rack-simple_auth-0.0.7
- old
+ new
@@ -58,18 +58,19 @@
# @return [Array] hash_array [allowed message hashes as array]
def build_allowed_messages(request)
hash_array = []
(-(@tolerance)..@tolerance).each do |i|
- hash_array << OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new('sha256'), @secret, message(request, i))
+ hash_array << OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), @secret, message(request, i))
end
hash_array
end
- # Get Message for current Request
+ # Get Message for current Request and delay
# @param [Rack::Request] request [current Request]
+ # @param [Fixnum] delay [delay in timestamp format]
# @return [Hash] message [message which will be encrypted]
def message(request, delay = 0)
date = Time.now.to_i + delay
case request.request_method
when 'GET'
@@ -120,9 +121,9 @@
f << "#{log}\n"
end
end
end
- private :log, :request_data, :message, :valid?
+ private :log, :request_data, :message, :valid?, :build_allowed_messages
end
end
end