mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-03-17 21:32:56 +01:00
support nip-35.
This commit is contained in:
parent
2d01aa8630
commit
e8bc11e4f9
@ -7,6 +7,16 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type (
|
||||
Name2KeyMap map[string]string
|
||||
Key2RelaysMap map[string][]string
|
||||
)
|
||||
|
||||
type WellKnownResponse struct {
|
||||
Names Name2KeyMap `json:"names"` // NIP-05
|
||||
Relays Key2RelaysMap `json:"relays"` // NIP-35
|
||||
}
|
||||
|
||||
func QueryIdentifier(fullname string) string {
|
||||
spl := strings.Split(fullname, "@")
|
||||
if len(spl) != 2 {
|
||||
@ -20,9 +30,7 @@ func QueryIdentifier(fullname string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
var result struct {
|
||||
Names map[string]string `json:"names"`
|
||||
}
|
||||
var result WellKnownResponse
|
||||
if err := json.NewDecoder(res.Body).Decode(&result); err != nil {
|
||||
return ""
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user