Sha256: 769fed24ee1913a7b2cdc37e37f6496e194e762e508c8c73aad4f62b6489a407

Contents?: true

Size: 796 Bytes

Versions: 1

Compression:

Stored size: 796 Bytes

Contents

# frozen_string_literal: true

require '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) # rubocop:disable Style/OptionalBooleanParameter
    Decode.new(jwt, key, verify, DEFAULT_OPTIONS.merge(options), &keyfinder).decode_segments
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jwt-2.4.1 lib/jwt.rb