aboutsummaryrefslogtreecommitdiffstats
path: root/names/server.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-15 19:46:32 -0700
committerAdam Soltys <[email protected]>2026-08-15 19:46:32 -0700
commitc6cc2d3b429a58c87fa3f4ebf259564bbc210d82 (patch)
tree965c4e50babb909a8a01fc877004788c41ee0e81 /names/server.js
parent0fb0496109aee2ec0bb0c46f29f17392138978e8 (diff)
downloadcoinosv3-c6cc2d3b429a58c87fa3f4ebf259564bbc210d82.tar.gz
coinosv3-c6cc2d3b429a58c87fa3f4ebf259564bbc210d82.zip
Every name learns to vouch for its keeper: the registrar answers nostr.json, so [email protected] is a NIP-05 too
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014tE4U5nEjGTQy8PwYqamfv
Diffstat (limited to 'names/server.js')
-rw-r--r--names/server.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/names/server.js b/names/server.js
index a969bde..0682f9a 100644
--- a/names/server.js
+++ b/names/server.js
@@ -594,6 +594,17 @@ Bun.serve({
return json({ ok: true, offerId: o.offer_id, memo, bolt12: o.bolt12 });
}
+ // --- NIP-05 --------------------------------------------------------
+ // Every claimed name doubles as a nostr identifier: name@domain verifies
+ // against the owner's key. Public data, CORS comes with json().
+ if ((url.pathname === '/.well-known/nostr.json' || url.pathname === '/nostr.json') && req.method === 'GET') {
+ const name = (url.searchParams.get('name') || '').toLowerCase();
+ const domain = (url.searchParams.get('domain') || DOMAIN).toLowerCase();
+ if (!NAME_RE.test(name)) return json({ names: {} });
+ const rec = state.names[`${name}@${domain}`];
+ return json(rec ? { names: { [name]: rec.pubkey } } : { names: {} });
+ }
+
// Availability / lookup. Public data (it's DNS).
const m = url.pathname.match(/^\/name\/([a-z0-9._-]{1,30})$/);
if (m && req.method === 'GET') {