Skip to content

Commit

Permalink
Merge pull request #2697 from Trustroots/add-nostr-package
Browse files Browse the repository at this point in the history
#2692 npub validation
  • Loading branch information
guaka authored Aug 10, 2024
2 parents 6c90a77 + 96d4255 commit 8089e10
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions modules/core/server/routes/core.server.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
});
Expand Down

0 comments on commit 8089e10

Please sign in to comment.