module JWT::Algos

Signature logic for JWT

Constants

ALGOS

Public Instance Methods

find(algorithm) click to toggle source
# File lib/jwt/algos.rb, line 27
def find(algorithm)
  indexed[algorithm && algorithm.downcase]
end

Private Instance Methods

indexed() click to toggle source
# File lib/jwt/algos.rb, line 33
def indexed
  @indexed ||= begin
    fallback = [Algos::Unsupported, nil]
    ALGOS.each_with_object(Hash.new(fallback)) do |alg, hash|
      alg.const_get(:SUPPORTED).each do |code|
        hash[code.downcase] = [alg, code]
      end
    end
  end
end