whisper Svelte Themes

Whisper

Real-time secure communication channel for an investigative journalism network

Whisper – Real-Time Secure Communication Terminal

šŸ“‚ File Tree

ā”œā”€ā”€ backend
│   ā”œā”€ā”€ app
│   │   ā”œā”€ā”€ __init__.py
│   │   ā”œā”€ā”€ config.py
│   │   ā”œā”€ā”€ extensions.py
│   │   ā”œā”€ā”€ models.py
│   │   ā”œā”€ā”€ repository.py
│   │   ā”œā”€ā”€ routes.py
│   │   ā”œā”€ā”€ services.py
│   │   └── sockets.py
│   ā”œā”€ā”€ .dockerignore
│   ā”œā”€ā”€ Dockerfile
│   ā”œā”€ā”€ main.py
│   └── requirements.txt
ā”œā”€ā”€ frontend
│   ā”œā”€ā”€ src
│   │   ā”œā”€ā”€ components
│   │   │   ā”œā”€ā”€ KillSwitch.svelte
│   │   │   ā”œā”€ā”€ MessageComposer.svelte
│   │   │   ā”œā”€ā”€ MessageFeed.svelte
│   │   │   └── PassphraseModal.svelte
│   │   ā”œā”€ā”€ services
│   │   │   ā”œā”€ā”€ crypto.js
│   │   │   └── socket.js
│   │   ā”œā”€ā”€ state
│   │   │   └── store.js
│   │   ā”œā”€ā”€ App.svelte
│   │   └── main.js
│   ā”œā”€ā”€ .dockerignore
│   ā”œā”€ā”€ Dockerfile
│   ā”œā”€ā”€ index.html
│   ā”œā”€ā”€ package-lock.json
│   ā”œā”€ā”€ package.json
│   └── vite.config.js
ā”œā”€ā”€ .dockerignore
ā”œā”€ā”€ .gitignore
ā”œā”€ā”€ Makefile
ā”œā”€ā”€ README.md
└── docker-compose.yml

🧩 Project Overview

Whisper is a secure, real-time messaging system designed for investigative teams needing fully encrypted communication.

  • Messages are encrypted client-side; backend stores only ciphertext.
  • Supports real-time broadcasting over WebSockets.
  • Lightweight MVP designed to ship quickly under strict constraints.

⚔ Tech Stack & Choices

Layer Choice Reason / Notes
Backend Python, Flask, Flask-SocketIO Lightweight, fast prototyping
Web Server Gunicorn + Gevent Handles Socket.IO concurrency
Frontend Svelte + Vite Fast SPA, minimal boilerplate
Database SQLite Simple persistence, avoids complex setup
Security AES + SHA256 via crypto-js Lightweight client-side encryption
API REST Simpler than GraphQL for MVP
Styling/UI Minimal, no dark theme, basic HTML/CSS Focus on functionality over aesthetics

šŸ›” Kill Switch (Panic Mode)

  • Activated by pressing ESC key 3 times consecutively.

  • Actions on activation:

    1. Disconnects all Socket.IO connections immediately.
    2. Clears all local frontend state (messages, passphrase).
    3. Replaces UI with a generic 404 page or placeholder widget.
  • No database wipe occurs — backend ciphertext is preserved.

  • Implemented in frontend/src/components/KillSwitch.svelte + frontend/src/state/store.js.


šŸ— Architecture

Browser
   │
   ā–¼
Nginx (frontend container)
   │
   ā”œā”€ā”€ / → Svelte SPA
   │
   ā”œā”€ā”€ /api → Flask REST backend
   │
   └── /socket.io → Flask-SocketIO
  • Frontend connects to backend over internal Docker network.
  • Backend broadcasts encrypted messages to all clients via Socket.IO.
  • No server-side plaintext processing — fully blind relay.

šŸš€ Setup / Dev Instructions

Run everything in one command:

docker compose up -d --build

Endpoints:

  • Frontend: http://localhost
  • Backend Health: http://localhost/api/health
  • Socket.IO: ws://localhost/socket.io/

Stop everything:

docker compose down

Remove persistent SQLite volume:

docker compose down -v

šŸ” Security & Implementation Notes

  • Shared Secret: Client asks for "Team Passphrase" → derives AES key.

  • Message Encryption: All plaintext encrypted locally using AES + SHA256 passphrase via crypto-js.

  • Frontend Simplicity:

    • No message bubbles, typing indicators, or extra colors.
    • Focused purely on secure messaging and Kill Switch functionality.
  • Backend Logging: print() statements in sockets.py used instead of logging library.

  • SQLite over Postgres: Chosen for lightweight dev MVP, avoids multi-container DB setup.

  • REST API only: No GraphQL.


āš– Trade-Off Analysis

Decision Trade-Off / Reason
Symmetric AES Fast & simple, avoids key exchange complexity
SQLite Lightweight, single file DB; not suitable for heavy concurrency
REST API Simpler to implement and debug for MVP
Minimal UI Prioritize secure functionality & Kill Switch over aesthetics
No logging library Quick debug via print() during MVP dev
SHA256 + crypto-js Lightweight crypto suitable for client-side encryption
Kill Switch Focused on security UX; intentionally does not wipe backend DB

šŸ“¦ Docker Notes

  • Backend Image: whisper-api
  • Frontend Image: whisper-frontend
  • Multi-stage builds reduce image size.
  • Internal Docker network ensures frontend can reach backend via backend:5000.
  • Volumes: whisper_data stores encrypted SQLite messages.

šŸ“ Evaluation Criteria

  • Security Hygiene: No plaintext storage on server; encryption isolated.

  • Concurrency: Backend broadcasts messages without blocking; frontend appends efficiently.

  • Architectural Integrity: Kill Switch works without exposing data.

  • Code Quality: Clear separation:

    • Backend: Controller → Service → Repository
    • Frontend: View → State → Service

Top categories

Loading Svelte Themes