aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-09-06 16:46:30 -0700
committerAdam Soltys <[email protected]>2025-09-06 16:46:30 -0700
commit780a7cca58f3e34140fd9430e2ae02145e4149e0 (patch)
treea68bfecbfa78934f545d97fcbb581b29cc01b1f0
parentfdfbb781f40775f39dbaa10269f559695f670b37 (diff)
downloadcoinos-server-780a7cca58f3e34140fd9430e2ae02145e4149e0.tar.gz
coinos-server-780a7cca58f3e34140fd9430e2ae02145e4149e0.zip
convert pubkey from npub
-rw-r--r--routes/users.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/routes/users.ts b/routes/users.ts
index 750494b6..82bff805 100644
--- a/routes/users.ts
+++ b/routes/users.ts
@@ -207,6 +207,7 @@ export default {
let { pubkey } = body;
if (pubkey) {
pubkey = pubkey.trim();
+ if (pubkey.startsWith("npub")) pubkey = nip19.decode(pubkey).data;
exists = await getUser(pubkey);
const existingUsername = exists?.username
?.toLowerCase()
@@ -226,7 +227,6 @@ export default {
fail("Invalid signature or challenge mismatch.");
pubkey = pubkey.replace(/\s*/g, "");
- if (pubkey.startsWith("npub")) pubkey = nip19.decode(pubkey).data;
if (pubkey.length !== 64) fail(`Invalid pubkey ${pubkey}`);
await db.del(`user:${user.pubkey}`);
user.pubkey = pubkey;