Skip to main content

LXMFace

LXMFace turns a Reticulum / LXMF identity hash into a deterministic, recognizable circular avatar. Same hash, same face, every time, in any language.

Why

Reticulum identities are 16-byte hex strings. They identify peers, but they don't read like names. A stable visual handle makes an address easier to recognize at a glance and harder to spoof — a contact whose face suddenly changes is a contact whose hash changed.

The output is a self-contained SVG string: no server, no image files, no lookups.

Use it from Rust

use lxmface::lxmface_svg;

let svg = lxmface_svg("a7b3c9d1e5f20681943ab2de77fc8e01", 64);

lxmface_svg returns an SVG document as a String sized in pixels. Same input always produces the same output. Zero runtime dependencies, no_std compatible (requires alloc).

If you need the raw colors and grid for non-SVG rendering — native canvas, terminal, pixel buffer — call lxmface::lxmface_data(seed) instead and read color, bgcolor, spotcolor, and the [[u8; 8]; 8] grid yourself.

Use it from JS

<script src="lxmface.js"></script>
<script>
document.getElementById('avatar').innerHTML =
lxmface('a7b3c9d1e5f20681943ab2de77fc8e01', 64);
</script>

Single file, no build step, no dependencies. The browser file exposes a global lxmface, CommonJS exports, and AMD; package metadata points module at the same file. The Rust and JS implementations are bit-for-bit identical: an avatar generated by a Tauri build matches one generated by a browser bundle, validated by shared test vectors.

Where it's used

LXMFace is published as a standalone library at github.com/ratspeak/lxmface. The Ratspeak app does not yet consume it — the desktop and mobile clients still render avatars from an older inline implementation that LXMFace was extracted and standardized from. Migrating the app onto LXMFace is open work; external consumers can use it today.

Stability and license

Stable API at 0.1.0. The compatibility test suite (lxmface/tests/compatibility.rs and lxmface/tests/compatibility.js) is the contract — any change that breaks the shared vectors.json is a breaking change. LXMFace is MIT-licensed. The algorithm is adapted from blockies, also MIT, with a circular clip and a string-SVG output instead of a square canvas raster.