Skip to content

Commit 98e1d30

Browse files
committed
Documentation for modules and classes
1 parent 7ea4a36 commit 98e1d30

25 files changed

+31
-6
lines changed

.rubocop.yml

-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ AllCops:
66
- 'gemfiles/*.gemfile'
77
- 'vendor/**/*'
88

9-
Style/Documentation:
10-
Enabled: false
11-
129
Metrics/AbcSize:
1310
Max: 25
1411

lib/jwt/deprecations.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
# Deprecations module to handle deprecation warnings in the gem
5+
# @api private
56
module Deprecations
67
class << self
78
def context

lib/jwt/encoded_token.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ def valid_signature?(algorithm:, key:)
111111
def decode_payload
112112
raise JWT::DecodeError, 'Encoded payload is empty' if encoded_payload == ''
113113

114-
if unecoded_payload?
114+
if unencoded_payload?
115115
verify_claims!(crit: ['b64'])
116116
return parse_unencoded(encoded_payload)
117117
end
118118

119119
parse_and_decode(encoded_payload)
120120
end
121121

122-
def unecoded_payload?
122+
def unencoded_payload?
123123
header['b64'] == false
124124
end
125125

lib/jwt/json.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require 'json'
44

55
module JWT
6-
# JSON wrapper
6+
# @api private
77
class JSON
88
class << self
99
def generate(data)

lib/jwt/jwa/ecdsa.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
module JWA
5+
# ECDSA signing algorithm
56
class Ecdsa
67
include JWT::JWA::SigningAlgorithm
78

lib/jwt/jwa/eddsa.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
module JWA
5+
# Implementation of the EdDSA family of algorithms
56
class Eddsa
67
include JWT::JWA::SigningAlgorithm
78

lib/jwt/jwa/hmac.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
module JWA
5+
# Implementation of the HMAC family of algorithms
56
class Hmac
67
include JWT::JWA::SigningAlgorithm
78

lib/jwt/jwa/hmac_rbnacl.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
module JWA
5+
# Implementation of the HMAC family of algorithms (using RbNaCl)
56
class HmacRbNaCl
67
include JWT::JWA::SigningAlgorithm
78

lib/jwt/jwa/hmac_rbnacl_fixed.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
module JWA
5+
# Implementation of the HMAC family of algorithms (using RbNaCl prior to a certain version)
56
class HmacRbNaClFixed
67
include JWT::JWA::SigningAlgorithm
78

lib/jwt/jwa/none.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
module JWA
5+
# Implementation of the none algorithm
56
class None
67
include JWT::JWA::SigningAlgorithm
78

lib/jwt/jwa/ps.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
module JWA
5+
# Implementation of the RSASSA-PSS family of algorithms
56
class Ps
67
include JWT::JWA::SigningAlgorithm
78

lib/jwt/jwa/rsa.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
module JWA
5+
# Implementation of the RSA family of algorithms
56
class Rsa
67
include JWT::JWA::SigningAlgorithm
78

lib/jwt/jwa/signing_algorithm.rb

+3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# frozen_string_literal: true
22

33
module JWT
4+
# JSON Web Algorithms
45
module JWA
6+
# Base functionality for signing algorithms
57
module SigningAlgorithm
8+
# Class methods for the SigningAlgorithm module
69
module ClassMethods
710
def register_algorithm(algo)
811
::JWT::JWA.register_algorithm(algo)

lib/jwt/jwa/unsupported.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
module JWA
5+
# Represents an unsupported algorithm
56
module Unsupported
67
class << self
78
include JWT::JWA::SigningAlgorithm

lib/jwt/jwa/wrapper.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
module JWA
5+
# @api private
56
class Wrapper
67
include SigningAlgorithm
78

lib/jwt/jwk.rb

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
require_relative 'jwk/set'
55

66
module JWT
7+
# JSON Web Key (JWK)
78
module JWK
89
class << self
910
def create_from(key, params = nil, options = {})

lib/jwt/jwk/ec.rb

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
module JWT
66
module JWK
7+
# JWK representation for Elliptic Curve (EC) keys
78
class EC < KeyBase # rubocop:disable Metrics/ClassLength
89
KTY = 'EC'
910
KTYS = [KTY, OpenSSL::PKey::EC, JWT::JWK::EC].freeze

lib/jwt/jwk/hmac.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
module JWK
5+
# JWK for HMAC keys
56
class HMAC < KeyBase
67
KTY = 'oct'
78
KTYS = [KTY, String, JWT::JWK::HMAC].freeze

lib/jwt/jwk/key_base.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
module JWK
5+
# Base for JWK implementations
56
class KeyBase
67
def self.inherited(klass)
78
super

lib/jwt/jwk/key_finder.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
module JWK
5+
# @api private
56
class KeyFinder
67
def initialize(options)
78
@allow_nil_kid = options[:allow_nil_kid]

lib/jwt/jwk/kid_as_key_digest.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
module JWK
5+
# @api private
56
class KidAsKeyDigest
67
def initialize(jwk)
78
@jwk = jwk

lib/jwt/jwk/okp_rbnacl.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
module JWK
5+
# JSON Web Key (JWK) representation for Ed25519 keys
56
class OKPRbNaCl < KeyBase
67
KTY = 'OKP'
78
KTYS = [KTY, JWT::JWK::OKPRbNaCl, RbNaCl::Signatures::Ed25519::SigningKey, RbNaCl::Signatures::Ed25519::VerifyKey].freeze

lib/jwt/jwk/rsa.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module JWT
44
module JWK
5+
# JSON Web Key (JWK) representation of a RSA key
56
class RSA < KeyBase # rubocop:disable Metrics/ClassLength
67
BINARY = 2
78
KTY = 'RSA'

lib/jwt/jwk/set.rb

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
module JWT
66
module JWK
7+
# JSON Web Key Set (JWKS) representation
8+
# https://tools.ietf.org/html/rfc7517
79
class Set
810
include Enumerable
911
extend Forwardable

lib/jwt/version.rb

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# frozen_string_literal: true
22

3+
# JSON Web Token implementation
4+
#
5+
# Should be up to date with the latest spec:
6+
# https://tools.ietf.org/html/rfc7519
37
module JWT
48
# Returns the gem version of the JWT library.
59
#

0 commit comments

Comments
 (0)