Libp2p.Pubsub.MessagePB (libp2p_elixir v0.9.0)

Protobuf encoding/decoding for pubsub Message.

Schema (from third_party/libp2p_specs/pubsub/README.md):

syntax = "proto2";
message Message {
  optional string from = 1;
  optional bytes data = 2;
  optional bytes seqno = 3;
  required string topic = 4;
  optional bytes signature = 5;
  optional bytes key = 6;
}

This module supports StrictNoSign validation helpers (for Eth2 use).

Summary

Functions

Validate StrictNoSign policy: from, seqno, signature, key MUST be absent.

Types

t()

@type t() :: %{
  topic: binary(),
  data: binary() | nil,
  from: binary() | nil,
  seqno: binary() | nil,
  signature: binary() | nil,
  key: binary() | nil
}

Functions

decode(bin)

@spec decode(binary()) :: t()

encode(msg)

@spec encode(t()) :: binary()

validate_strict_no_sign!(msg)

@spec validate_strict_no_sign!(t()) :: :ok

Validate StrictNoSign policy: from, seqno, signature, key MUST be absent.