Add browser UI with in-browser signature verification

Every node now serves a search and listing-detail UI at GET /. It is
vanilla TypeScript, bundled unminified into web/dist (committed) and
embedded with go:embed, so `go build` is enough to run a node.

The browser verifies each listing itself (certificate, binding, validity,
signature, proof-of-work) with pure-JS ed25519, so a gateway can withhold
listings but not forge them. Unverifiable results are hidden and their
content is never shown. Listing text is only inserted via textContent and
the UI is served with a strict CSP.

Canonical JSON is reimplemented in TypeScript and tested against a golden
fixture signed by the Go code. /api/v1/status now reports difficulty.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 18:29:40 +01:00
co-authored by Claude Sonnet 5.5
parent 918e16ed37
commit 3fd40241bc
30 changed files with 6418 additions and 5 deletions
+26
View File
@@ -0,0 +1,26 @@
import { lang, t } from "./i18n.ts";
import type { Listing } from "./verify.ts";
export function money(cents: number): string {
return new Intl.NumberFormat(lang, { style: "currency", currency: "EUR" }).format(cents / 100);
}
/** rooms_x2 stores rooms * 2, so 2.5 rooms are 5. */
export function rooms(x2: number): string {
return t("card.rooms", { n: (x2 / 2).toLocaleString(lang, { maximumFractionDigits: 1 }) });
}
export function date(unix: number): string {
return new Date(unix * 1000).toLocaleDateString(lang, { dateStyle: "medium" });
}
export function price(l: Listing): string {
if (!l.price) return "";
const base = money(l.price.amount_cents);
return l.price.period === "month" ? `${base} ${t("card.perMonth")}` : base;
}
/** A key shortened for display: abcd1234…9f2e */
export function shortKey(hex: string): string {
return hex.length > 16 ? `${hex.slice(0, 8)}…${hex.slice(-4)}` : hex;
}