Skip to main content

mesh-peer-registry

A small, shared, language-agnostic peer registry for the mesh network used by hermes-mesh and openclaw-mesh.

Peers register with an Ed25519 public key and a webhook URL, then discover each other over a simple HTTP API. The server never holds private keys.

About

mesh-peer-registry provides a centralized but state-light way for mesh agents to announce themselves to one another:

  • Peers register an Ed25519 public key and a webhook URL under a unique name.
  • Registration, deregistration, and refresh requests are signed by the peer's private key, so the registry can trust the public key it stores.
  • Other peers query the registry to find a recipient's webhook URL and public key.
  • Mesh messages are signed by the sender and verified by the receiver against the sender's public key from the registry.

The signing protocol uses compact, deterministic, sorted-key JSON, making it straightforward to implement in other runtimes (e.g. the Node.js implementation in openclaw-mesh).

Features

  • HTTP API for register, list, get, refresh, and deregister operations.
  • Ed25519 signatures on all mutating requests.
  • SQLite-backed store by default, with the path configurable via --store.
  • TTL + reaper — peers can register with a TTL in seconds; a background reaper removes expired peers and refreshes keep them alive.
  • CLI server launcher.
  • Python client (RegistryClient) with built-in signing.
  • No private keys kept by the registry.

Quick start

Install and run the server:

pip install mesh-peer-registry
mesh-peer-registry --port 8646 --store ~/.mesh/registry.sqlite

The server will listen on http://127.0.0.1:8646 and store peers in ~/.mesh/registry.sqlite.

CLI options

Option Default Description
--host 127.0.0.1 Bind host.
--port 8646 Bind port.
--store ~/.mesh/registry.sqlite SQLite store file path.
--reaper-interval 60.0 Interval in seconds between TTL reaping passes.
--admin-token Token required for /health and /metrics.
--ssl-cert / --ssl-key Optional TLS certificate and key for HTTPS.

API

Method Path Description
POST /register Register or update a peer. Body must include name, url, public_key. Optional: role, description, ttl (seconds). Signed with X-Mesh-Signature.
GET /peers List peers. Query params: role, limit, offset. Returns {peers, total, limit, offset}.
GET /peers/{name} Get one peer.
POST /peers/{name}/refresh Refresh last_seen for a peer (prevents TTL expiry). Signed with X-Mesh-Signature.
DELETE /peers/{name} Deregister a peer. Signed with X-Mesh-Signature.
GET /health Health check. Requires X-Admin-Token if --admin-token is set.
GET /metrics Basic registry metrics. Requires X-Admin-Token if --admin-token is set.

All registration, refresh, and deregistration requests must include a valid Ed25519 signature in the X-Mesh-Signature header over the sorted JSON body (or the action payload for refresh/deregister).

Python client

from mesh_peer_registry.crypto import generate_keypair
from mesh_peer_registry.client import RegistryClient

private, public = generate_keypair()
client = RegistryClient("http://127.0.0.1:8646", private, public)

client.register(
    "agent0",
    "http://127.0.0.1:8645/mesh/receive",
    role="operator",
    description="Hermes operator node",
    ttl=3600,
)

print(client.list_peers())

# Keep the registration alive before the TTL expires.
client.refresh("agent0")

# Later, deregister.
client.deregister("agent0")

Verifying a message

Receivers fetch the sender's public key from the registry and verify the X-Mesh-Signature header:

from mesh_peer_registry.crypto import verify_message
from mesh_peer_registry.client import RegistryClient

client = RegistryClient("http://127.0.0.1:8646", "", "")
peer = client.get_peer("agent0")

# body is the raw request body; signature is from the X-Mesh-Signature header.
ok = verify_message(peer.public_key, body, signature)

When X-Mesh-Timestamp is included in the signed payload (optional, controlled by MESH_SIGN_TIMESTAMP on the sender), the receiver should prepend f"{timestamp}\n" to the body before verification. Backward-compatible receivers try both forms.

Development

python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mesh_peer_registry-0.1.1.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mesh_peer_registry-0.1.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file mesh_peer_registry-0.1.1.tar.gz.

File metadata

  • Download URL: mesh_peer_registry-0.1.1.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for mesh_peer_registry-0.1.1.tar.gz
Algorithm Hash digest
SHA256 37e607efec172a71687f43b21251a58e8b46f8a060738f2b498bcc1e1a82b0a5
MD5 021ec7da89d0472bcb9a3397eb1815be
BLAKE2b-256 d4e6fd57be0ab1328cbf625f39ddd41cf313d29d35012552336a10c4dda071e4

See more details on using hashes here.

File details

Details for the file mesh_peer_registry-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mesh_peer_registry-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 da86a3e7031c0b42f3bfa5289ac94a28da046aea34192a7866363d15a2e49837
MD5 99c302ed828d6e908b75bf8daef12ab8
BLAKE2b-256 08677e77de7fb09c3d7bdcec4c71d9defb4e2825ec7c71e3be1709e9d8720cdd

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.8

1 file

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

1 file

0.1.3

2 files

0.1.2

2 files

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page