diff --git a/app.js b/app.js index 28a410e..1489a11 100644 --- a/app.js +++ b/app.js @@ -225,7 +225,20 @@ app.post('/complete-auth/:sessionId', async (req, res) => { throw new Error('Challenge mismatch'); } - const { data: pubkey } = nip19.decode(npub); + // Handle both npub format and raw hex pubkey + let pubkey; + try { + if (npub.startsWith('npub')) { + const decoded = nip19.decode(npub); + pubkey = decoded.data; + } else { + // Assume it's raw hex pubkey + pubkey = npub; + } + } catch (error) { + throw new Error('Invalid public key format'); + } + if (event.pubkey !== pubkey) { throw new Error('Public key mismatch'); } diff --git a/views/login.ejs b/views/login.ejs index 98c5d0e..caa8d80 100644 --- a/views/login.ejs +++ b/views/login.ejs @@ -3,204 +3,219 @@
-Authenticate using your Nostr identity
-