Lob v0.1.1 Lob

Length-Object-Binary (LOB) Packet Encoding

Data serialization, primarily in use by the Telehash Project

Summary

Functions

Cloak a packet to frustrate wire monitoring

De-cloak a cloaked packet

Decode a wire packet for consumption

Encode a head and body into a packet

Types

maybe_binary :: binary | nil

Functions

cloak(b)

Specs

cloak(binary) :: binary

Cloak a packet to frustrate wire monitoring

A random number (between 1 and 20) of rounds are applied. This also serves to slightly obfuscate the message size.

decloak(b)

Specs

decloak(binary) :: Lob.DecodedPacket.t | no_return

De-cloak a cloaked packet.

Upon success, the decoded packet will have the number of cloaking rounds unfurled in the cloaked field.

decode(arg)

Specs

decode(binary) :: Lob.DecodedPacket.t | no_return

Decode a wire packet for consumption

The parts are returned in a struct compliant with the specification. Errors reflecting improperly decoded JSON are stored in the json field.

encode(head, body)

Specs

encode(maybe_binary | map, maybe_binary) ::
  binary |
  no_return

Encode a head and body into a packet

The packet should be usable across any supported transport. May raise an exception if the payload is too large or there are encoding errors.