Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for modules and classes #639

Merged
merged 1 commit into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ AllCops:
- 'gemfiles/*.gemfile'
- 'vendor/**/*'

Style/Documentation:
Enabled: false

Metrics/AbcSize:
Max: 25

Expand Down
1 change: 1 addition & 0 deletions lib/jwt/deprecations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
# Deprecations module to handle deprecation warnings in the gem
# @api private
module Deprecations
class << self
def context
Expand Down
4 changes: 2 additions & 2 deletions lib/jwt/encoded_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ def valid_signature?(algorithm:, key:)
def decode_payload
raise JWT::DecodeError, 'Encoded payload is empty' if encoded_payload == ''

if unecoded_payload?
if unencoded_payload?
verify_claims!(crit: ['b64'])
return parse_unencoded(encoded_payload)
end

parse_and_decode(encoded_payload)
end

def unecoded_payload?
def unencoded_payload?
header['b64'] == false
end

Expand Down
2 changes: 1 addition & 1 deletion lib/jwt/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'json'

module JWT
# JSON wrapper
# @api private
class JSON
class << self
def generate(data)
Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwa/ecdsa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
module JWA
# ECDSA signing algorithm
class Ecdsa
include JWT::JWA::SigningAlgorithm

Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwa/eddsa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
module JWA
# Implementation of the EdDSA family of algorithms
class Eddsa
include JWT::JWA::SigningAlgorithm

Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwa/hmac.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
module JWA
# Implementation of the HMAC family of algorithms
class Hmac
include JWT::JWA::SigningAlgorithm

Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwa/hmac_rbnacl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
module JWA
# Implementation of the HMAC family of algorithms (using RbNaCl)
class HmacRbNaCl
include JWT::JWA::SigningAlgorithm

Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwa/hmac_rbnacl_fixed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
module JWA
# Implementation of the HMAC family of algorithms (using RbNaCl prior to a certain version)
class HmacRbNaClFixed
include JWT::JWA::SigningAlgorithm

Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwa/none.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
module JWA
# Implementation of the none algorithm
class None
include JWT::JWA::SigningAlgorithm

Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwa/ps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
module JWA
# Implementation of the RSASSA-PSS family of algorithms
class Ps
include JWT::JWA::SigningAlgorithm

Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwa/rsa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
module JWA
# Implementation of the RSA family of algorithms
class Rsa
include JWT::JWA::SigningAlgorithm

Expand Down
3 changes: 3 additions & 0 deletions lib/jwt/jwa/signing_algorithm.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# frozen_string_literal: true

module JWT
# JSON Web Algorithms
module JWA
# Base functionality for signing algorithms
module SigningAlgorithm
# Class methods for the SigningAlgorithm module
module ClassMethods
def register_algorithm(algo)
::JWT::JWA.register_algorithm(algo)
Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwa/unsupported.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
module JWA
# Represents an unsupported algorithm
module Unsupported
class << self
include JWT::JWA::SigningAlgorithm
Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwa/wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
module JWA
# @api private
class Wrapper
include SigningAlgorithm

Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require_relative 'jwk/set'

module JWT
# JSON Web Key (JWK)
module JWK
class << self
def create_from(key, params = nil, options = {})
Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwk/ec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

module JWT
module JWK
# JWK representation for Elliptic Curve (EC) keys
class EC < KeyBase # rubocop:disable Metrics/ClassLength
KTY = 'EC'
KTYS = [KTY, OpenSSL::PKey::EC, JWT::JWK::EC].freeze
Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwk/hmac.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
module JWK
# JWK for HMAC keys
class HMAC < KeyBase
KTY = 'oct'
KTYS = [KTY, String, JWT::JWK::HMAC].freeze
Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwk/key_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
module JWK
# Base for JWK implementations
class KeyBase
def self.inherited(klass)
super
Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwk/key_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
module JWK
# @api private
class KeyFinder
def initialize(options)
@allow_nil_kid = options[:allow_nil_kid]
Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwk/kid_as_key_digest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
module JWK
# @api private
class KidAsKeyDigest
def initialize(jwk)
@jwk = jwk
Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwk/okp_rbnacl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
module JWK
# JSON Web Key (JWK) representation for Ed25519 keys
class OKPRbNaCl < KeyBase
KTY = 'OKP'
KTYS = [KTY, JWT::JWK::OKPRbNaCl, RbNaCl::Signatures::Ed25519::SigningKey, RbNaCl::Signatures::Ed25519::VerifyKey].freeze
Expand Down
1 change: 1 addition & 0 deletions lib/jwt/jwk/rsa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module JWT
module JWK
# JSON Web Key (JWK) representation of a RSA key
class RSA < KeyBase # rubocop:disable Metrics/ClassLength
BINARY = 2
KTY = 'RSA'
Expand Down
2 changes: 2 additions & 0 deletions lib/jwt/jwk/set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

module JWT
module JWK
# JSON Web Key Set (JWKS) representation
# https://tools.ietf.org/html/rfc7517
class Set
include Enumerable
extend Forwardable
Expand Down
4 changes: 4 additions & 0 deletions lib/jwt/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# frozen_string_literal: true

# JSON Web Token implementation
#
# Should be up to date with the latest spec:
# https://tools.ietf.org/html/rfc7519
module JWT
# Returns the gem version of the JWT library.
#
Expand Down
Loading