Class: JWT::JWK::OKPRbNaCl
Constant Summary
collapse
- KTY =
'OKP'
- KTYS =
[KTY, JWT::JWK::OKPRbNaCl, RbNaCl::Signatures::Ed25519::SigningKey, RbNaCl::Signatures::Ed25519::VerifyKey].freeze
- OKP_PUBLIC_KEY_ELEMENTS =
%i[kty n x].freeze
- OKP_PRIVATE_KEY_ELEMENTS =
%i[d].freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from KeyBase
#<=>, #==, #[], #[]=, #hash, inherited, #kid
Constructor Details
#initialize(key, params = nil, options = {}) ⇒ OKPRbNaCl
Returns a new instance of OKPRbNaCl.
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/jwt/jwk/okp_rbnacl.rb', line 11
def initialize(key, params = nil, options = {})
params ||= {}
params = { kid: params } if params.is_a?(String)
key_params = (key)
params = params.transform_keys(&:to_sym)
check_jwk_params!(key_params, params)
super(options, key_params.merge(params))
end
|
Class Method Details
.import(jwk_data) ⇒ Object
104
105
106
|
# File 'lib/jwt/jwk/okp_rbnacl.rb', line 104
def import(jwk_data)
new(jwk_data)
end
|
Instance Method Details
#export(options = {}) ⇒ Object
48
49
50
51
52
|
# File 'lib/jwt/jwk/okp_rbnacl.rb', line 48
def export(options = {})
exported = parameters.clone
exported.reject! { |k, _| OKP_PRIVATE_KEY_ELEMENTS.include?(k) } unless private? && options[:include_private] == true
exported
end
|
#key_digest ⇒ Object
36
37
38
|
# File 'lib/jwt/jwk/okp_rbnacl.rb', line 36
def key_digest
Thumbprint.new(self).to_s
end
|
#members ⇒ Object
44
45
46
|
# File 'lib/jwt/jwk/okp_rbnacl.rb', line 44
def members
OKP_PUBLIC_KEY_ELEMENTS.each_with_object({}) { |i, h| h[i] = self[i] }
end
|
#private? ⇒ Boolean
40
41
42
|
# File 'lib/jwt/jwk/okp_rbnacl.rb', line 40
def private?
!signing_key.nil?
end
|
#signing_key ⇒ Object
30
31
32
33
34
|
# File 'lib/jwt/jwk/okp_rbnacl.rb', line 30
def signing_key
return @signing_key if defined?(@signing_key)
@signing_key = signing_key_from_parameters
end
|
#verify_key ⇒ Object
24
25
26
27
28
|
# File 'lib/jwt/jwk/okp_rbnacl.rb', line 24
def verify_key
return @verify_key if defined?(@verify_key)
@verify_key = verify_key_from_parameters
end
|