Skip to main content

cosmic_applet_avestruz/nostr/
mod.rs

1// SPDX-License-Identifier: MIT
2
3//! Everything that speaks Nostr: the relay client and its local event store,
4//! the signed-in account and its key, and the models the views are built from.
5//!
6//! Nothing here knows of the toolkit: no module names a widget, a
7//! message or the model. Three modules do the talking, four more ask a
8//! web server one thing each, and the rest are pure: an event goes in
9//! and something for a view comes out, or what someone meant goes in and
10//! an unsigned event comes out.
11//!
12//! ```mermaid
13//! flowchart LR
14//!     subgraph talk["What talks"]
15//!         client["client: relays and the store"]
16//!         account["account: the keyring, a remote signer"]
17//!         private["private_relay: the relay it runs itself"]
18//!     end
19//!     subgraph web["What asks a web server one thing"]
20//!         nip05
21//!         zap
22//!         relay_info
23//!         blossom
24//!     end
25//!     subgraph read["Events read: what a view shows"]
26//!         models
27//!         content
28//!         markdown
29//!         thread
30//!         feed
31//!         engagement
32//!         search
33//!     end
34//!     subgraph write["Events made: unsigned, for the signer"]
35//!         compose
36//!         contacts
37//!         bookmarks
38//!         relay_lists
39//!         kept_drafts
40//!     end
41//!     subgraph choose["What is decided"]
42//!         outbox["outbox: which relays to ask"]
43//!         sweep["sweep: what the store lets go of"]
44//!         sightings["sightings: which relay sent what"]
45//!     end
46//!     client -->|"reads into"| read
47//!     client -->|"signs and sends"| write
48//!     client -->|"goes by"| choose
49//!     client --> account
50//!     client --> private
51//! ```
52//!
53//! | Module | What it is |
54//! |---|---|
55//! | [`account`] | Parsing an `nsec`, an `npub` or a bunker address, keeping what is secret in the keyring, signing, encrypting |
56//! | [`blossom`] | The account's media servers, and sending a file to them for a note to link to |
57//! | [`bookmarks`] | The account's bookmark list, and what it keeps to itself |
58//! | [`client`] | The relay pools and the LMDB event store behind them |
59//! | [`compose`] | What someone wrote, made into an event ready to be signed |
60//! | [`contacts`] | A contact list, changed by one person |
61//! | [`content`] | A note's text taken apart: links, mentions, hashtags, pictures, quotes |
62//! | [`engagement`] | What others made of a note: replies, reposts, likes and zaps |
63//! | [`feed`] | The notes of a feed, newest first, and the ones that wait beside it |
64//! | [`kept_drafts`] | Drafts as events, as the relay Avestruz runs itself keeps them |
65//! | [`markdown`] | What a note marks as bold, slanted, struck out, code, a heading, quoted or a labelled link |
66//! | [`models`] | Notes and profiles, as the views need them |
67//! | [`nip05`] | Names at a domain, and whether the domain agrees |
68//! | [`notifications`] | What others did that concerns the account: replies, mentions, reactions, reposts and zaps |
69//! | [`outbox`] | People's relay lists, and which of the relays they name to ask |
70//! | [`private_relay`] | The relay Avestruz runs itself, and the way to it |
71//! | [`relay_info`] | What a relay says of itself |
72//! | [`relay_lists`] | The relays an account says are its own, by what they are for |
73//! | [`search`] | Searching for people and notes, and what is typed that is no search |
74//! | [`share`] | A link to a note that anyone can open |
75//! | [`sightings`] | Which relays each note was seen on |
76//! | [`sweep`] | What the event store lets go of, and what it keeps however old |
77//! | [`thread`] | A conversation: a note, what it answers, and what answers it |
78//! | [`zap`] | Asking someone's Lightning address for an invoice that zaps a note |
79//!
80//! Which NIP and which kind each of these speaks is in
81//! [`crate::guide::protocol`], and what is decided about relays in
82//! [`crate::guide::relays`].
83
84pub mod account;
85pub mod blossom;
86pub mod bookmarks;
87pub mod client;
88pub mod compose;
89pub mod contacts;
90pub mod content;
91pub mod engagement;
92pub mod feed;
93pub mod kept_drafts;
94pub mod markdown;
95pub mod models;
96pub mod nip05;
97pub mod notifications;
98pub mod outbox;
99pub mod private_relay;
100pub mod relay_info;
101pub mod relay_lists;
102pub mod search;
103pub mod share;
104pub mod sightings;
105pub mod sweep;
106pub mod thread;
107pub mod zap;