Module: JWT

Includes:
DefaultOptions
Defined in:
lib/jwt.rb,
lib/jwt/jwk.rb,
lib/jwt/json.rb,
lib/jwt/algos.rb,
lib/jwt/error.rb,
lib/jwt/base64.rb,
lib/jwt/decode.rb,
lib/jwt/encode.rb,
lib/jwt/jwk/ec.rb,
lib/jwt/verify.rb,
lib/jwt/jwk/rsa.rb,
lib/jwt/version.rb,
lib/jwt/algos/ps.rb,
lib/jwt/jwk/hmac.rb,
lib/jwt/algos/rsa.rb,
lib/jwt/signature.rb,
lib/jwt/algos/hmac.rb,
lib/jwt/algos/none.rb,
lib/jwt/algos/ecdsa.rb,
lib/jwt/algos/eddsa.rb,
lib/jwt/jwk/key_base.rb,
lib/jwt/jwk/key_finder.rb,
lib/jwt/security_utils.rb,
lib/jwt/default_options.rb,
lib/jwt/claims_validator.rb,
lib/jwt/algos/unsupported.rb

Overview

JWT::Signature module

Defined Under Namespace

Modules: Algos, DefaultOptions, JWK, SecurityUtils, Signature, VERSION Classes: Base64, ClaimsValidator, Decode, DecodeError, Encode, EncodeError, ExpiredSignature, ImmatureSignature, IncorrectAlgorithm, InvalidAudError, InvalidIatError, InvalidIssuerError, InvalidJtiError, InvalidPayload, InvalidSubError, JSON, JWKError, RequiredDependencyError, VerificationError, Verify

Constant Summary

Constants included from DefaultOptions

DefaultOptions::DEFAULT_OPTIONS

Class Method Summary collapse

Class Method Details

.decode(jwt, key = nil, verify = true, options = {}, &keyfinder) ⇒ Object


27
28
29
# File 'lib/jwt.rb', line 27

def decode(jwt, key = nil, verify = true, options = {}, &keyfinder)
  Decode.new(jwt, key, verify, DEFAULT_OPTIONS.merge(options), &keyfinder).decode_segments
end

.encode(payload, key, algorithm = 'HS256', header_fields = {}) ⇒ Object


20
21
22
23
24
25
# File 'lib/jwt.rb', line 20

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

.gem_versionObject


6
7
8
# File 'lib/jwt/version.rb', line 6

def self.gem_version
  Gem::Version.new VERSION::STRING
end