Module: JsonWebToken::Util

Defined in:
lib/json_web_token/util.rb

Class Method Summary collapse

Class Method Details

.constant_time_compare?(a, b) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/json_web_token/util.rb', line 7

def constant_time_compare?(a, b)
  return false if a.nil? || b.nil? || a.empty? || b.empty?
  secure_compare(a, b)
end

.symbolize_keys(hsh) ⇒ Object

cf. rails activesupport/lib/active_support/core_ext/hash/keys.rb



13
14
15
# File 'lib/json_web_token/util.rb', line 13

def symbolize_keys(hsh)
  transform_keys(hsh) { |key| key.to_sym rescue key }
end