Sha256: 992b6487e960caecbf808be7e64a5fb7e6c0535139982dc2d04a8c3bb94a57e9

Contents?: true

Size: 751 Bytes

Versions: 6

Compression:

Stored size: 751 Bytes

Contents

# frozen_string_literal: true

require 'jwt/base64'
require 'jwt/json'
require 'jwt/decode'
require 'jwt/default_options'
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

  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)
    Decode.new(jwt, key, verify, DEFAULT_OPTIONS.merge(options), &keyfinder).decode_segments
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jwt-2.3.0 lib/jwt.rb
jwt-2.2.3 lib/jwt.rb
jwt-2.2.2 lib/jwt.rb
jwt-2.2.1 lib/jwt.rb
jwt-2.2.0 lib/jwt.rb
jwt-2.2.0.pre.beta.0 lib/jwt.rb