- Hono Worker: auth, key directory (X3DH prekey bundles), message relay, R2 media - Mailbox Durable Object: WebSocket delivery + offline ciphertext queue - PWA client: libsignal (vendored), IndexedDB key store, chat UI, media E2E - Server only ever holds public keys + ciphertext; private keys stay on device Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
25 lines
814 B
JavaScript
25 lines
814 B
JavaScript
// Cipher — end-to-end encrypted messenger on Cloudflare Workers.
|
|
// The Worker is a key directory + encrypted relay. It never sees plaintext.
|
|
|
|
import { Hono } from "hono";
|
|
import auth from "./routes/auth.js";
|
|
import keys from "./routes/keys.js";
|
|
import messages from "./routes/messages.js";
|
|
import media from "./routes/media.js";
|
|
|
|
export { Mailbox } from "./do/mailbox.js";
|
|
|
|
const app = new Hono();
|
|
|
|
app.get("/api/health", (c) => c.json({ ok: true, service: "cipher" }));
|
|
|
|
app.route("/api/auth", auth);
|
|
app.route("/api", keys);
|
|
app.route("/api", messages);
|
|
app.route("/api", media);
|
|
|
|
// Everything else falls through to static assets (the PWA), handled by the
|
|
// ASSETS binding via not_found_handling: single-page-application.
|
|
app.all("/api/*", (c) => c.json({ error: "not found" }, 404));
|
|
|
|
export default app;
|