fix: case insensitive name match

This commit is contained in:
Alejandro Gomez 2023-01-15 12:06:32 +01:00
parent f2a9b1ff9c
commit 2acbe37907
No known key found for this signature in database
GPG Key ID: 4DF39E566658C817

View File

@ -12,9 +12,10 @@ function fetchNip05Pubkey(name, domain) {
return fetch(`https://${domain}/.well-known/nostr.json?name=${encodeURIComponent(name)}`) return fetch(`https://${domain}/.well-known/nostr.json?name=${encodeURIComponent(name)}`)
.then((res) => res.json()) .then((res) => res.json())
.then(({ names }) => { .then(({ names }) => {
if (names && names[name]) { const match = Object.keys(names).find(n => {
return names[name] return n.toLowerCase() === name.toLowerCase()
} })
return names[match]
}) })
} }