How agl/pond works
1. What this repo is
Pond is a secure messaging system split into a desktop client, a message server, and a set of crypto/transport libraries. The codebase is organized so the application logic stays separate from the cryptographic primitives and wire protocols.
2. Client is the main application boundary
The client/ tree contains both the GUI and CLI entry points, plus the shared client runtime. It includes OS-specific startup files for Linux, macOS, and FreeBSD, so the same core client is packaged differently per platform. The client owns user interaction, message composition, synchronization, and local state management.
3. Local state is a first-class subsystem
Client state is persisted as structured files, with dedicated code under client/disk/, client/disk.go, and client/testdata/. The presence of editstate/ and decrypt/ shows that state files and encrypted artifacts are important operational boundaries, not just internal implementation details. client/tpm/ and client/disk/tpm_linux.go indicate optional hardware-backed protection on Linux.
4. Message security is centered on ratcheting
client/ratchet/ is the core message-security state machine. It is the part of the system that evolves keys over time so that each message can be protected with fresh material rather than a long-lived static key. In architecture diagrams, this sits between the UI/state layer and the transport layer.
5. Anonymous authorization uses group signatures
bbssig/ implements the BBS group signature scheme, and bn256cgo/ is the pairing-crypto backend used to speed it up. This is one of Pond’s defining boundaries: the server can reject unauthorized traffic without learning which specific contact sent it. That makes bbssig a security subsystem, not just a library.
6. Panda handles shared-key exchange
The panda/ package implements the shared-key exchange mechanism used by the client. It has its own protobufs and crypto implementation (rijndael/), plus an App Engine deployment under panda/appengine-server/. This looks like a separate rendezvous/meeting-point service used to establish shared secrets before normal messaging begins.
7. Transport is separate from the application protocol
transport/ implements the low-level client-to-server transport protocol. Higher-level message formats live in protos/ and server/protos/, while client/disk/client.proto defines on-disk client state. That separation means the repo distinguishes wire transport, application messages, and local persistence as different layers.
8. Server is a distinct relay/validation service
server/ contains the standalone Pond server, with its own main.go, server logic, and protobuf definitions. The server’s role is not to decrypt user traffic; it validates protocol-level constraints, uses the group-signature path for access control, and acts as the rendezvous/relay endpoint for clients. There is also an appengine-server variant, showing an alternate deployment target.
9. Platform abstraction lives inside the client
Files like client/system/sys_*.go, client/gtk.go, client/gui.go, client/nogtk.go, and client/gui-nogui.go show a layered client architecture: a platform/system adapter, UI implementations, and fallback builds for environments without GTK or a GUI. This makes the client portable without pushing platform details into crypto or protocol code.
10. Tooling and docs are supporting, not runtime, components
doc/, papers/, and slides/ document the system and its threat model rather than participating in execution. editstate/, decrypt/, and pathrewrite/ are operational utilities for debugging or manipulating data artifacts. These are useful to show as maintenance tools off to the side of the main client/server path.
11. End-to-end data flow
A typical flow is: user action in the client UI/CLI → client state and ratchet logic update local session/message state → crypto layers (panda, bbssig, bn256cgo) prepare keys and authorization material → transport sends the request to server/ → the server relays or stores data for the intended recipient. The client later pulls or receives the corresponding response and applies it back through the ratchet/state layer.
12. Main architectural boundaries to draw
The cleanest diagram boundary is: UI/OS-specific client shell, secure client core, crypto primitives, transport/protocol definitions, and server relay. The notable security boundary is that the server should be treated as untrusted for content and identities, but trusted to enforce protocol rules and mailbox-style delivery.
Main entry points: client.go Client app · disk.go Local state · server.go Server core · panda.go Panda
Components 19
Client
Desktop app shell, shared runtime, local state, and OS-specific startup.
- Client app · Main user-facing application entry and runtime orchestration.
client/client.go - UI shell · GUI and CLI presentation layers plus build-time UI fallbacks.
client/gui.go - Platform glue · OS-specific startup and system integration for Linux, macOS, and FreeBSD.
client/system - Local state · On-disk client state, disk formats, and encrypted artifacts.
client/disk.go - Ratchet · Message-security state evolution and per-message key progression.
client/ratchet/ratchet.go - TPM · Optional hardware-backed protection for client secrets on supported platforms.
client/tpm/tpm.go
Crypto
Cryptographic primitives and key-evolution logic.
- Panda · Rendezvous and shared-secret exchange subsystem used before normal messaging.
panda/panda.go - Panda proto · Panda protocol definitions and generated messages.
panda/proto/core.proto - Rijndael · Panda's cipher implementation and crypto backend.
panda/rijndael/rijndael.go - BBS signatures · Anonymous authorization and membership-based signing for server access control.
bbssig/bbssig.go - bn256 backend · Acceleration backend for the BBS signature scheme.
bn256cgo/bn256.go
Protocol
Wire formats and transport boundaries between client and server.
- Pond proto · Core application message and state schemas shared by client and server.
protos/pond.proto - Transport · Low-level client-to-server transport and framing.
transport/transport.go
Server
Standalone relay and validation service.
- Server app · Standalone server entry point and deployment-specific startup.
server/main.go - Server core · Protocol validation, mailbox-style relay behavior, and server-side coordination.
server/server.go - Server proto · Server-specific request and response message definitions.
server/protos/server.proto
Tools
Operational utilities and supporting documentation.
- Edit state · Utility for inspecting and rewriting client state artifacts.
editstate/editstate.go - Decrypt tool · Utility for decrypting or examining protected artifacts.
decrypt/decrypt.go - Path rewrite · Utility for rewriting paths in repository-maintained artifacts.
pathrewrite/pathrewrite.go
Connections 21
- UI shell → Client app: drives · User interaction enters the main client runtime.
- Platform glue → UI shell: boots · OS-specific startup selects UI/runtime behavior.
- Client app → Local state: persists · Client runtime reads and writes local structured state.
- Client app → Ratchet: updates · Messaging actions advance ratchet state and message keys.
- Local state → Ratchet: loads · Stored session material feeds the ratchet state machine.
- Client app → TPM: optionally uses · Hardware-backed protection may guard local secrets.
- Client app → Panda: establishes · Client uses Panda to negotiate shared secrets.
- Panda → Panda proto: defines · Panda exchanges use dedicated protobuf schemas.
- Panda → Rijndael: encrypts · Shared-key exchange relies on symmetric crypto primitives.
- Client app → BBS signatures: authenticates · Client prepares anonymous authorization material for server access.
- BBS signatures → bn256 backend: accelerates · Signature operations use the pairing backend.
- Client app → Pond proto: formats · Application-level messages are encoded with shared protobufs.
- Client app → Transport: sends · Client hands signed and encoded messages to transport.
- Transport → Server app: connects · Transport carries client traffic to the server endpoint.
- Server app → Server core: runs · Server entry point initializes relay and validation logic.
- Server core → Server proto: parses · Server logic consumes server-specific wire messages.
- Server core → BBS signatures: verifies · Server checks anonymous authorization using group signatures.
- Server core → Pond proto: handles · Server processes the same core application message schema.
- Edit state → Local state: edits · Tool operates on client persistence artifacts.
- Decrypt tool → Local state: inspects · Tool works with encrypted client artifacts.
- Path rewrite → Local state: rewrites · Utility adjusts stored paths in state-related artifacts.