Skip to content

Commit

Permalink
#2692 npub validation
Browse files Browse the repository at this point in the history
  • Loading branch information
K committed Aug 10, 2024
1 parent 2656ba8 commit 96d4255
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);

Check failure on line 74 in modules/core/server/routes/core.server.routes.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

modules/core/server/routes/core.server.routes.js#L74

[no-var] Unexpected var, use let or const instead.
var hex = result.data;
var obj = {
names: {
[name]: result.data,
},
};

Check failure on line 79 in modules/core/server/routes/core.server.routes.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

modules/core/server/routes/core.server.routes.js#L75-L79

[no-var] Unexpected var, use let or const instead.
} else {
// what should we return if there's no npub?
var hex = 'no npub';
var obj = {};

Check failure on line 81 in modules/core/server/routes/core.server.routes.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

modules/core/server/routes/core.server.routes.js#L81

[no-var] Unexpected var, use let or const instead.

Check failure on line 81 in modules/core/server/routes/core.server.routes.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

modules/core/server/routes/core.server.routes.js#L81

[no-redeclare] 'obj' is already defined.
}

res.json({
names: {
[name]: hex,
},
});
res.json(obj);
}
});
});
Expand Down

0 comments on commit 96d4255

Please sign in to comment.