A peer-to-peer, end-to-end encrypted chat application with a desktop GUI,
written in Go, running entirely over Tor. There's no account, no
central server, and no IP address ever exchanged between peers — you're
reachable at a .onion address, and every connection to a contact is
built through a Tor circuit automatically.
- Transport: Tor onion services. Each instance brings up its own
ephemeral hidden service (
internal/torctl,internal/tornet) and dials contacts through Tor's SOCKS proxy — building a fresh circuit per-connection with no extra steps. - End-to-end encryption of chat payloads using NaCl
box(X25519 + XSalsa20-Poly1305), on top of Tor's own connection security. - Full desktop GUI built with Fyne (Linux, macOS, Windows).
- Usernames: pick your own, or generate a random
AdjectiveNoun####gamertag-style name (the same shape classic Xbox Live suggested names use), done locally — there's no registry to check it against.
Read docs/SECURITY.md before relying on this for anything sensitive. It's an educational / starting-point implementation, not an audited product.
- Go 1.22+
- A running Tor daemon with its control port enabled — see docs/TOR_SETUP.md (this is the main setup step; don't skip it)
- On Linux, Fyne's usual GUI build dependencies (a C compiler, plus
X11/Wayland + OpenGL headers) — see the
Fyne getting started guide if
go runfails with a graphics-related error
git clone <this-repo>
cd p2p-anon-chat
go mod tidy # fetches Fyne + golang.org/x/{crypto,net}
go run ./cmd/p2pchatOn first run this:
- Connects to your local Tor control port and authenticates.
- Asks Tor to stand up an ephemeral onion service and prints your
.onionaddress to the terminal — this is your address on the network, and it stays the same across restarts (the key is saved to~/.p2pchat/onion.key). - Opens the GUI, where you can see/copy your address, add a contact by pasting their onion address, and start chatting.
Building a Tor circuit to a new contact typically takes several seconds — that's normal, not a hang. The GUI shows a "Connecting..." indicator while this happens.
cmd/p2pchat/main.go wires everything together, owns the handshake logic
internal/identity/ persists the Tor onion-service key so your address is stable
internal/username/ random "AdjectiveNoun1234" name generator + validation
internal/crypto/ NaCl box end-to-end encryption for chat payloads
internal/torctl/ minimal hand-rolled Tor control-port protocol client
internal/tornet/ onion-service listener + SOCKS5 dialing, wire framing
internal/storage/ local JSON config: your username + known contacts
internal/gui/ Fyne desktop UI
See docs/ARCHITECTURE.md for the message flow and docs/SECURITY.md for the threat model and known gaps.
go build -o bin/p2pchat ./cmd/p2pchatThis is meant as a solid, readable starting point rather than a finished
product — issues and PRs that hunt down the gaps in docs/SECURITY.md are
especially welcome. Run go test ./... before sending a PR.
MIT — see LICENSE.