module JWT

JSON Web Token implementation

Should be up to date with the latest spec: tools.ietf.org/html/rfc7519

JWT::Signature module

JWT::Decode module

JWT::Encode module

JWT::Signature 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')
  return true if OpenSSL::OPENSSL_VERSION_NUMBER >= 3 * 0x10000000
end

Public Instance Methods

decode(jwt, key = nil, verify = true, options = {}, &keyfinder) click to toggle source
# File lib/jwt.rb, line 28
def decode(jwt, key = nil, verify = true, options = {}, &keyfinder) # rubocop:disable Style/OptionalBooleanParameter
  Decode.new(jwt, key, verify, configuration.decode.to_h.merge(options), &keyfinder).decode_segments
end
encode(payload, key, algorithm = 'HS256', header_fields = {}) click to toggle source
# File lib/jwt.rb, line 21
def encode(payload, key, algorithm = 'HS256', header_fields = {})
  Encode.new(payload: payload,
             key: key,
             algorithm: algorithm,
             headers: header_fields).segments
end