Module: JWT::JWA
- Defined in:
- lib/jwt/jwa.rb,
lib/jwt/jwa/ps.rb,
lib/jwt/jwa/rsa.rb,
lib/jwt/jwa/hmac.rb,
lib/jwt/jwa/none.rb,
lib/jwt/jwa/ecdsa.rb,
lib/jwt/jwa/eddsa.rb,
lib/jwt/jwa/compat.rb,
lib/jwt/jwa/wrapper.rb,
lib/jwt/jwa/hmac_rbnacl.rb,
lib/jwt/jwa/unsupported.rb,
lib/jwt/jwa/hmac_rbnacl_fixed.rb,
lib/jwt/jwa/signing_algorithm.rb more...
Overview
JSON Web Algorithms
Defined Under Namespace
Modules: Compat, SigningAlgorithm, Unsupported Classes: Ecdsa, Eddsa, Hmac, HmacRbNaCl, HmacRbNaClFixed, None, Ps, Rsa, Wrapper
Class Method Summary collapse
-
.create(algorithm) ⇒ Object
deprecated
Deprecated.
The ‘::JWT::JWA.create` method is deprecated and will be removed in the next major version of ruby-jwt.
- .find(algo) ⇒ Object
- .register_algorithm(algo) ⇒ Object
- .resolve(algorithm) ⇒ Object private
- .resolve_and_sort(algorithms:, preferred_algorithm:) ⇒ Object private
Class Method Details
permalink .create(algorithm) ⇒ Object
Deprecated.
The ‘::JWT::JWA.create` method is deprecated and will be removed in the next major version of ruby-jwt.
52 53 54 55 |
# 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 |
permalink .find(algo) ⇒ Object
[View source] [View on GitHub]
52 53 54 |
# File 'lib/jwt/jwa/signing_algorithm.rb', line 52 def find(algo) algorithms.fetch(algo.to_s.downcase, Unsupported) end |
permalink .register_algorithm(algo) ⇒ Object
[View source] [View on GitHub]
48 49 50 |
# File 'lib/jwt/jwa/signing_algorithm.rb', line 48 def register_algorithm(algo) algorithms[algo.alg.to_s.downcase] = algo end |
permalink .resolve(algorithm) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 37 38 39 40 41 42 43 |
# 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 |
permalink .resolve_and_sort(algorithms:, preferred_algorithm:) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 49 |
# 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 |