nostr challenge step much more robust

This commit is contained in:
counterweight 2025-02-13 01:17:49 +01:00
parent 805ad5fad9
commit 564dcb8083
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
7 changed files with 99 additions and 50 deletions

View file

@ -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);

View file

@ -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")