fix issue when pubkeys file doesn't exist
This commit is contained in:
parent
7ce36dfb37
commit
b0ef76baf0
1 changed files with 1 additions and 1 deletions
|
@ -23,7 +23,7 @@ async function validateAuthEvent(event: Event, challenge: string): boolean {
|
|||
const challengeTag = event.tags.find(tag => tag[0] === 'challange')?.[1];
|
||||
if (challengeTag !== challenge) return false;
|
||||
const file = Bun.file("./allowed-pubkeys.json");
|
||||
if (!file.exists()) return true;
|
||||
if (!await file.exists()) return true;
|
||||
const allowedPubkeys = JSON.parse(await file.text());
|
||||
if (!allowedPubkeys.includes(event.pubkey)) return false;
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue