renderAccount: fix crash encoding invalid pubkey

This commit is contained in:
Alex Gleason 2024-05-31 21:42:39 -05:00
parent adcaad2863
commit ffda62a4b0
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 7 additions and 1 deletions

View File

@ -31,7 +31,13 @@ async function renderAccount(
website, website,
} = n.json().pipe(n.metadata()).catch({}).parse(event.content); } = n.json().pipe(n.metadata()).catch({}).parse(event.content);
const npub = nip19.npubEncode(pubkey); let npub: string;
try {
npub = nip19.npubEncode(pubkey);
} catch {
return;
}
const parsed05 = await parseAndVerifyNip05(nip05, pubkey); const parsed05 = await parseAndVerifyNip05(nip05, pubkey);
const role = event.user?.tags.find(([name]) => name === 'role')?.[1] ?? 'user'; const role = event.user?.tags.find(([name]) => name === 'role')?.[1] ?? 'user';