weirdnet-contacts 0.1.0

A contact book for Weirdnet apps: trusted and blocked identities, presence with privacy rules (base to everyone, detail to trusted contacts), signed text direct messages with delivery state and an offline queue, and contact links, served over weirdnet-service.
Documentation

weirdnet-contacts

crates.io docs.rs

A contact book for Weirdnet apps: trusted and blocked identities, presence with privacy rules, signed text direct messages with delivery state and an offline queue, and contact links, served over weirdnet-service.

  • Contacts. An identity is a Weirdnet peer id. A contact is unknown, trusted or blocked; a ban list keyed by identity sits beside it and outlives trust. Blocking removes the conversation and refuses everything the identity sends, including a new session.
  • Presence. Everyone who is not blocked sees your base state (online, away or busy). Only the audience your policy names (trusted contacts by default) sees the status line, an in-session hint and last seen, and only the fields the policy shares. Invisible looks offline to everyone.
  • Messages. Text and invite cards, signed over a fixed binary layout, with a delivery state (queued, sent, delivered, read, failed). Unknown senders arrive as message requests, with a per-sender rate limit and a cap on requests. Messages written while the other node is away wait in a queue; a pull fills the gap from the other side, and conversations merge without repeats.
  • Links. weirdnet-contact://<peer id>?name=...&addr=... for a link or QR code.

The relay never carries messages or detail presence; they go node to node. Finding who is online is the job of weirdnet-presence. Nothing is written to disk: Contacts::snapshot and Contacts::restore hand the app plain serde data.

Use

let contacts = std::sync::Arc::new(weirdnet_contacts::Contacts::new(keypair));
let _server = weirdnet_contacts::service::serve(&node, contacts.clone())?;

// write, then send when the other node can be reached
contacts.compose(&friend, weirdnet_contacts::Body::Text("hi".into()), now_ms)?;
let session = weirdnet_contacts::client::open_session(&client, &friend).await?;
weirdnet_contacts::client::flush(&contacts, &session, &friend).await?;
let their_presence = weirdnet_contacts::client::presence(&session).await?;

Part of Weirdnet by Weird Brains. BSD-3-Clause.