module JWT::JWA
The JWA
module contains all supported algorithms.
JSON
Web Algorithms
Public Class Methods
create(algorithm)
click to toggle source
@deprecated The `::JWT::JWA.create` method is deprecated and will be removed in the next major version of ruby-jwt.
# File lib/jwt/jwa.rb, line 52 def create(algorithm) Deprecations.warning('The ::JWT::JWA.create method is deprecated and will be removed in the next major version of ruby-jwt.') resolve(algorithm) end
find(algo)
click to toggle source
# File lib/jwt/jwa/signing_algorithm.rb, line 52 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 48 def register_algorithm(algo) algorithms[algo.alg.to_s.downcase] = algo end
resolve(algorithm)
click to toggle source
@api private
# 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
resolve_and_sort(algorithms:, preferred_algorithm:)
click to toggle source
@api private
# File lib/jwt/jwa.rb, line 46 def resolve_and_sort(algorithms:, preferred_algorithm:) algs = Array(algorithms).map { |alg| JWA.resolve(alg) } algs.partition { |alg| alg.valid_alg?(preferred_algorithm) }.flatten end
Private Class Methods
algorithms()
click to toggle source
# File lib/jwt/jwa/signing_algorithm.rb, line 58 def algorithms @algorithms ||= {} end