Class: OMQ::Blake3ZMQ::Crypto::PublicKey

Inherits:
Object
  • Object
show all
Defined in:
lib/omq/blake3zmq/crypto.rb

Overview

X25519 public key wrapper.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bytes) ⇒ PublicKey

Returns a new instance of PublicKey.

Parameters:

  • bytes (String)

    32-byte public key



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

#keyObject (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_sString

Returns the raw 32-byte public key.

Returns:

  • (String)

    32-byte binary string



34
35
36
# File 'lib/omq/blake3zmq/crypto.rb', line 34

def to_s
  @key.to_bytes
end