mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-10-11 05:13:47 +02:00
ensure nip05 results are valid keys or nil.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package nip05
|
package nip05
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -52,7 +53,17 @@ func QueryIdentifier(fullname string) *nostr.ProfilePointer {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
pubkey, _ := result.Names[name]
|
pubkey, ok := result.Names[name]
|
||||||
|
if !ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(pubkey) == 64 {
|
||||||
|
if _, err := hex.DecodeString(pubkey); err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
relays, _ := result.Relays[pubkey]
|
relays, _ := result.Relays[pubkey]
|
||||||
|
|
||||||
return &nostr.ProfilePointer{
|
return &nostr.ProfilePointer{
|
||||||
|
Reference in New Issue
Block a user