Sha256: b83b03f7270fba8186f4212894666ce8c8cc7504bfb4528e27545e798fac7e06

Contents?: true

Size: 458 Bytes

Versions: 10

Compression:

Stored size: 458 Bytes

Contents

require 'xdr'

class Signature < XDR::Struct
  attribute :public_key, XDR::Opaque[32]
  attribute :data, XDR::Opaque[32]
end

class Envelope < XDR::Struct
  attribute :body,      XDR::VarOpaque[]
  attribute :timestamp, XDR::Int
  attribute :signature, Signature
end

sig            = Signature.new()
sig.public_key = "\x01" * 32
sig.data       = "\x00" * 32

env = Envelope.new({
  signature: sig,
  body: "hello",
  timestamp: Time.now.to_i
})

env.to_xdr

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
payshares-xdr-0.0.2 examples/struct.rb
xdr-3.0.1 examples/struct.rb
xdr-3.0.0 examples/struct.rb
xdr-2.0.0 examples/struct.rb
xdr-1.0.0 examples/struct.rb
xdr-0.1.0 examples/struct.rb
xdr-0.0.4 examples/struct.rb
xdr-0.0.3 examples/struct.rb
xdr-0.0.2 examples/struct.rb
xdr-0.0.1 examples/struct.rb