aboutsummaryrefslogtreecommitdiffstats
path: root/names/server.js
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
commitd63d85d19df95b75f418e0c9121d2fd298eba4dd (patch)
tree0644e11dd7e9d51e42e3e5fd10008d0019f0c1f3 /names/server.js
parentbd4a6619e6976b4bcb93aa20acfa84a31221a05e (diff)
downloadcoinosv3-server-d63d85d19df95b75f418e0c9121d2fd298eba4dd.tar.gz
coinosv3-server-d63d85d19df95b75f418e0c9121d2fd298eba4dd.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/server.js')
-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];