Skip to main content

Module nostr

Module nostr 

Source
Expand description

Everything that speaks Nostr: the relay client and its local event store, the signed-in account and its key, and the models the views are built from.

Nothing here knows of the toolkit: no module names a widget, a message or the model. Three modules do the talking, four more ask a web server one thing each, and the rest are pure: an event goes in and something for a view comes out, or what someone meant goes in and an unsigned event comes out.

flowchart LR
    subgraph talk["What talks"]
        client["client: relays and the store"]
        account["account: the keyring, a remote signer"]
        private["private_relay: the relay it runs itself"]
    end
    subgraph web["What asks a web server one thing"]
        nip05
        zap
        relay_info
        blossom
    end
    subgraph read["Events read: what a view shows"]
        models
        content
        markdown
        thread
        feed
        engagement
        search
    end
    subgraph write["Events made: unsigned, for the signer"]
        compose
        contacts
        bookmarks
        relay_lists
        kept_drafts
    end
    subgraph choose["What is decided"]
        outbox["outbox: which relays to ask"]
        sweep["sweep: what the store lets go of"]
        sightings["sightings: which relay sent what"]
    end
    client -->|"reads into"| read
    client -->|"signs and sends"| write
    client -->|"goes by"| choose
    client --> account
    client --> private
ModuleWhat it is
accountParsing an nsec, an npub or a bunker address, keeping what is secret in the keyring, signing, encrypting
blossomThe account’s media servers, and sending a file to them for a note to link to
bookmarksThe account’s bookmark list, and what it keeps to itself
clientThe relay pools and the LMDB event store behind them
composeWhat someone wrote, made into an event ready to be signed
contactsA contact list, changed by one person
contentA note’s text taken apart: links, mentions, hashtags, pictures, quotes
engagementWhat others made of a note: replies, reposts, likes and zaps
feedThe notes of a feed, newest first, and the ones that wait beside it
kept_draftsDrafts as events, as the relay Avestruz runs itself keeps them
markdownWhat a note marks as bold, slanted, struck out, code, a heading, quoted or a labelled link
modelsNotes and profiles, as the views need them
nip05Names at a domain, and whether the domain agrees
notificationsWhat others did that concerns the account: replies, mentions, reactions, reposts and zaps
outboxPeople’s relay lists, and which of the relays they name to ask
private_relayThe relay Avestruz runs itself, and the way to it
relay_infoWhat a relay says of itself
relay_listsThe relays an account says are its own, by what they are for
searchSearching for people and notes, and what is typed that is no search
shareA link to a note that anyone can open
sightingsWhich relays each note was seen on
sweepWhat the event store lets go of, and what it keeps however old
threadA conversation: a note, what it answers, and what answers it
zapAsking someone’s Lightning address for an invoice that zaps a note

Which NIP and which kind each of these speaks is in crate::guide::protocol, and what is decided about relays in crate::guide::relays.

Modules§

account
The signed-in account: reading what someone signs in with, keeping what is secret where it belongs, signing, and encrypting what the account keeps to itself.
blossom
Media servers (Blossom): the account’s list of them, and sending a file to them so that a note can link to it.
bookmarks
The account’s bookmarks (NIP-51, kind 10003): the notes it wants to find again.
client
The relay client and the local event store behind it.
compose
What someone wrote, made into an event ready to be signed: a note of its own, a reply to another, or a note that quotes another.
contacts
A contact list (kind 3): who an account follows.
content
What a note says, taken apart for showing: plain text, links, mentions of people, hashtags, the images and the videos it carries, the notes it quotes, and the web page it is shown a preview of.
engagement
What others made of a note: how many answered it, how many passed it on, how many reacted to it, and how much it was zapped; and what the account itself left on it: a repost, a reaction.
feed
A list of notes, newest first: the feed, and the notes on a profile.
kept_drafts
Drafts as events (NIP-37): what is written and not published, as the relay Avestruz runs itself keeps it.
markdown
Markdown, as far as notes are written in it: what a note marks as bold, slanted, struck out or code, its headings, what it quotes, its lists, its tables, and the links it names by something other than their address.
models
Notes and profiles, reduced to what the views show.
nip05
Names at a domain (NIP-05): ana@example.com.
notifications
What others did that concerns the account: answered it, named it, quoted it, reacted to a note of its own, passed one on, zapped it.
outbox
Where people’s events are: their relay lists (NIP-65), and which of the relays those name are worth asking.
private_relay
The relay Avestruz runs itself, for what is the account’s alone: what is written and not published, and whatever else is not for any other relay.
relay_info
What a relay says of itself (NIP-11): its name, a few words about it, which NIPs it supports, and whom it takes.
relay_lists
The relays an account says are its own, by what they are for, as the relays page shows and changes them.
search
Searching for people and notes (NIP-50): what is asked of the relays that search, and what is made of their answers.
share
A link to a note that can be given to anyone: a web address, which opens in a browser whether or not whoever gets it has a Nostr client.
sightings
Which relays a note was seen on: every relay that sent it, for as long as the applet has been running.
sweep
What the event store lets go of: the notes it has had for longer than they are likely to be looked at again.
thread
A conversation: a note, what it answers, and what answers it.
zap
Zapping a note (NIP-57): asking its author’s Lightning address for an invoice that, once paid, their wallet service announces as a zap.