lib/jwt.rb in jwt-2.4.1 vs lib/jwt.rb in jwt-2.5.0
- old
+ new
@@ -1,21 +1,22 @@
# frozen_string_literal: true
-require 'base64'
+require 'jwt/version'
+require 'jwt/base64'
require 'jwt/json'
require 'jwt/decode'
-require 'jwt/default_options'
+require 'jwt/configuration'
require 'jwt/encode'
require 'jwt/error'
require 'jwt/jwk'
# JSON Web Token implementation
#
# Should be up to date with the latest spec:
# https://tools.ietf.org/html/rfc7519
module JWT
- include JWT::DefaultOptions
+ extend ::JWT::Configuration
module_function
def encode(payload, key, algorithm = 'HS256', header_fields = {})
Encode.new(payload: payload,
@@ -23,8 +24,8 @@
algorithm: algorithm,
headers: header_fields).segments
end
def decode(jwt, key = nil, verify = true, options = {}, &keyfinder) # rubocop:disable Style/OptionalBooleanParameter
- Decode.new(jwt, key, verify, DEFAULT_OPTIONS.merge(options), &keyfinder).decode_segments
+ Decode.new(jwt, key, verify, configuration.decode.to_h.merge(options), &keyfinder).decode_segments
end
end