diff --git a/modules/core/server/routes/core.server.routes.js b/modules/core/server/routes/core.server.routes.js index 3847aa7394..73d707f75c 100644 --- a/modules/core/server/routes/core.server.routes.js +++ b/modules/core/server/routes/core.server.routes.js @@ -70,19 +70,17 @@ module.exports = function (app) { } else { const nostrNpub = user.nostrNpub; - if (nostrNpub) { + if (nostrNpub && nostrNpub.startsWith('npub1')) { var result = nip19.decode(nostrNpub); - var hex = result.data; + var obj = { + names: { + [name]: result.data, + }, + }; } else { - // what should we return if there's no npub? - var hex = 'no npub'; + var obj = {}; } - - res.json({ - names: { - [name]: hex, - }, - }); + res.json(obj); } }); });