Sha256: 4f64442542a1a4fb57530b2229d6de423c6adedb33c68bbd9d7bc92179d42e69

Contents?: true

Size: 563 Bytes

Versions: 11

Compression:

Stored size: 563 Bytes

Contents

# frozen_string_literal: true

module Lightning
  module Onion
    class HopData
      attr_accessor :realm, :per_hop, :hmac
      def initialize(realm, per_hop, hmac)
        @realm = realm
        @per_hop = per_hop
        @hmac = hmac
      end

      def self.parse(payload)
        realm, per_hop_payload, hmac = payload.unpack('Ca32a32')
        per_hop = Lightning::Onion::PerHop.parse(per_hop_payload)
        new(realm, per_hop, hmac)
      end

      def to_payload
        [realm, per_hop.to_payload, hmac].pack('Ca32a32')
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
lightning-onion-0.2.10 lib/lightning/onion/hop_data.rb
lightning-onion-0.2.9 lib/lightning/onion/hop_data.rb
lightning-onion-0.2.8 lib/lightning/onion/hop_data.rb
lightning-onion-0.2.6 lib/lightning/onion/hop_data.rb
lightning-onion-0.2.5 lib/lightning/onion/hop_data.rb
lightning-onion-0.2.4 lib/lightning/onion/hop_data.rb
lightning-onion-0.2.3 lib/lightning/onion/hop_data.rb
lightning-onion-0.2.2 lib/lightning/onion/hop_data.rb
lightning-onion-0.2.1 lib/lightning/onion/hop_data.rb
lightning-onion-0.2.0 lib/lightning/onion/hop_data.rb
lightning-onion-0.1.0 lib/lightning/onion/hop_data.rb