diff options
| author | Adam Soltys <[email protected]> | 2025-02-11 13:40:05 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-02-11 13:40:05 -0800 |
| commit | de7435e34580e1a9b4b8d95b2a5013112414098f (patch) | |
| tree | 97074cadf3a63512c2c5f554a3083924fd046b74 /routes/users.ts | |
| parent | 8add46c0975686ce0967c2c38514a31aad6ee8cb (diff) | |
| download | coinos-server-de7435e34580e1a9b4b8d95b2a5013112414098f.tar.gz coinos-server-de7435e34580e1a9b4b8d95b2a5013112414098f.zip | |
default app on register
Diffstat (limited to 'routes/users.ts')
| -rw-r--r-- | routes/users.ts | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/routes/users.ts b/routes/users.ts index c0d99b7d..9f5905bf 100644 --- a/routes/users.ts +++ b/routes/users.ts @@ -179,16 +179,12 @@ export default { else fail("Key in use by another account"); } - const { challenge } = body; const event = JSON.parse(body.event); + const challenge = event.tags.find((t) => t[0] === "challenge")[1]; const c = await g(`challenge:${challenge}`); - if (!c) fail("Invalid or expired login challenge"); + if (!c) fail("Invalid or expired challenge"); - if ( - !verifyEvent(event) || - event.content !== challenge || - event.pubkey !== pubkey - ) + if (!verifyEvent(event) || event.pubkey !== pubkey) fail("Invalid signature or challenge mismatch."); pubkey = pubkey.replace(/\s*/g, ""); @@ -332,7 +328,7 @@ export default { res.send({ challenge: id }); }, - async nostrLogin(req, res) { + async nostrAuth(req, res) { try { const { event, challenge, twofa } = req.body; const ip = req.headers["cf-connecting-ip"]; |
