module JWT::JWA

Public Class Methods

create(algorithm) click to toggle source
# File lib/jwt/jwa.rb, line 45
def create(algorithm)
  resolve(algorithm)
end
find(algo) click to toggle source
# File lib/jwt/jwa/signing_algorithm.rb, line 49
def find(algo)
  algorithms.fetch(algo.to_s.downcase, Unsupported)
end
register_algorithm(algo) click to toggle source
# File lib/jwt/jwa/signing_algorithm.rb, line 45
def register_algorithm(algo)
  algorithms[algo.alg.to_s.downcase] = algo
end
resolve(algorithm) click to toggle source
# File lib/jwt/jwa.rb, line 34
def resolve(algorithm)
  return find(algorithm) if algorithm.is_a?(String) || algorithm.is_a?(Symbol)

  unless algorithm.is_a?(SigningAlgorithm)
    Deprecations.warning('Custom algorithms are required to include JWT::JWA::SigningAlgorithm. Custom algorithms that do not include this module may stop working in the next major version of ruby-jwt.')
    return Wrapper.new(algorithm)
  end

  algorithm
end

Private Class Methods

algorithms() click to toggle source
# File lib/jwt/jwa/signing_algorithm.rb, line 55
def algorithms
  @algorithms ||= {}
end