aboutsummaryrefslogtreecommitdiffstats
path: root/names
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-18 00:16:10 -0700
committerAdam Soltys <[email protected]>2026-08-18 00:16:10 -0700
commita109c2742de15703d10aa6c30b4af7bd7ebae19b (patch)
tree51cbba5d6da94c6219164470a8656bac5a11d963 /names
parentdfb37ac34f5b5aa567fd818784042b3d317e03f5 (diff)
downloadcoinosv3-a109c2742de15703d10aa6c30b4af7bd7ebae19b.tar.gz
coinosv3-a109c2742de15703d10aa6c30b4af7bd7ebae19b.zip
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 <[email protected]> Claude-Session: https://claude.ai/code/session_01JtaatFfAbx91Nh3xqKVqKz
Diffstat (limited to 'names')
-rw-r--r--names/server.js5
1 files changed, 4 insertions, 1 deletions
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];