nostr challenge creation works

This commit is contained in:
counterweight 2025-02-11 18:15:06 +01:00
parent 7e4adf052c
commit 9ed583ecdb
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
5 changed files with 103 additions and 14 deletions

View file

@ -0,0 +1,15 @@
const uuid = require("uuid");
const crypto = require("crypto");
const NostrChallengeCreated = require('../models/NostrChallengeCreated');
async function createNostrChallenge() {
const nostrChallenge = await NostrChallengeCreated.create({
'uuid': uuid.v7(),
challenge: crypto.randomBytes(32).toString("hex"),
created_at: new Date().toISOString()
});
return nostrChallenge;
}
exports.createNostrChallenge = createNostrChallenge;