mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-03-17 21:32:56 +01:00
adjust nip05 so it supports naked domains.
This commit is contained in:
parent
a16e2a28d5
commit
e407725a43
@ -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 ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user