mirror of
https://github.com/fiatjaf/nak.git
synced 2026-04-11 16:07:22 +02:00
when parsing a nip05 as a pubkey there is no point in falling back to parsing as hex or npub.
This commit is contained in:
@@ -491,15 +491,14 @@ func askConfirmation(msg string) bool {
|
||||
}
|
||||
|
||||
func parsePubKey(value string) (nostr.PubKey, error) {
|
||||
// try nip05 first
|
||||
if nip05.IsValidIdentifier(value) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
|
||||
pp, err := nip05.QueryIdentifier(ctx, value)
|
||||
cancel()
|
||||
if err == nil {
|
||||
return pp.PublicKey, nil
|
||||
if err != nil {
|
||||
return nostr.ZeroPK, err
|
||||
}
|
||||
// if nip05 fails, fall through to try as pubkey
|
||||
return pp.PublicKey, nil
|
||||
}
|
||||
|
||||
pk, err := nostr.PubKeyFromHex(value)
|
||||
|
||||
Reference in New Issue
Block a user