class JWT::JWK::KeyBase
Base for JWK
implementations
Attributes
parameters[R]
Public Class Methods
inherited(klass)
click to toggle source
Calls superclass method
# File lib/jwt/jwk/key_base.rb, line 7 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 12 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 47 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 41 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 33 def [](key) @parameters[key.to_sym] end
[]=(key, value)
click to toggle source
# File lib/jwt/jwk/key_base.rb, line 37 def []=(key, value) @parameters[key.to_sym] = value end
hash()
click to toggle source
# File lib/jwt/jwk/key_base.rb, line 29 def hash self[:kid].hash end
kid()
click to toggle source
# File lib/jwt/jwk/key_base.rb, line 25 def kid self[:kid] end