diff options
| author | Adam Soltys <[email protected]> | 2026-08-15 19:46:32 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-08-15 19:46:32 -0700 |
| commit | c6cc2d3b429a58c87fa3f4ebf259564bbc210d82 (patch) | |
| tree | 965c4e50babb909a8a01fc877004788c41ee0e81 | |
| parent | 0fb0496109aee2ec0bb0c46f29f17392138978e8 (diff) | |
| download | coinosv3-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
| -rw-r--r-- | names/server.js | 11 |
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') { |
