nostr challenge step much more robust
This commit is contained in:
parent
805ad5fad9
commit
564dcb8083
7 changed files with 99 additions and 50 deletions
|
|
@ -49,7 +49,7 @@ async function createSignUpChallenge(appInviteUuid) {
|
|||
}
|
||||
|
||||
if (await isAppInviteSpent(appInviteUuid)) {
|
||||
throw new errors.AppInvitedUsedError("Invite has already been used.")
|
||||
throw new errors.AlreadyUsedError("Invite has already been used.")
|
||||
}
|
||||
|
||||
const nostrChallenge = await nostrService.createNostrChallenge()
|
||||
|
|
@ -84,7 +84,7 @@ async function verifySignUpChallenge(signedEvent) {
|
|||
console.log(`Found this signup challenge: ${signUpChallenge}`);
|
||||
|
||||
if (await nostrService.hasNostrChallengeBeenCompleted(challenge)) {
|
||||
throw new errors.ChallengedUsedError("This challenge has already been used.");
|
||||
throw new errors.AlreadyUsedError("This challenge has already been used.");
|
||||
}
|
||||
console.log(`I'm gonna verify the nostr challenge`);
|
||||
const completedNostrChallenge = await nostrService.verifyNostrChallenge(signedEvent);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ async function verifyNostrChallenge(signedEvent) {
|
|||
|
||||
console.log("Checking if completed")
|
||||
if (await hasNostrChallengeBeenCompleted(challenge)) {
|
||||
throw new errors.ChallengedUsedError("Challenge already used, request new one.");
|
||||
throw new errors.AlreadyUsedError("Challenge already used, request new one.");
|
||||
}
|
||||
|
||||
console.log("Checking if valid")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue