mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-03-17 13:22:56 +01:00
ensure nip05 results are valid keys or nil.
This commit is contained in:
parent
4b1f69ec27
commit
3f3bbb7529
@ -1,6 +1,7 @@
|
||||
package nip05
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
@ -52,7 +53,17 @@ func QueryIdentifier(fullname string) *nostr.ProfilePointer {
|
||||
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]
|
||||
|
||||
return &nostr.ProfilePointer{
|
||||
|
Loading…
x
Reference in New Issue
Block a user