Sha256: 01f0aff9a017ae0a55efdcaae7771233a1796ecd4da7d913f74ef486d5de54e4

Contents?: true

Size: 969 Bytes

Versions: 2

Compression:

Stored size: 969 Bytes

Contents

# frozen_string_literal: true

require 'jwt/version'
require 'jwt/base64'
require 'jwt/json'
require 'jwt/decode'
require 'jwt/configuration'
require 'jwt/deprecations'
require 'jwt/encode'
require 'jwt/error'
require 'jwt/jwk'
require 'jwt/claims'

require 'jwt/claims_validator'
require 'jwt/verify'

# JSON Web Token implementation
#
# Should be up to date with the latest spec:
# https://tools.ietf.org/html/rfc7519
module JWT
  extend ::JWT::Configuration

  module_function

  def encode(payload, key, algorithm = 'HS256', header_fields = {})
    Encode.new(payload: payload,
               key: key,
               algorithm: algorithm,
               headers: header_fields).segments
  end

  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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jwt-2.9.3 lib/jwt.rb
jwt-2.9.2 lib/jwt.rb