From c41081838b87ffaa0ac95694a9c3167fa1ec3749 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 1 Aug 2026 21:36:27 -0700 Subject: Username onboarding + the payment address leads Receive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New wallets must pick a username before entering the wallet: the onboarding gate renders a claim screen until a name exists. Imported seeds skip it — the registrar's new /pubkey lookup recovers the name owned by the wallet's key, so nothing is retyped. If claiming errors (registrar or ark unreachable) a do-it-later escape appears rather than locking anyone away from funds; the prompt returns next open. The Receive tab now defaults to the payment address — name QR + copy — with the on-chain address and other modes behind it, and the claim form inline for wallets that skipped onboarding. Co-Authored-By: Claude Fable 5 --- names/server.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'names/server.js') diff --git a/names/server.js b/names/server.js index 383a9ce..a43191e 100644 --- a/names/server.js +++ b/names/server.js @@ -256,6 +256,19 @@ Bun.serve({ return json({ name: m[1], domain, taken: reserved, reserved }); } + // Which name(s) does a wallet key own? Lets an imported seed find its + // username again without the user retyping it. Public data (DNS is public). + const pm = url.pathname.match(/^\/pubkey\/([0-9a-f]{64})$/); + if (pm && req.method === 'GET') { + const mine = Object.entries(state.names) + .filter(([, r]) => r.pubkey === pm[1]) + .sort((a, b) => (b[1].updated || 0) - (a[1].updated || 0)); + if (!mine.length) return json({}); + const [key, r] = mine[0]; + const [name, domain] = key.split('@'); + return json({ name, domain, uri: r.uri }); + } + if (url.pathname === '/register' && req.method === 'POST') { if (!rateOk(ip)) return json({ error: 'rate limited' }, 429); const body = await req.json().catch(() => null); -- cgit v1.2.3