Class: LightJWT::JWK::Key
- Inherits:
-
Object
- Object
- LightJWT::JWK::Key
- Defined in:
- lib/light_jwt/jwk.rb
Instance Attribute Summary collapse
-
#alg ⇒ Object
readonly
Returns the value of attribute alg.
-
#crv ⇒ Object
readonly
Returns the value of attribute crv.
-
#e ⇒ Object
readonly
Returns the value of attribute e.
-
#key_data ⇒ Object
readonly
Returns the value of attribute key_data.
-
#kid ⇒ Object
readonly
Returns the value of attribute kid.
-
#kty ⇒ Object
readonly
Returns the value of attribute kty.
-
#n ⇒ Object
readonly
Returns the value of attribute n.
-
#use ⇒ Object
readonly
Returns the value of attribute use.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
-
#initialize(key_data) ⇒ Key
constructor
A new instance of Key.
- #public_key ⇒ Object
Constructor Details
#initialize(key_data) ⇒ Key
Returns a new instance of Key.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/light_jwt/jwk.rb', line 30 def initialize(key_data) @key_data = key_data @kty = key_data['kty'] @use = key_data['use'] @alg = key_data['alg'] @kid = key_data['kid'] @n = key_data['n'] @e = key_data['e'] @x = key_data['x'] @y = key_data['y'] @crv = key_data['crv'] validate_key end |
Instance Attribute Details
#alg ⇒ Object (readonly)
Returns the value of attribute alg.
28 29 30 |
# File 'lib/light_jwt/jwk.rb', line 28 def alg @alg end |
#crv ⇒ Object (readonly)
Returns the value of attribute crv.
28 29 30 |
# File 'lib/light_jwt/jwk.rb', line 28 def crv @crv end |
#e ⇒ Object (readonly)
Returns the value of attribute e.
28 29 30 |
# File 'lib/light_jwt/jwk.rb', line 28 def e @e end |
#key_data ⇒ Object (readonly)
Returns the value of attribute key_data.
28 29 30 |
# File 'lib/light_jwt/jwk.rb', line 28 def key_data @key_data end |
#kid ⇒ Object (readonly)
Returns the value of attribute kid.
28 29 30 |
# File 'lib/light_jwt/jwk.rb', line 28 def kid @kid end |
#kty ⇒ Object (readonly)
Returns the value of attribute kty.
28 29 30 |
# File 'lib/light_jwt/jwk.rb', line 28 def kty @kty end |
#n ⇒ Object (readonly)
Returns the value of attribute n.
28 29 30 |
# File 'lib/light_jwt/jwk.rb', line 28 def n @n end |
#use ⇒ Object (readonly)
Returns the value of attribute use.
28 29 30 |
# File 'lib/light_jwt/jwk.rb', line 28 def use @use end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
28 29 30 |
# File 'lib/light_jwt/jwk.rb', line 28 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
28 29 30 |
# File 'lib/light_jwt/jwk.rb', line 28 def y @y end |
Instance Method Details
#public_key ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/light_jwt/jwk.rb', line 45 def public_key case kty when 'RSA' build_rsa_public_key when 'EC' build_ec_public_key else raise ArgumentError, "Unsupported key type: #{kty}" end end |