Class: LightJWT::JWK
- Inherits:
-
Object
- Object
- LightJWT::JWK
- Defined in:
- lib/light_jwt/jwk.rb
Defined Under Namespace
Classes: Key
Constant Summary collapse
- SUPPORTED_KEY_TYPES =
%w[RSA EC].freeze
- SUPPORTED_KEY_USES =
%w[sig enc].freeze
- SUPPORTED_CURVES =
%w[P-256 P-384 P-521].freeze
Instance Attribute Summary collapse
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
Instance Method Summary collapse
- #get(kid) ⇒ Object
-
#initialize(jwks_uri) ⇒ JWK
constructor
A new instance of JWK.
Constructor Details
#initialize(jwks_uri) ⇒ JWK
15 16 17 18 |
# File 'lib/light_jwt/jwk.rb', line 15 def initialize(jwks_uri) @jwks_uri = jwks_uri @keys = fetch_jwks end |
Instance Attribute Details
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
13 14 15 |
# File 'lib/light_jwt/jwk.rb', line 13 def keys @keys end |
Instance Method Details
#get(kid) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/light_jwt/jwk.rb', line 20 def get(kid) key_data = @keys.find { |k| k['kid'] == kid } raise ArgumentError, "JWK with kid '#{kid}' not found" unless key_data Key.new(key_data) end |