aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-10-01 07:21:14 -0700
committerAdam Soltys <[email protected]>2025-10-01 07:21:14 -0700
commitdf471202a97f8469725c825868677251ed0c34f5 (patch)
tree0c6e981c708f6293420bc95782cccd4c858d49de
parent5061e32b32d26c55fe854f9c1635e827449b2871 (diff)
downloadcoinos-server-df471202a97f8469725c825868677251ed0c34f5.tar.gz
coinos-server-df471202a97f8469725c825868677251ed0c34f5.zip
login challenge
-rw-r--r--index.ts1
-rw-r--r--routes/users.ts11
2 files changed, 12 insertions, 0 deletions
diff --git a/index.ts b/index.ts
index 4efc0e55..f155fcab 100644
--- a/index.ts
+++ b/index.ts
@@ -144,6 +144,7 @@ app.post(
);
app.post("/flash", users.flash);
app.get("/challenge", users.challenge);
+app.post("/challenge/verify", users.challengeVerify);
app.post("/nostrAuth", users.nostrAuth);
app.get("/app/:pubkey", auth, users.app);
app.get("/apps", auth, users.apps);
diff --git a/routes/users.ts b/routes/users.ts
index e3810d70..bca6e009 100644
--- a/routes/users.ts
+++ b/routes/users.ts
@@ -373,6 +373,17 @@ export default {
res.send({ challenge: id });
},
+ async challengeVerify(req, res) {
+ try {
+ const { challenge: id } = req.body;
+ const verified = await db.exists(`challenge:${id}`);
+ if (!verified) fail("Challenge not found");
+ res.send(verified);
+ } catch (e) {
+ bail(res, e.message);
+ }
+ },
+
async nostrAuth(req, res) {
try {
const { event, challenge, twofa } = req.body;