# weirdnet-contacts
[](https://crates.io/crates/weirdnet-contacts)
[](https://docs.rs/weirdnet-contacts)
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](https://crates.io/crates/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](https://crates.io/crates/weirdnet-presence). Nothing is written to disk: `Contacts::snapshot` and `Contacts::restore` hand the app plain serde data.
## Use
```rust,ignore
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](https://net.weirdbrains.com) by [Weird Brains](https://weirdbrains.com). BSD-3-Clause.