Skip to main content

Crate weirdnet_contacts

Crate weirdnet_contacts 

Source
Expand description

A contact book for Weirdnet apps.

  • Book: who you know, as ContactState::Trusted, ContactState::Blocked or not at all, a ban list keyed by identity, and your PresencePolicy.
  • Presence with privacy rules (presence): everyone online sees your base state (online, away or busy), and only trusted contacts see the detail fields (status line, in-session hint, last seen) that your policy allows. presence::view_for decides, in one place.
  • Signed text direct messages and invite cards (message) with a delivery state, an offline queue and conversations that merge, so two nodes (or your own devices) converge after they were apart.
  • ContactLink: a weirdnet-contact: link or QR payload that adds someone.
  • Contacts: the live state behind one Mutex, service::ContactsService to serve it over weirdnet_service, and client to send, flush, pull and read presence.

An identity here is the transport peer id (UserId): the service authorizes a caller by the peer the connection proved, and a message must come from the peer that signed it. The crate is app-neutral and keeps nothing on disk: Contacts::snapshot and Contacts::restore give the app plain serde data to store as it likes.

The relay never carries messages or detail presence; those go node to node. Finding who is online is the job of weirdnet-presence.

Re-exports§

pub use book::Book;
pub use book::Contact;
pub use book::ContactState;
pub use contacts::Contacts;
pub use contacts::Receipt;
pub use contacts::Refusal;
pub use contacts::Snapshot;
pub use id::IdError;
pub use id::UserId;
pub use message::Body;
pub use message::Conversation;
pub use message::Delivery;
pub use message::DirectInvite;
pub use message::Entry;
pub use message::Message;
pub use message::MessageId;
pub use presence::Audience;
pub use presence::Detail;
pub use presence::InSession;
pub use presence::Presence;
pub use presence::PresenceInfo;
pub use presence::PresencePolicy;
pub use presence::PresenceView;
pub use presence::SessionHint;
pub use presence::Viewer;

Modules§

book
The contact book: who is trusted, who is blocked, who is banned, and your presence policy.
client
Talking to another node’s contacts service.
contacts
The live state: your book, conversations, outbox and presence behind one lock.
id
The identity type.
link
Contact links: add someone from a link or a QR code.
message
Signed direct messages, their delivery state, and conversations that merge.
presence
Presence and who may see what.
service
The contacts service: what another node may ask of yours.