Class: JWT::JWK::AKP
- Inherits:
-
KeyBase
- Object
- KeyBase
- JWT::JWK::AKP
show all
- Defined in:
- lib/pq_crypto/jwt/jwk/akp.rb
Defined Under Namespace
Classes: NullKidGenerator
Constant Summary
collapse
- KTY =
"AKP".freeze
- KTYS =
[
KTY,
PQCrypto::Signature::PublicKey,
JWT::JWK::AKP,
].freeze
- AKP_KEY_ELEMENTS =
%i[kty alg pub priv].freeze
Instance Method Summary
collapse
Constructor Details
#initialize(key, params = nil, options = {}) ⇒ AKP
Returns a new instance of AKP.
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/pq_crypto/jwt/jwk/akp.rb', line 22
def initialize(key, params = nil, options = {})
params ||= {}
options ||= {}
options = { kid_generator: NullKidGenerator }.merge(options)
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
|
Instance Method Details
#[]=(key, value) ⇒ Object
65
66
67
68
69
|
# File 'lib/pq_crypto/jwt/jwk/akp.rb', line 65
def []=(key, value)
raise ArgumentError, "cannot overwrite cryptographic key attributes" if AKP_KEY_ELEMENTS.include?(key.to_sym)
super
end
|
#export(_options = {}) ⇒ Object
49
50
51
|
# File 'lib/pq_crypto/jwt/jwk/akp.rb', line 49
def export(_options = {})
parameters.clone.tap { |exported| exported.delete(:priv) }
end
|
#members ⇒ Object
53
54
55
|
# File 'lib/pq_crypto/jwt/jwk/akp.rb', line 53
def members
%i[alg kty pub].each_with_object({}) { |key, out| out[key] = self[key] }
end
|
#private? ⇒ Boolean
33
34
35
|
# File 'lib/pq_crypto/jwt/jwk/akp.rb', line 33
def private?
false
end
|
#signing_key ⇒ Object
41
42
43
|
# File 'lib/pq_crypto/jwt/jwk/akp.rb', line 41
def signing_key
public_key
end
|
#verify_key ⇒ Object
45
46
47
|
# File 'lib/pq_crypto/jwt/jwk/akp.rb', line 45
def verify_key
public_key
end
|