Class: MlDsa::KeyPair
- Inherits:
-
Object
- Object
- MlDsa::KeyPair
- Defined in:
- lib/ml_dsa/key_pair.rb
Overview
Holds a matched public/secret key pair returned by keygen.
Supports destructuring: pk, sk = MlDsa.keygen(...).
Instance Attribute Summary collapse
- #public_key ⇒ PublicKey readonly
- #secret_key ⇒ SecretKey readonly
Instance Method Summary collapse
-
#initialize(public_key, secret_key) ⇒ KeyPair
constructor
A new instance of KeyPair.
- #inspect ⇒ String (also: #to_s)
- #param_set ⇒ ParameterSet
-
#to_ary ⇒ Array(PublicKey, SecretKey)
(also: #to_a, #deconstruct)
Support destructuring:
pk, sk = keygen(...).
Constructor Details
#initialize(public_key, secret_key) ⇒ KeyPair
Returns a new instance of KeyPair.
12 13 14 15 16 |
# File 'lib/ml_dsa/key_pair.rb', line 12 def initialize(public_key, secret_key) @public_key = public_key @secret_key = secret_key freeze end |
Instance Attribute Details
#public_key ⇒ PublicKey (readonly)
8 9 10 |
# File 'lib/ml_dsa/key_pair.rb', line 8 def public_key @public_key end |
#secret_key ⇒ SecretKey (readonly)
10 11 12 |
# File 'lib/ml_dsa/key_pair.rb', line 10 def secret_key @secret_key end |
Instance Method Details
#inspect ⇒ String Also known as: to_s
33 34 35 |
# File 'lib/ml_dsa/key_pair.rb', line 33 def inspect "#<MlDsa::KeyPair #{param_set.name}>" end |
#param_set ⇒ ParameterSet
28 29 30 |
# File 'lib/ml_dsa/key_pair.rb', line 28 def param_set public_key.param_set end |