Make nip 05 parsing more permissive

This commit is contained in:
Jon Staab
2025-11-06 10:57:28 -08:00
parent 5345cc1405
commit 6b7e1a5e90
2 changed files with 4 additions and 7 deletions
+3 -7
View File
@@ -11,14 +11,10 @@ export type Handle = {
relays?: string[]
}
export const NIP05_REGEX = /^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/
export async function queryProfile(nip05: string) {
const match = nip05.match(NIP05_REGEX)
if (!match) return undefined
const [_, name = "_", domain] = match
const parts = nip05.split("@")
const name = parts.length > 1 ? parts[0] : "_"
const domain = last(parts)
try {
const {
+1
View File
@@ -5,6 +5,7 @@ export enum ManagementMethod {
SupportedMethods = "supportedmethods",
BanPubkey = "banpubkey",
AllowPubkey = "allowpubkey",
DisallowPubkey = "disallowpubkey",
ListBannedPubkeys = "listbannedpubkeys",
ListAllowedPubkeys = "listallowedpubkeys",
ListEventsNeedingModeration = "listeventsneedingmoderation",