class JWT::JWK::KeyBase

Attributes

parameters[R]

Public Class Methods

inherited(klass) click to toggle source
Calls superclass method
# File lib/jwt/jwk/key_base.rb, line 6
def self.inherited(klass)
  super
  ::JWT::JWK.classes << klass
end
new(options, params = {}) click to toggle source
# File lib/jwt/jwk/key_base.rb, line 11
def initialize(options, params = {})
  options ||= {}

  @parameters = params.transform_keys(&:to_sym) # Uniform interface

  # For backwards compatibility, kid_generator may be specified in the parameters
  options[:kid_generator] ||= @parameters.delete(:kid_generator)

  # Make sure the key has a kid
  kid_generator = options[:kid_generator] || ::JWT.configuration.jwk.kid_generator
  self[:kid] ||= kid_generator.new(self).generate
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/jwt/jwk/key_base.rb, line 46
def <=>(other)
  return nil unless other.is_a?(::JWT::JWK::KeyBase)

  self[:kid] <=> other[:kid]
end
==(other) click to toggle source
# File lib/jwt/jwk/key_base.rb, line 40
def ==(other)
  other.is_a?(::JWT::JWK::KeyBase) && self[:kid] == other[:kid]
end
Also aliased as: eql?
[](key) click to toggle source
# File lib/jwt/jwk/key_base.rb, line 32
def [](key)
  @parameters[key.to_sym]
end
[]=(key, value) click to toggle source
# File lib/jwt/jwk/key_base.rb, line 36
def []=(key, value)
  @parameters[key.to_sym] = value
end
eql?(other)
Alias for: ==
hash() click to toggle source
# File lib/jwt/jwk/key_base.rb, line 28
def hash
  self[:kid].hash
end
kid() click to toggle source
# File lib/jwt/jwk/key_base.rb, line 24
def kid
  self[:kid]
end