diff options
| author | Adam Soltys <[email protected]> | 2025-09-06 16:46:30 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-09-06 16:46:30 -0700 |
| commit | 780a7cca58f3e34140fd9430e2ae02145e4149e0 (patch) | |
| tree | a68bfecbfa78934f545d97fcbb581b29cc01b1f0 | |
| parent | fdfbb781f40775f39dbaa10269f559695f670b37 (diff) | |
| download | coinos-server-780a7cca58f3e34140fd9430e2ae02145e4149e0.tar.gz coinos-server-780a7cca58f3e34140fd9430e2ae02145e4149e0.zip | |
convert pubkey from npub
| -rw-r--r-- | routes/users.ts | 2 |
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; |
