nostr challenge creation works
This commit is contained in:
parent
7e4adf052c
commit
9ed583ecdb
5 changed files with 103 additions and 14 deletions
15
src/services/nostrService.js
Normal file
15
src/services/nostrService.js
Normal 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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue