From a109c2742de15703d10aa6c30b4af7bd7ebae19b Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 18 Aug 2026 00:16:10 -0700 Subject: A wallet keeps one name per domain, not one name total: staging and mainnet claims stop clobbering each other, the registrar answers who-am-I per domain, and a custom name claimed on one device replaces the npub placeholder on every other Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01JtaatFfAbx91Nh3xqKVqKz --- names/server.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'names/server.js') diff --git a/names/server.js b/names/server.js index df823f9..3021621 100644 --- a/names/server.js +++ b/names/server.js @@ -665,8 +665,11 @@ Bun.serve({ // 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') { + // optional domain filter, so a staging claim can't shadow a mainnet + // name (or vice versa) when a wallet asks who it is + const domFilter = (url.searchParams.get('domain') || '').toLowerCase(); const mine = Object.entries(state.names) - .filter(([, r]) => r.pubkey === pm[1]) + .filter(([k, r]) => r.pubkey === pm[1] && (!domFilter || k.endsWith('@' + domFilter))) .sort((a, b) => (b[1].updated || 0) - (a[1].updated || 0)); if (!mine.length) return json({}); const [key, r] = mine[0]; -- cgit v1.2.3