How dallen4/deadrop works
Project Type and Purpose
• The project is a full-stack, end-to-end encrypted secret sharing platform.
• Its core functionality is to allow users (“droppers” and “grabbers”) to securely exchange secrets (plain text, JSON, and files) using modern cryptographic methods (AES-GCM, ECDH, and SHA-256) over peer-to-peer WebRTC connections.
• The system provides both a web app (a Progressive Web App) and a CLI interface for interacting with the platform.
Main Components & Their Roles
• Web Client (PWA):
• Found under the “web” directory, this part handles the user interface.
• Contains React components (atoms, molecules, organisms) and pages to interact with the API endpoints.
• Uses Next.js (notice the pages directory and next.config.mjs) to render server-side content along with client-side functionality.
• CLI Client:
• Located in the “cli” directory, it provides a command-line interface for users to drop and grab secrets.
• Implements actions (e.g., drop, grab, login, logout) along with database utilities (migrations and schema) and shared encryption logic.
• Worker (Serverless Backend/API):
• The “worker” directory contains code for a backend service likely running on Cloudflare Workers (as indicated by wrangler.toml and usage of durable objects).
• It provides core API routers (auth, drop, peers, vault) and middleware, handling key security operations (such as relaying peer IDs, sessions, and storing nonces).
• Shared Library:
• The “shared” directory is used across modules (CLI, web, worker) to segregate and centralize common functionality like crypto utilities, configuration, data structures, and test suites.
• Infrastructure & CI/CD:
• GitHub workflows in “.github/workflows” automate deployment, testing, and publishing for various parts (web, CLI, etc.).
• Configuration files (.nvmrc, .prettierrc, tsconfig.json, vercel.json) indicate the project’s tooling and build setup.
• Redis Backend:
Relationships and Interactions
• Users interact with the system via either the Web Client (PWA) or the CLI.
• Both clients share core business logic and cryptography by using the “shared” module.
• For secret exchanges, the Web Client or CLI initiates a “drop” action that communicates (using HTTPS requests or API calls) with the Worker API.
• The Worker handles authentication and routing (using routers such as auth.ts, drop.ts, peers.ts, vault.ts) and integrates with Redis to manage session metadata.
• Internal modules (like durable objects in Cloudflare Workers from worker/src/lib/durable_objects) help manage stateful sessions and handle real-time data.
Architectural Patterns & Design Principles
• Separation of Concerns: Each entry point (web, CLI, worker) serves a focused purpose but leverages common code from the “shared” module.
• Modular Design: The clearly defined directories (API routes, actions, core libraries) help illustrate the modular nature of the system.
• Service-Oriented/Microservices: Even though all parts form a cohesive whole, the backend worker can be seen as a microservice handling API requests, while frontends are decoupled.
• Secure by Design: Emphasize the end-to-end encryption (using Web Crypto API) that separates prompting, key exchange, and payload transfer from any server-side logging.