Class: OMQ::Blake3ZMQ::Crypto::PublicKey
- Inherits:
-
Object
- Object
- OMQ::Blake3ZMQ::Crypto::PublicKey
- Defined in:
- lib/omq/blake3zmq/crypto.rb
Overview
X25519 public key wrapper.
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
-
#initialize(bytes) ⇒ PublicKey
constructor
A new instance of PublicKey.
-
#to_s ⇒ String
Returns the raw 32-byte public key.
Constructor Details
#initialize(bytes) ⇒ PublicKey
Returns a new instance of PublicKey.
25 26 27 28 |
# File 'lib/omq/blake3zmq/crypto.rb', line 25 def initialize(bytes) bytes = bytes.to_s if bytes.respond_to?(:to_bytes) @key = X25519::MontgomeryU.new(bytes.b) end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
21 22 23 |
# File 'lib/omq/blake3zmq/crypto.rb', line 21 def key @key end |
Instance Method Details
#to_s ⇒ String
Returns the raw 32-byte public key.
34 35 36 |
# File 'lib/omq/blake3zmq/crypto.rb', line 34 def to_s @key.to_bytes end |