diff --git a/nip05/nip05.go b/nip05/nip05.go index 2c5ebb0..27956e7 100644 --- a/nip05/nip05.go +++ b/nip05/nip05.go @@ -19,12 +19,23 @@ type WellKnownResponse struct { func QueryIdentifier(fullname string) string { spl := strings.Split(fullname, "@") - if len(spl) != 2 { + + var name, domain string + switch len(spl) { + case 1: + name = "_" + domain = spl[0] + case 2: + name = spl[0] + domain = spl[1] + default: + return "" + } + + if strings.Index(domain, ".") == -1 { return "" } - name := spl[0] - domain := spl[1] res, err := http.Get(fmt.Sprintf("https://%s/.well-known/nostr.json?name=%s", domain, name)) if err != nil { return ""