module QuoVadis::Hmacable
Public Instance Methods
compute_hmac(data)
click to toggle source
# File lib/quo_vadis/hmacable.rb, line 10 def compute_hmac(data) OpenSSL::HMAC.hexdigest 'SHA256', hmac_secret, data end
timing_safe_eql?(provided, actual)
click to toggle source
# File lib/quo_vadis/hmacable.rb, line 14 def timing_safe_eql?(provided, actual) provided = provided.to_s Rack::Utils.secure_compare(provided.ljust(actual.length), actual) && provided.length == actual.length end
Private Instance Methods
hmac_secret()
click to toggle source
# File lib/quo_vadis/hmacable.rb, line 21 def hmac_secret Rails.application.secret_key_base end