Class: Universa::KeyAddress

Inherits:
RemoteAdapter show all
Defined in:
lib/universa/keys.rb

Overview

The com.icodici.crypto.KeyAddress extension. As it is immutable, caching is used to avoid unnecessary UMI calls.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RemoteAdapter

#__getobj__, #__setobj__, #initialize, #inspect, invoke_static, remote_class, remote_class_name

Constructor Details

This class inherits a constructor from Universa::RemoteAdapter

Class Method Details

.from_packed(binary_string) ⇒ Object

Unpack from binary bytes

Parameters:

  • binary_string (String)

    with binary packed bytes



66
67
68
69
# File 'lib/universa/keys.rb', line 66

def self.from_packed(binary_string)
  binary_string.force_encoding 'binary'
  KeyAddress.new(binary_string)
end

Instance Method Details

#packedString

returns binary representation. It is not a string representation!

Returns:

  • (String)

    binary string representation



73
74
75
76
77
# File 'lib/universa/keys.rb', line 73

def packed
  s = get_packed
  s.force_encoding 'binary'
  s
end

#to_sString

String form of the key which could be used to unpack it back

Returns:

  • (String)

    packed string representation



60
61
62
# File 'lib/universa/keys.rb', line 60

def to_s
  @string ||= toString()
end