How the app is built
The major parts of Uplink, where each lives in the source, and what it talks to.
Uplink is one Flutter app for Android, iPhone, Mac, Windows, Linux and the browser, a small relay server, and a few helper programs. This page is a map of the source for someone about to read or change it: what each part is for, where it lives, and what it talks to. Paths are from the repository's root (github.com/InfamousVague/ghost-messaging).
Where things are
| Folder | What it holds |
|---|---|
lib/ | The app, in Dart, for every platform. lib/web is its start in a browser. |
web/ | The page the browser build is loaded by: index.html with its policy, the loader, and argon2id.js, the one piece of JavaScript it carries. |
android/ | The Android half, in Kotlin: SMS and MMS, notifications, encryption keys, the link to paired computers, the Google Messages bridge, bubbles, a friend's call ringing, the updater. |
ios/, macos/, windows/, linux/ | Each platform's runner, with the native pieces the app calls: call recording, captions, transcripts, voice messages, sounds, updates, deep links. Windows' are C++ files in windows/runner (call_recorder.cpp, speech.cpp, desk_sound.cpp, ducking.cpp). |
native/voicefx | The microphone's noise removal, gain and live voice effects, in C (RNNoise, DeepFilterNet where built in, and Signalsmith Stretch behind stretch.cpp), shared by every platform. |
native/p2p | The direct route's core, in Rust on iroh: a node that opens framed streams to another node by its id. It carries bytes and decides nothing; every rule is Dart. |
native/link-check | A Rust program that starts or dials a link helper and links two nodes through it, to prove one works. |
packages/glacier | Glacier, the UI kit the screens are drawn with. A copy; it is changed in its own repository. |
relay/ | The relay server: a Dart program with no dependencies beyond Dart's own library. relay/deploy holds what running one needs: a compose file for relay/Dockerfile, sample web server blocks, service files and relay.env.example. |
sidecar/ | Go programs the app runs beside itself, one for each network that needs one: Google Messages, Signal, WhatsApp, Matrix, Messenger, Instagram, Discord, X and Slack. (sidecar/linkedin is in the tree; the app doesn't offer LinkedIn.) |
discord/ | A Node program: the bot that shows a Discord server's voice channels and bridges one into a space. Not the helper for Discord's own chats, which is sidecar/discord. |
extension/ | The browser extension, in TypeScript: it reads the sign-in cookies of the networks signed in to in the browser and keeps them, sealed, for the account's devices. |
tool/ | Build, release and deploy scripts, asset generators, the browser build's own checks (tool/web), and tests that run against a live relay (tool/net). |
site/, docs-src/ | gogho.st and these docs. docs-src is the source; tool/build-docs.mjs writes site/docs. |
docs/ | Maintainers' notes, one per large feature: the network (network.md), direct links, relays that talk and the browser (OPEN_NETWORK.md), forward secrecy (FORWARD_SECRECY.md), running a relay (SELF_HOSTING.md), the desktop link, friends, groups, the Marketplace. |
examples/plugins | Example plugins in the ghost-plugin/1 format. |
test/, integration_test/ | The app's tests, and the pictures its screen tests are held to (test/shots). |
One app, several ways of running
Every screen asks for what it needs through one object, Sms.instance (lib/sms.dart): the conversations, a thread's messages, sending, the settings. Sms passes each call by name to whatever is set as Sms.calls, and which object that is decides how the app runs. The screens are the same in every case.
| Answered by | Where | Used when |
|---|---|---|
The platform channel ghost_messaging/sms | lib/sms.dart, android/…/MainActivity.kt | An Android phone. Kotlin reads and writes Android's own SMS and MMS database. |
OverlayCalls | lib/standalone/overlay.dart | Android, wrapped round the channel: conversations with @username friends are answered in Dart, the rest passed on. |
StandaloneCalls | lib/standalone/standalone.dart | An iPhone, a computer with no phone linked, or a browser: the app's own network and nothing from a phone. What it keeps is behind StandaloneStore (lib/standalone/store.dart): a folder and the Keychain (StandaloneFiles), or in a browser sealed records in IndexedDB (WebStandaloneStore, lib/web/store.dart). |
LinkCalls | lib/desktop/remote.dart | A computer paired with an Android phone: each call becomes a sealed request to the phone. |
DeskOwnCalls | lib/desktop/own_calls.dart | A paired computer the phone has handed its identity to: friends and circles run on the computer itself, texts still come from the phone. |
lib/main.dart chooses: a computer goes to desktopMain() (lib/desktop/main.dart), an iPhone starts on its own, and Android starts on the channel. A browser's build has its own entry, lib/web/main.dart, which goes to lib/web/app.dart. From there both paths load the person's choices (AppState, lib/app_state.dart), the plugins, the API, and then the network through startPeople (lib/people.dart), which starts the routes, friends, what checks the relay, groups, spaces and circles in that order.
Texts on Android
The app keeps no copy of your texts: they live in Android's SMS and MMS database, which is why changing texting apps loses nothing. The Kotlin side is in android/app/src/main/kotlin/com/infamousvague/ghostmessaging.
| File | What it does |
|---|---|
MainActivity.kt | Answers the channel's calls and sends events back (ghost_messaging/events): a conversation changed, something to open. |
Store.kt | Reads and writes Android's database: the list, threads, messages, contacts. |
Messaging.kt | Sending (Sender) and the receivers for texts arriving, MMS arriving, and sent and delivered reports. |
Pdu.kt | The MMS wire format, written and read by hand. |
Notifier.kt, NotifyHush.kt, MarkdownPlain.kt | Notifications, with Reply and Mark as read. None is shown for a text the list hides: the plugins' rules are written down for Kotlin by lib/plugins/notify_hush.dart, since the app may be closed when a text arrives. A preview's formatting markers are taken out. |
Bubbles.kt, BubbleActivity.kt | A conversation as a bubble at the side of the screen, in a Flutter engine of its own started at bubbleMain (lib/main.dart, lib/bubble.dart). |
IncomingCall.kt | A friend's call as a phone shows one: Answer and Decline, full screen while the phone is locked. |
E2e.kt, E2eCrypto.kt | Encrypted texts with one person, and the phone's key pair, held under the Android Keystore. |
GmBridge.kt, GmWeb.kt | Running beside Google Messages: reading its notifications, or its web connection through sidecar/gmessages. |
Desk.kt, DeskSession.kt, DeskCrypto.kt, DeskService.kt | The phone's half of the link to paired computers. |
Routes: how apps reach each other
Everything between two Uplink apps (a friend's message, a call's setup, a space's chat) goes through lib/net. Its idea is the route: one way of getting bytes to another install, behind an interface (Carrier, lib/net/carrier.dart) so a new one can be added without the app above knowing.
| Part | Where | What it does |
|---|---|---|
| Envelope and packet | lib/net/packet.dart | An envelope is a small JSON message with a kind (text, call, room, hello…). A packet is an envelope as a route carries it: a byte of version and flags, the sender's 16-byte name, then the envelope, sealed. The flags say whether it is sealed, a part, sealed for forward secrecy, or passed on unopened by another device of the account. Long ones cross a short route in parts. |
| The switchboard | lib/net/switchboard.dart | Chooses a route for each thing sent, falls back to the next, seals and opens, joins parts, drops second copies, and answers what asks for an answer. |
| The hub route | lib/net/hub_carrier.dart, hub_link.dart | A connection to the relay server's hub. Also where presence and rooms come from. Its protocol. What carries the connection is behind HubLink: dart:io's WebSocket on a phone or a computer (hub_link_io.dart), the browser's own in a page (hub_link_web.dart). |
| The direct route | lib/net/p2p, native/p2p | Packets straight between devices, with no server between. Below. |
| The SMS route | lib/net/sms_carrier.dart, android/…/NetSms.kt | Packets as data texts: 133 bytes each, six at most, costing a text each, and able to wake a closed app. |
| Keys and sealing | lib/net/crypto.dart, fast_gcm.dart, android/…/Net.kt | P-256 key agreement, HKDF-SHA256 and AES-256-GCM. Kotlin and Dart are held to the same bytes by tests on both sides. fast_gcm.dart has two halves that give the same bytes: one for 64-bit integers, one for a browser's. |
| Forward secrecy | lib/net/forward_secrecy.dart | Prekeys each device makes and deletes, and the sealing under a one-off key for each packet. Below. |
| Where people live | lib/net/home_record.dart, homes.dart, relay_ask.dart, relay_choice.dart | The signed record of which relay an account uses, looking a username up on another relay, and moving to a relay of one's own. Below. |
| Checking the relay | lib/net/ledger.dart, name_watch.dart | What the relay says, compared with what friends' devices say. Below. |
| The app's hold on it all | lib/net/net.dart | Net: starts the routes, knows who can be reached, and is what the rest of the app sends through. |
The routes are tried in the person's order (Settings › Routes, drawn by lib/ui/network.dart); where they have chosen none it is the hub, the direct route, the local network, then SMS (Switchboard.order). One is passed over when it is off, down, can't reach that person, can't hold the packet, or costs money and the message isn't one allowed to. Three routes are written: the hub, the direct route and SMS. The order names a local-network route (lan) that has no carrier yet.
Forward secrecy
A packet to a friend used to be sealed with the pair's key alone, which comes from the two accounts' long-term keys. Whoever later learned an account's words and had kept the packets could open them all. ForwardSecrecy (lib/net/forward_secrecy.dart) closes that:
- Each device makes a key pair of its own, a prekey, that is never in the account's backup. It makes a new one every day and deletes each one's private half after fifteen days.
- A device offers its newest prekey inside the sealed envelopes it sends (
Envelope.fs), so no server is needed and a relay that knows nothing of it carries it. - A packet to someone whose devices have offered prekeys is sealed under a key pair made for that packet alone and forgotten after. The pair's key still goes into the sealing, which is what says who sent it.
- To a build from before, or over a route that carries only small packets (a data text), the switchboard seals the old way. A device that can't open a forward-secret packet answers with its prekey (envelope kind
fsk) so the next try reaches it.
A circle's key is changed when someone is put out of it (lib/circles/circle_keys.dart). docs/FORWARD_SECRECY.md in the repository is the whole design.
The direct route
The direct route (P2pCarrier, id p2p, shown as Direct) carries the same sealed packets between devices themselves. The relay still comes first: it is the fast path and the one that keeps things for someone who is away. Direct is a way through when the relay can't carry something, and what the relay is checked over.
| Part | Where | What it does |
|---|---|---|
| The core | native/p2p (Rust, on iroh) | A node: a key made on the device, whose public half is its node id. It dials, gets through NATs, falls back to a link helper (iroh's relay server, which is not Uplink's relay), and turns away any node the app has not allowed. It publishes nothing and looks nobody up. |
| The contract | lib/net/p2p/node.dart | P2pNode: what the Dart above relies on. The real one is IrohNode over dart:ffi (node_ffi.dart, node_ffi_io.dart), made by makeP2pNode() (node_factory.dart); tests use a stand-in mesh (test/support/fake_p2p.dart); a browser has none. On Android P2pCore.kt loads the library when the first node starts, and not before. |
| Device cards | lib/net/p2p/card.dart | DeviceCard: an account's signed word that a node id is one of its devices. Anyone can check one with nothing but the card. |
| Who links, and when | lib/net/p2p/p2p.dart | P2p: links only with the account's own devices and with friends. Cards and whereabouts are told in sealed envelopes of kind p2p (card, card?, meet). P2pPolicy says when a node runs: a computer's stays up, a phone's is started for something to say and stopped two minutes after its last stream closes. |
| The carrying | lib/net/p2p/p2p_carrier.dart | Sends a packet to every device a card is held for, on a stream that is open or dialled by where the device last said it was. Each end of a stream proves whose device it is before anything is taken. It never keeps anything. |
Link helpers are named by the relay as an app signs in to its hub (HubCarrier.helpers, from the relay's GHOST_LINK_HELPERS). With none, devices link only where they can reach each other's addresses as they are.
Checking the relay
The relay is trusted with little, and two parts check what is left.
- The name watch (
NameWatch,lib/net/name_watch.dart). A friend added by username was found by asking the relay who holds the name. The app asks the same again about once a day for each such friend, and of its own name as it signs in. An answer that is a different key is shown on that friend, and the friend is told. An add-me link (lib/friends/add_link.dart) carries the start of the key after#, andBuddies.addrefuses an answer that doesn't match. The lookups share one budget (lib/me/lookup_budget.dart). - The ledger (
Ledger,lib/net/ledger.dart). The switchboard tells it what was sent to each friend, by which route and what the route said, and what came (SendLog). It keeps names and times for seven days, never a message's words, in a folder no backup takes (lib/net/kept_files.dart). When a direct stream to a friend's device opens, the two compare (envelope kindldg): what never arrived is sent again straight, and what the relay said of it is put down. It compares only over direct links, so it runs where the direct route does.
Settings › Routes shows what both found (relayCheckSection, lib/ui/network.dart).
Friends on another relay
An app talks to one relay. Anyone can run their own, and relays can pass sealed packets to each other, so two friends need not share one.
- A home record (
HomeRecord,lib/net/home_record.dart; the relay's twin isrelay/lib/home_record.dart) is an account's signed statement of the relay addresses it lives at, with a count that only goes up. Both sides are held totest/home_record_vectors.json. Homes(lib/net/homes.dart) makes this account's record, gives it to the relay as the app signs in, and keeps friends' records. Friends tell each other theirs in a sealed envelope of kindhome(lib/friends/buddies.dart).@maya@relay.examplenames someone on another relay.Homes.whoisasks the app's own relay, which asks the other over a link. Where its own relay doesn't link with others, the app asks the other relay itself, under a key made for that one question (whoisAt,lib/net/relay_ask.dart).lib/net/relay_choice.dartis moving to another relay: what a typed address becomes, and whether an Uplink relay answers there before the app moves.
Every packet still goes through the app's own relay. The passing on is the relay's work. Usernames, account backups, circles, spaces and calls stay on the relay they were made on.
Who someone is
- An install is a P-256 key pair. Its name everywhere on the network is the first 16 bytes of the SHA-256 of its public key, in hex. The relay knows installs by that name and nothing else. Every device of one account holds the same key, so each also has a device name of its own (
hub_device, made inNet.start), which the hub, forward secrecy and circles' keys tell devices apart by. - An account (
lib/account) is twelve recovery words. From them come an address that names the account, and the keys that seal its backup, which is kept on the relay sealed twice: once under the password, once under the words. How your account works is the plain account of it. In a browser the password is stretched byweb/argon2id.json a worker (lib/account/argon2_browser.dart). - A profile (
lib/me/me.dart): the username, linked handles and verified number, kept by the relay's directory as hashes. What dresses a profile (a border, a banner, a name effect) islib/me/cosmetics.dart. - Friends: by number (
lib/friends/friends.dart, for people encryption is on with) and by username (lib/friends/buddies.dart). Groups of friends arelib/friends/groups.dart: each message goes to each member by the routes. - Where an account lives is its home record, and which nodes are its devices its device cards. Both are signed by the account's key.
Circles, spaces and calls
A space (in the code, a hangout or voice channel) is 32 random bytes, its seed. The room's name on the hub, the token that lets someone in and the key everything in it is sealed with are all made from the seed (VoiceChannel, lib/voice/voice.dart), so whoever holds a space's link holds all three and the relay holds none.
lib/voice/channels.dart(Voice): the spaces someone is in, and making, sharing, joining and leaving them.lib/voice/hangout.dart(HangoutRoom): a space's chat. History is passed between members; the hub only holds packets for whoever is away.lib/voice/rtc.dart: the call itself, WebRTC from each member to each other. Offers, answers and candidates are sealed with the space's key and said in its room; sound and picture never go through the relay's hub.- A way through when two devices can't reach each other. A connection looks for a path with public STUN servers, and with a TURN server where the relay has one: the hub hands whoever joins a room a short-lived username and password for it (
relay/lib/turn.dart,HubCarrier.callRelay,RtcMedia.iceServers). Where one was handed out, a connection starts through it alone and falls back to trying every path (FallbackMedia,lib/voice/voice.dart). The TURN server passes WebRTC's own encrypted packets and can't hear the call. lib/voice/open_space.dart: an open space, a call with a floor on top. Places and groups are said in the call's room, sealed like its offers, and how far apart two people stand becomes a gain on each one's sound (PlacedMedia); the floor is drawn bylib/ui/open_space_view.dart. Followed step by step in How the parts work together.lib/voice/friend_calls.dart(FriendCalls): ringing one friend, with no space made. The call's seed is made from the two friends' names, so only they can work it out; ringing, declining and cancelling are sealedvoiceenvelopes sent by the routes. On Android the ringing isIncomingCall.kt.- In a call: the auto leveler (
lib/voice/leveler.dart), the soundboard (lib/voice/soundboard.dart: only a sound's id is said in the room, each device plays its own copy), the live voice changer (lib/voice/live_changer.dart, an effect innative/voicefx), and on a computer screen sharing (lib/ui/screen_share.dart). Each of the first three is switched by a plugin of the same name inlib/plugins. - Spotify in a circle's call (
lib/voice/spotify.dart): the queue is held by the DJ's device (spotify_queue.dart,spotify_deck.dart) and said in the call's room asmu; the music goes to each listener over a connection of its own (spotify_link.dart). On a Mac (macos/Runner/Spotify.swift,SpotifySound.swift,MusicLink.swift) it is AppleScript, a Core Audio tap on Spotify's processes, and a second WebRTC factory whose sound device is that sound; on Windows (windows/runner/spotify.cpp,spotify_sound.cpp) it is Windows' media controls, WASAPI's loopback of Spotify's process tree, and a track of flutter_webrtc's own.tool/spotify/check.shlistens to the Mac's link without a sound. - Recordings:
lib/voice/recorder.dartwrites one MP4 with a track for each person,recording_playback.dartopens one again in the mixer, and on Windowsmp4_merge.dartjoins the one-track fileswindows/runner/call_recorder.cppmakes. lib/voice/roles.dart: a space's roles, as a numbered list signed by its owner.lib/circles: a circle is one seed and a signed manifest listing its spaces, roles and settings (CircleManifest,lib/circles/circle.dart). Members pass the newest manifest to each other. When someone is put out of a circle its key is changed, so the seed they keep opens nothing said after (CircleKeys,lib/circles/circle_keys.dart).lib/files: a Files space. Files are sealed on the device in 256 KiB pieces (lib/net/file_seal.dart) and kept by the relay, which sees sizes and never names or contents. My files (lib/files/drive.dart) is one more Files space to the relay: its seed is made from the key the account's devices share (Me.mineKey), and every device writes to it with one key pair made from that seed, so each is the drive's owner and none has to be told of it.
Other networks
lib/inbox puts other services' chats in the same list. Each is an InboxNetwork (lib/inbox/inbox.dart) with its own way of connecting:
| Network | How |
|---|---|
| Telegram | TDLib, loaded into the app through dart:ffi (lib/inbox/td_json.dart, td_json_io.dart). |
| Signal, WhatsApp, Matrix | A helper program each (sidecar/), started by the app and spoken to in lines of JSON over its input and output. Each helper's PROTOCOL.md says what is said. Their chats are written to disk off the drawing thread by KeptWriter (lib/inbox/kept_writer.dart). |
| Messenger, Instagram, Discord, X, Slack | An account helper each (sidecar/messenger, instagram, discord, twitter, slack), all speaking one protocol (sidecar/ACCOUNT_HELPERS.md), so one class drives them all: AccountHelper (lib/inbox/account_helper.dart), told apart by a HelperService. None of these services allows other apps. A helper signs in as the person, with the cookies of a browser signed in to their account, and the app says so first. |
| Google Chat, Microsoft Teams | Their own web APIs, straight from the app. |
| Bluesky, Mastodon | Written (bluesky.dart, mastodon.dart), listed as coming soon and never started. |
The cookies an account helper signs in with come one of two ways. Pasted: a request copied from the browser's developer tools, read by lib/inbox/cookie_paste.dart. Or synced: the browser extension (extension/) reads them, seals them with a key only the account's devices have, and keeps them on the relay; each device reads them back and signs in (CurlSync, lib/inbox/curl_sync.dart).
lib/inbox/human_check.dart holds a first message from someone new on a chosen network until its sender answers a small question. Several networks are also cards in the Marketplace, sharing one switch with Settings (lib/plugins/networks.dart).
No chat from these networks goes through Uplink's relay. The sealed cookies are the one thing of theirs it keeps, and it can't read them. A browser has no helper programs, so the web client has none of these networks.
Paired computers
A computer paired with a phone shows the phone's texts by asking the phone for them. The computer's half is lib/desktop/link (PhoneLink, LinkSession); the phone's is DeskSession.kt. They connect over the local network where they can and through the relay's pairing channel where they can't, and either way every frame is sealed with keys made from the pairing, so the relay passes bytes it can't read. What the computer has read is kept sealed on its disk (lib/desktop/cache.dart).
Plugins and the Marketplace
A plugin adds to the conversations list and to texts through a few fixed points (lib/plugins/plugin.dart): tagging a message, a section or tab in the list, a button, a rule for what arrives. The built-in ones are Dart classes (lib/plugins/registry.dart). One from another developer is data, never code: a JSON file (lib/plugins/pack) the app reads into those same points, held to what it declared by GatedHost.
Which plugins are on is synced between an account's devices (PluginSync, lib/plugins/plugin_sync.dart): a list in the same sealed slot on the relay as the extension's cookies. A circle can hold some plugins for all its members: the soundboard and the auto leveler are on in a circle's spaces when the circle has them on.
The Marketplace (lib/market, and relay/lib/market.dart on the server) lists reviewed plugins. An approval is a reviewer's signature over the plugin's id, version and its file's SHA-256, checked against keys the app ships with, at install and at every start: the server can withhold a plugin but can't make one look reviewed.
The relay server
relay/bin/relay.dart reads its options and environment, makes each part over one data folder, and starts one HTTP server; relay/lib/relay.dart sends each request to its part.
| Part | File | What it does |
|---|---|---|
| Pairing channels | relay.dart | Passes sealed frames between a phone and its computer while both are connected. Keeps no frame. |
| The hub | hub.dart | Where installs find each other: signing in with a key, packets passed or held for whoever is away, presence, rooms. A sign-in can be bound to the host the app dialled (v2, where the relay is told its names with GHOST_HUB_NAMES), so it is no use at another relay. A connection is a HubSocket, which need not be a WebSocket. |
| The doors | ws_door.dart | Every WebSocket's upgrade and dial, with a ceiling on a message's length checked from the frames' headers, before a byte of it is held. WireBudget bounds what all connections hold together. |
| Other relays | federation.dart, fed_dial.dart, home_record.dart | Links to other relays, off unless GHOST_FED is open or list. Each relay has a key and proves it; a packet for someone whose home record names another relay is passed there, and what another relay passes on is taken only for people whose record names that relay. fed_dial.dart holds every address dialled to public hosts, checked before the dial and dialled as checked. |
| The directory | handles.dart, accounts.dart, texts.dart, invites.dart, invite_words.dart | Usernames, linked handles, number verification by a texting service, sealed account backups and each account's list of devices, the extension's sealed cookies, invitations and circles' invite words. Reached through the hub's connection. |
| Files | files.dart, files_roster.dart | Files spaces' sealed pieces and their log. |
| Marketplace | market.dart, market_pack.dart, market_store.dart | Plugins' submissions, review and listing, and reports of a person or a message (POST /market/abuse; the app's half is lib/safety/abuse_report.dart). |
| Calls' fallback | turn.dart | Makes the short-lived TURN username and password the hub hands out with a room, from a secret shared with a TURN server (coturn) its keeper runs. Without the secret, calls are direct only. |
| The app in a browser | web_app.dart | Serves the folder tool/build-web.mjs built as plain files under /app/, with the page's security headers, where the relay is started with --web. Below. |
| Pushes, feedback, bounties | pushes.dart, feedback.dart, bounty.dart | A "New message" push to an iPhone something is held for; feedback sent from the app; souls granted for a tester's fixed bug by a signed POST /bounty. Souls one person sends another by a signed POST /souls/send are souls_send.dart; the counts and receipts are in handles.dart. None does anything without its variables. |
| Keeping | kept_log.dart | A keyed store on disk as a log of changes, appended as they happen and written whole again now and then in an isolate. |
| Arithmetic | p256.dart, secp256k1.dart, sha256.dart, sha1.dart, keccak.dart | Signature checking and hashes, written out so the relay depends on nothing. |
What it can see is the same throughout: which installs talk, when, and how much. Linked to other relays, it also sees which of its people talk to people on which relay. Its HTTP routes and its WebSocket protocols are documented in full, and docs/SELF_HOSTING.md in the repository says how to run one and what a relay of your own reaches.
The app in a browser
The web client is the same Dart, built by dart2js from its own entry (lib/web/main.dart), running as one more device of an account. It is the standalone way of running: lib/web/app.dart sets StandaloneCalls over the browser's store and calls startPeople, as a computer with no phone linked does.
| Part | Where | What it does |
|---|---|---|
| The start | lib/web/app.dart | Opens the store, works out the hub's address (the one the build names, or /hub beside a page served at /app/), and starts only what a page can run. |
| The store | lib/web/store.dart | WebStandaloneStore: every record in IndexedDB sealed with AES-256-GCM under a key the browser made as not extractable. The recovery words and the password's key are not kept at all. |
| The browser | lib/web/browser.dart, browser_web.dart | What the app asks of the browser: somewhere to keep things, being the only tab of itself, opening a link, starting again. browser_web.dart is the one file that speaks to JavaScript. |
| HTTP, emoji, About | lib/web/http.dart, emoji.dart, settings.dart | The page's own fetch for a report and feedback; an emoji font fetched when first wanted; Settings › About, which says what the browser keeps and what isn't there. |
| The page | web/, tool/web/headers.json | index.html with its content policy, the loader (flutter_bootstrap.js: no service worker, fallback fonts from beside the page), the Argon2id worker, and the headers every server of it must send. |
Code that can't compile or run in a browser is split, and the whole of lib/ goes through the split:
lib/platform_info.dartanswers "is this Android?" in place ofdart:io'sPlatform, which throws in a browser.lib/aside.dart(runAside) isIsolate.runwhere there are isolates, and the same work in place where there are none.- Files that need
dart:ffiordart:iohave two halves chosen by a conditional import:td_json,lib/files/apple_sha,lib/account/gzip,lib/net/hub_link,fast_gcm,kept_files,lib/net/p2p/node_ffi.
Guard tests read the source to hold it to this (test/platform_info_test.dart, test/aside_test.dart, test/source_guards_test.dart), and the Android and Mac releases run them before they build.
Not in a browser, as its own About says (notInBrowserYet, lib/web/settings.dart): calls, voice messages and sounds, Files spaces, plugins and the Marketplace, chats on other networks, and texts through a phone. It has no direct route either, so it keeps no ledger.
Screens
lib/ui/shell.dart(AppShell) is the frame: the list and what is open beside it, side by side where the window is wide.lib/ui/conversations.dartis the list,lib/ui/thread.darta conversation,lib/ui/hangout_screen.darta space,lib/ui/voice_screen.darta call.lib/ui/settings.dartandsettings_panes.dartare Settings, built from the rows inlib/kit.lib/ui/network.dartis Settings › Routes: each route, the relay in use, Direct, and what checking the relay found.lib/desktop/uiis what only a computer has: the set-up wizard, the title bar, the update bar. A computer's own voice messages arelib/desktop/desk_voice.dartanddesk_player.dart.lib/artholds the icons,lib/looks.dartthe looks,lib/custom_theme.darta look of the person's own, andlib/effects.dart,stickers.dartandreactions.dartwhat texts can wear.- What a message's words can do: formatting markers drawn as bold, code, quotes and spoilers (
lib/message_format.dart), and emoji by shortcode as they are typed (lib/emoji_shortcodes.dart). - What a conversation can do: be snoozed until a time (
lib/snooze.dart), be exported as a Markdown file (lib/export_chat.dart), and have a person or a message in it reported (lib/safety/abuse_report.dart,lib/ui/report_sheet.dart).
The app's own API
lib/api is a registry of methods (conversations.list, messages.send…), each with its parameters, what it answers and an example. The same methods are called from Settings' own test area, over HTTP on the device, and from anywhere through the relay, sealed. See API overview and Postman.
Developer docs