Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2692 npub validation #2697

Merged
merged 1 commit into from
Aug 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
} 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
Loading