Module: BSV::Wallet::Serializer::GetPublicKey::Result
- Defined in:
- lib/bsv/wallet/serializer/get_public_key.rb
Overview
Result wire layout:
[33 bytes: compressed public key]
Class Method Summary collapse
Class Method Details
.deserialize(bytes) ⇒ Object
77 78 79 80 81 |
# File 'lib/bsv/wallet/serializer/get_public_key.rb', line 77 def deserialize(bytes) raise ArgumentError, "public key too short: #{bytes.bytesize}" if bytes.bytesize < PUBKEY_SIZE { public_key: bytes.byteslice(0, PUBKEY_SIZE) } end |
.serialize(result) ⇒ Object
72 73 74 75 |
# File 'lib/bsv/wallet/serializer/get_public_key.rb', line 72 def serialize(result) pubkey = result[:public_key] || ''.b pubkey.bytesize == PUBKEY_SIZE ? pubkey.b : [pubkey.to_s].pack('H*') end |