module JWT
JSON
Web Token implementation
Should be up to date with the latest spec: tools.ietf.org/html/rfc7519
JWT::Decode
module
JWT::Encode
module
Moments version builder module
Public Class Methods
gem_version()
click to toggle source
# File lib/jwt/version.rb, line 5 def self.gem_version Gem::Version.new VERSION::STRING end
openssl_3?()
click to toggle source
# File lib/jwt/version.rb, line 24 def self.openssl_3? return false if OpenSSL::OPENSSL_VERSION.include?('LibreSSL') true if 3 * 0x10000000 <= OpenSSL::OPENSSL_VERSION_NUMBER end
openssl_3_hmac_empty_key_regression?()
click to toggle source
# File lib/jwt/version.rb, line 38 def self.openssl_3_hmac_empty_key_regression? openssl_3? && openssl_version <= ::Gem::Version.new('3.0.0') end
openssl_version()
click to toggle source
# File lib/jwt/version.rb, line 42 def self.openssl_version @openssl_version ||= ::Gem::Version.new(OpenSSL::VERSION) end
rbnacl?()
click to toggle source
# File lib/jwt/version.rb, line 30 def self.rbnacl? defined?(::RbNaCl) end
rbnacl_6_or_greater?()
click to toggle source
# File lib/jwt/version.rb, line 34 def self.rbnacl_6_or_greater? rbnacl? && ::Gem::Version.new(::RbNaCl::VERSION) >= ::Gem::Version.new('6.0.0') end
Public Instance Methods
decode(jwt, key = nil, verify = true, options = {}, &keyfinder)
click to toggle source
# File lib/jwt.rb, line 33 def decode(jwt, key = nil, verify = true, options = {}, &keyfinder) # rubocop:disable Style/OptionalBooleanParameter Deprecations.context do Decode.new(jwt, key, verify, configuration.decode.to_h.merge(options), &keyfinder).decode_segments end end
encode(payload, key, algorithm = 'HS256', header_fields = {})
click to toggle source
# File lib/jwt.rb, line 26 def encode(payload, key, algorithm = 'HS256', header_fields = {}) Encode.new(payload: payload, key: key, algorithm: algorithm, headers: header_fields).segments end