Class: OPP::KeyPair
- Inherits:
-
Object
- Object
- OPP::KeyPair
- Defined in:
- lib/opp/key_pair.rb
Instance Attribute Summary collapse
-
#private_key ⇒ Object
readonly
Returns the value of attribute private_key.
-
#public_key ⇒ Object
readonly
Returns the value of attribute public_key.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(signing_key) ⇒ KeyPair
constructor
A new instance of KeyPair.
- #sign(bytes) ⇒ Object
Constructor Details
Instance Attribute Details
#private_key ⇒ Object (readonly)
Returns the value of attribute private_key.
5 6 7 |
# File 'lib/opp/key_pair.rb', line 5 def private_key @private_key end |
#public_key ⇒ Object (readonly)
Returns the value of attribute public_key.
5 6 7 |
# File 'lib/opp/key_pair.rb', line 5 def public_key @public_key end |
Class Method Details
.from_private_key(value) ⇒ Object
11 12 13 |
# File 'lib/opp/key_pair.rb', line 11 def self.from_private_key(value) new(Ed25519::SigningKey.new(Base64URL.decode(value, length: 32))) end |
.generate ⇒ Object
7 8 9 |
# File 'lib/opp/key_pair.rb', line 7 def self.generate new(Ed25519::SigningKey.generate) end |
Instance Method Details
#sign(bytes) ⇒ Object
21 22 23 |
# File 'lib/opp/key_pair.rb', line 21 def sign(bytes) @signing_key.sign(bytes) end |