module JWT::Algos
def create(algorithm)
def create(algorithm) Algos::AlgoWrapper.new(*find(algorithm)) end
def find(algorithm)
def find(algorithm) indexed[algorithm && algorithm.downcase] end
def implementation?(algorithm)
def implementation?(algorithm) (algorithm.respond_to?(:valid_alg?) && algorithm.respond_to?(:verify)) || (algorithm.respond_to?(:alg) && algorithm.respond_to?(:sign)) end
def indexed
def indexed @indexed ||= begin fallback = [nil, Algos::Unsupported] ALGOS.each_with_object(Hash.new(fallback)) do |cls, hash| cls.const_get(:SUPPORTED).each do |alg| hash[alg.downcase] = [alg, cls] end end end end