How admirschwab/nexo works
Nexo is a terminal-based encrypted messenger. Its main workflow is register an identity, persist it encrypted, authenticate to a relay server, then use the terminal interface to discover online peers and exchange encrypted messages. Separate command paths support login, reconnect, password changes, server-address changes, and unregistering. The graph includes identity-file handling and the chat security layers. Some lifecycle calls and UI details are unsampled; those links are included only where the excerpts, source index, or README document them.
Main entry points: main.rs Command dispatcher · mod.rs Overlay event loop · connect.rs Authenticate connection · app.rs Chat application state
Components 24
Commands and identity
- Command dispatcher
src/main.rs - Create identity
src/functions/create_identity.rs - Register identity
src/functions/register_identity.rs - Unregister identity
src/functions/unregister_identity.rs - Nickname validation
src/functions/validate_nickname.rs
Server connection
- Authenticate connection
src/functions/connect.rs - Wire protocol
src/models/protocol.rs
Terminal interface
- Overlay event loop
src/overlay/mod.rs - Chat application state
src/overlay/app.rs - Terminal rendering
src/overlay/render.rs
Encrypted messaging
- Chat sessions
src/chat/session.rs - Crypto primitives
src/chat/crypto.rs - Peer messages
src/models/peer_message.rs
Identity data
- Identity paths
src/paths.rs - Server config
src/config.rs - Unlocked identity
src/models/identity.rs - Encrypted identity format
src/models/encrypted_identity.rs - File key derivation
src/functions/derive_file_key.rs - Encrypt identity
src/functions/encrypt_identity.rs - Decrypt identity
src/functions/decrypt_identity.rs - Load identity file
src/functions/load_identity.rs - Save identity file
src/functions/save_identity.rs
Other components
- User
- Nexo relay server
Connections 37
- User → Command dispatcher: runs commands
README.md - Command dispatcher → Identity paths: initializes paths
src/main.rs - Command dispatcher → Create identity: creates identity
src/main.rs - Command dispatcher → Register identity: registers identity
src/main.rs - Command dispatcher → Save identity file: saves identity
src/main.rs - Command dispatcher → Authenticate connection: logs in
src/main.rs - Command dispatcher → Unregister identity: unregisters identity
README.md - Command dispatcher → Encrypt identity: rewrites identity
src/main.rs - Command dispatcher → Decrypt identity: unlocks identity
src/main.rs - Command dispatcher → Nickname validation: validates nickname
README.md - Create identity → Unlocked identity: creates
src/functions/create_identity.rs - Create identity → Encrypt identity: encrypts
src/functions/create_identity.rs - Register identity → Wire protocol: sends registration
src/functions/register_identity.rs - Register identity → Nexo relay server: registers with
README.md - Unregister identity → Wire protocol: sends removal
src/functions/unregister_identity.rs - Unregister identity → Nexo relay server: removes identity
README.md - Authenticate connection → Server config: reads address
src/functions/connect.rs - Authenticate connection → Wire protocol: exchanges messages
src/functions/connect.rs - Authenticate connection → Nexo relay server: authenticates to
src/functions/connect.rs - Overlay event loop → Authenticate connection: reconnects through
src/overlay/mod.rs - Overlay event loop → Chat application state: dispatches events
src/overlay/mod.rs - Overlay event loop → Terminal rendering: renders via
src/overlay/mod.rs - Overlay event loop → Wire protocol: decodes server messages
src/overlay/mod.rs - Overlay event loop → Nexo relay server: exchanges websocket data
src/overlay/mod.rs - Chat application state → Chat sessions: manages sessions
src/overlay/app.rs - Chat application state → Wire protocol: handles server messages
src/overlay/app.rs - Chat application state → Peer messages: queues peer payloads
src/overlay/app.rs - Terminal rendering → Chat application state: renders state
src/overlay/render.rs - Chat sessions → Crypto primitives: uses primitives
src/chat/session.rs - Chat sessions → Peer messages: builds messages
src/chat/session.rs - Encrypt identity → File key derivation: derives key
src/functions/encrypt_identity.rs - Decrypt identity → File key derivation: derives key
src/functions/decrypt_identity.rs - Encrypt identity → Encrypted identity format: encodes format
src/functions/encrypt_identity.rs - Decrypt identity → Encrypted identity format: decodes format
src/functions/decrypt_identity.rs - Load identity file → Encrypted identity format: parses file
src/functions/load_identity.rs - Save identity file → Encrypted identity format: serializes file
src/functions/save_identity.rs - Decrypt identity → Unlocked identity: returns identity
src/functions/decrypt_identity.rs