Module: BSV::Wallet::Serializer::RevealCounterpartyKeyLinkage::Result
- Defined in:
- lib/bsv/wallet/serializer/reveal_counterparty_key_linkage.rb
Overview
Result wire layout:
[33 bytes: prover pubkey]
[33 bytes: verifier pubkey]
[33 bytes: counterparty pubkey]
[VarInt revelation_time_len][revelation_time bytes]
[VarInt encrypted_linkage_len][encrypted_linkage bytes]
[VarInt encrypted_linkage_proof_len][encrypted_linkage_proof bytes]
Class Method Summary collapse
Class Method Details
.deserialize(bytes) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/bsv/wallet/serializer/reveal_counterparty_key_linkage.rb', line 78 def deserialize(bytes) r = BSV::Wallet::Wire::Reader.new(bytes) prover = r.read_bytes(PUBKEY_SIZE) verifier = r.read_bytes(PUBKEY_SIZE) counterparty = r.read_bytes(PUBKEY_SIZE) revelation_time = r.read_str_with_varint_len el_len = r.read_varint encrypted_linkage = r.read_bytes(el_len) elp_len = r.read_varint encrypted_linkage_proof = r.read_bytes(elp_len) { prover: prover, verifier: verifier, counterparty: counterparty, revelation_time: revelation_time, encrypted_linkage: encrypted_linkage, encrypted_linkage_proof: encrypted_linkage_proof } end |
.serialize(result) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/bsv/wallet/serializer/reveal_counterparty_key_linkage.rb', line 63 def serialize(result) w = BSV::Wallet::Wire::Writer.new w.write_bytes(pubkey_bytes(result[:prover])) w.write_bytes(pubkey_bytes(result[:verifier])) w.write_bytes(pubkey_bytes(result[:counterparty])) w.write_str_with_varint_len(result[:revelation_time].to_s) encrypted_linkage = Common.to_binary(result[:encrypted_linkage]) w.write_varint(encrypted_linkage.bytesize) w.write_bytes(encrypted_linkage) encrypted_linkage_proof = Common.to_binary(result[:encrypted_linkage_proof]) w.write_varint(encrypted_linkage_proof.bytesize) w.write_bytes(encrypted_linkage_proof) w.buf end |