diff options
| author | Adam Soltys <[email protected]> | 2025-09-06 16:46:30 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-09-06 16:46:48 -0700 |
| commit | f57530bde82864d02386c1bbefc950bfff8711d3 (patch) | |
| tree | af7152241cf6d0c22da629aa210a0a6192041006 | |
| parent | e663c5f78dec8c788f822eb0765f9f8ec3a44277 (diff) | |
| download | coinos-server-f57530bde82864d02386c1bbefc950bfff8711d3.tar.gz coinos-server-f57530bde82864d02386c1bbefc950bfff8711d3.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; |
