• Stars
    star
    208
  • Rank 189,015 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 4 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A universal, distributed and secure messaging protocol for Reticulum

Lightweight Extensible Message Format

LXMF is a simple and flexible messaging format and delivery protocol that allows a wide variety of implementations, while using as little bandwidth as possible. It is built on top of Reticulum and offers zero-conf message routing, end-to-end encryption and Forward Secrecy, and can be transported over any kind of medium that Reticulum supports.

LXMF is efficient enough that it can deliver messages over extremely low-bandwidth systems such as packet radio or LoRa. Encrypted LXMF messages can also be encoded as QR-codes or text-based URIs, allowing completely analog paper message transport.

User-facing clients built on LXMF include:

Structure

LXMF messages are stored in a simple and efficient format, that's easy to parse and write.

The format follows this general structure:

  • Destination
  • Source
  • Ed25519 Signature
  • Payload
    • Timestamp
    • Content
    • Title
    • Fields

And these rules:

  1. A LXMF message is identified by its message-id, which is a SHA-256 hash of the Destination, Source and Payload. The message-id is never included directly in the message, since it can always be inferred from the message itself.

    In some cases the actual message-id cannot be inferred, for example when a Propagation Node is storing an encrypted message for an offline user. In these cases a transient-id is used to identify the message while in storage or transit.

  2. Destination, Source, Signature and Payload parts are mandatory, as is the Timestamp part of the payload.

    • The Destination and Source fields are 16-byte Reticulum destination hashes
    • The Signature field is a 64-byte Ed25519 signature of the Destination, Source, Payload and message-id
    • The Payload part is a msgpacked list containing four items:
      1. The Timestamp is a double-precision floating point number representing the number of seconds since the UNIX epoch.
      2. The Content is the optional content or body of the message
      3. The Title is an optional title for the message
      4. The Fields is an optional dictionary
  3. The Content, Title and Fields parts must be included in the message structure, but can be left empty.

  4. The Fields part can be left empty, or contain a dictionary of any structure or depth.

Usage Examples

LXMF offers flexibility to implement many different messaging schemes, ranging from human communication to machine control and sensor monitoring. Here are a few examples:

  • A messaging system for passing short, simple messages between human users, akin to SMS can be implemented using only the Content field, and leaving all other optional fields empty.

  • For sending full-size mail, an email-like system can be implemented using the Title and Content fields to store "subject" and "body" parts of the message, and optionally the Fields part can be used to store attachments or other metadata.

  • Machine-control messages or sensor readings can be implemented using command structures embedded in the Fields dictionary.

  • Distributed discussion or news-groups, akin to USENET or similar systems, can be implemented using the relevant fields and LXMF Propagation Nodes. Broadcast bulletins can be implemented in a similar fashion.

Propagation Nodes

LXM Propagation Nodes offer a way to store and forward messages to users or endpoints that are not directly reachable at the time of message emission. Propagation Nodes can also provide infrastructure for distributed bulletin, news or discussion boards.

When Propagation Nodes exist on a Reticulum network, they will by default peer with each other and synchronise messages, automatically creating an encrypted, distributed message store. Users and other endpoints can retrieve messages destined for them from any available Propagation Nodes on the network.

The LXM Router

The LXM Router handles transporting messages over a Reticulum network, managing delivery receipts, outbound and inbound queues, and is the point of API interaction for client programs. The LXM Router also implements functionality for acting as an LXMF Propagation Node.

Programatically, using the LXM Router to send a message is as simple as:

import LXMF

lxm_router = LXMF.LXMRouter()

message = LXMF.LXMessage(destination, source, "This is a short, simple message.")

lxm_router.handle_outbound(message)

The LXM Router then handles the heavy lifting, such as message packing, encryption, delivery confirmation, path lookup, routing, retries and failure notifications.

Transport Encryption

LXMF uses encryption provided by Reticulum, and thus uses end-to-end encryption by default. The delivery method of a message will influence which transport encryption scheme is used.

  • If a message is delivered over a Reticulum link (which is the default method), the message will be encrypted with ephemeral AES-128 keys derived with ECDH on Curve25519. This mode offers forward secrecy.

  • A message can be delivered opportunistically, embedded in a single Reticulum packet. In this cases the message will be opportunistically routed through the network, and will be encrypted with per-packet AES-128 keys derived with ECDH on Curve25519.

  • If a message is delivered to the Reticulum GROUP destination type, the message will be encrypted using the symmetric AES-128 key of the GROUP destination.

Wire Format & Overhead

Assuming the default Reticulum configuration, the binary wire-format is as follows:

  • 16 bytes destination hash
  • 16 bytes source hash
  • 64 bytes Ed25519 signature
  • Remaining bytes of msgpack payload data, in accordance with the structure defined above

The complete message overhead for LXMF is only 111 bytes, which in return gives you timestamped, digitally signed, infinitely extensible, end-to-end encrypted, zero-conf routed, minimal-infrastructure messaging that's easy to use and build applications with.

Code Examples

Before writing your own programs using LXMF, you need to have a basic understanding of how the Reticulum protocol and API works. Please see the Reticulum Manual. For a few simple examples of how to send and receive messages with LXMF, please see the receiver example and the sender example included in this repository.

