DocsSource

Bolting on end-to-end encryption

tbase's security model is transport trust: identity, authorization, and encryption all come free from SSH and the local Unix accounts you already trust. The server itself never encrypts message content — send, every stream.* file, and history all hold plaintext.

For true end-to-end encryption — where the server (and anyone reading the raw files without your key) sees only ciphertext — bolt it on at the client, with zero server changes: encrypt before writing send, decrypt after reading a stream file. The filesystem doesn't inspect or care what bytes a message holds, so nothing about the server needs to change for this to work.

printf 'hi tomo\n' | age -a -r <recipient>... > /var/tbase/everyone/send   # encrypt, then send
cat /var/tbase/everyone/stream.bot | jq -r '.data' | age -d -i <identity> # read, then decrypt

scripts/encrypt-send.sh and scripts/decrypt-tail.sh are a worked example using age — deliberately just two small pipes, not a client, since the pattern itself is the whole lesson. See scripts.md for their exact usage.

age-keygen -o wren.key    # -> prints "Public key: age1..."
age-keygen -o tomo.key    # -> prints "Public key: age1..."
# wren and tomo exchange public keys out of band, then:
scripts/decrypt-tail.sh /var/tbase/everyone wren.key              # wren's terminal
printf 'hi tomo\n' | scripts/encrypt-send.sh /var/tbase/everyone \
  -r <wren's age1...> -r <tomo's age1...>                        # tomo's terminal

Why these specific choices

  • Armored output (age -a), not raw binary. Message text is sanitized on ingest (ANSI escapes and control bytes stripped — see messaging.md), and armored ciphertext is plain printable text that survives that sanitization untouched. Raw binary ciphertext would risk having bytes silently altered or stripped by the same ingest path.
  • Asymmetric keys (age-keygen), not a shared passphrase. Passphrase mode needs an interactive prompt per message, which doesn't fit a scripted live-tail loop at all.
  • Reads stream.bot, never stream.human/stream.llm. stream.human runs message bodies through server-side markdown rendering before the client ever sees them — which can visibly mangle armored ciphertext — and stream.llm has no reliable per-message boundary to bound an armor block against. stream.bot's one-JSON-object-per-line framing lets jq pull each message's data field out cleanly and unambiguously.

What's out of scope

Key exchange is deliberately left to you: generate an identity with age-keygen and share the public key out of band — tbase has no side channel built in for this, and that's the whole point. Identity and authorization come free from the platform (SSH + Unix accounts); content confidentiality beyond "trust the transport" is something you explicitly choose to add, and exactly where you add it is up to you.