Example Paper Message

You can try out the paper messaging functionality by using the following QR code. It is a paper message sent to the LXMF address 6b3362bd2c1dbf87b66a85f79a8d8c75. To be able to decrypt and read the message, you will need to import the following Reticulum Identity to an LXMF messaging app:

3BPTDTQCRZPKJT3TXAJCMQFMOYWIM3OCLKPWMG4HCF2T4CH3YZHVNHNRDU6QAZWV2KBHMWBNT2C62TQEVC5GLFM4MN25VLZFSK3ADRQ=

The Sideband application allows you to do this easily. After you have imported the identity into an app of your choice, you can scan the following QR code and open it in the app, where it will be decrypted and added as a message.

You can also find the entire message in this link:

lxm://azNivSwdv4e2aoX3mo2MdTAozuI7BlzrLlHULmnVgpz3dNT9CMPVwgywzCJP8FVogj5j_kU7j7ywuvBNcr45kRTrd19c3iHenmnSDe4VEd6FuGsAiT0Khzl7T81YZHPTDhRNp0FdhDE9AJ7uphw7zKMyqhHHxOxqrYeBeKF66gpPxDceqjsOApvsSwggjcuHBx9OxOBy05XmnJxA1unCKgvNfOFYc1T47luxoY3c0dLOJnJPwZuFRytx2TXlQNZzOJ28yTEygIfkDqEO9mZi5lgev7XZJ0DvgioQxMIyoCm7lBUzfq66zW3SQj6vHHph7bhr36dLOCFgk4fZA6yia2MlTT9KV66Tn2l8mPNDlvuSAJhwDA_xx2PN9zKadCjo9sItkAp8r-Ss1CzoUWZUAyT1oDw7ly6RrzGBG-e3eM3CL6u1juIeFiHby7_3cON-6VTUuk4xR5nwKlFTu5vsYMVXe5H3VahiDSS4Q1aqX7I

On operating systems that allow for registering custom URI-handlers, you can click the link, and it will be decoded directly in your LXMF client. This works with Sideband on Android.

Caveat Emptor

LXMF is beta software, and should be considered experimental. While it has been built with cryptography best practices very foremost in mind, it has not been externally security audited, and there could very well be privacy-breaking bugs. If you want to help out, or help sponsor an audit, please do get in touch.

Installation

If you want to try out LXMF, you can install it with pip:

pip install lxmf

If you are using an operating system that blocks normal user package installation via pip, you can return pip to normal behaviour by editing the ~/.config/pip/pip.conf file, and adding the following directive in the [global] section:

[global]
break-system-packages = true

Alternatively, you can use the pipx tool to install Reticulum in an isolated environment:

pipx install lxmf

Development Roadmap

LXMF is actively being developed, and the following improvements and features are currently planned for implementation:

  • Write and release full API and protocol documentation
  • Update examples in readme to actually work
  • Content Destinations, and easy to use API for group messaging and discussion threads
  • Sneakernet and physical transport functionality
  • Documenting and possibly expanding LXMF limits and priorities
  • Sync affinity based on link speeds and distances, for more intelligently choosing peer sync order
  • Markets on LXMF

More Repositories

1

Reticulum

The cryptography-based networking stack for building unstoppable networks with LoRa, Packet Radio, WiFi and everything in between.
Python
1,946
star
2

NomadNet

Communicate Freely
Python
1,125
star
3

Sideband

LXMF client for Android, Linux and macOS allowing you to communicate with people or LXMF-compatible systems over Reticulum networks using LoRa, Packet Radio, WiFi, I2P, or anything else Reticulum supports.
Python
337
star
4

MicroAPRS

APRS fork of MicroModem
C
255
star
5

MicroModem

Atmega328p-based 1200 Baud AFSK radio modem
C
211
star
6

LibAPRS

An APRS library for the Arduino IDE
C++
197
star
7

OpenModem

Powerful AFSK modem platform
C
182
star
8

RNode_Firmware

RNode is an open, free and flexible digital radio interface with many uses
Python
166
star
9

tncattach

Attach TNC devices as network interfaces
C
122
star
10

MicroModemGP

General purpose firmware for MicroModem with forward error correction and larger packet sizes
C
59
star
11

MidiKatapult

Custom layout mapper for the Novation Launchpad
Processing
27
star
12

LoRaMon

LoRa packet sniffer for RNode hardware
Python
25
star
13

rnodeconfigutil

Python
24
star
14

MicroDigi

Standalone digipeater firmware for MicroModem
C
18
star
15

WiPacket

A simple WiFi raw packet interface
C
15
star
16

ArduLASER

Arduino based laser controller
Processing
10
star
17

reticulum_website

Website for Reticulum
CSS
9
star
18

TelemetryKit

Arduino library for 1200-baud AFSK FPV audio-channel telemetry
C++
5
star
19

openmodemconfigutil

Configuration utility for OpenModem
CSS
4
star
20

rnview

Remote view utility for Reticulum
Python
3
star
21

otp

One-Time Pad Helper
C
2
star