diff --git a/nip05/nip05.go b/nip05/nip05.go index 18bc00e..867b488 100644 --- a/nip05/nip05.go +++ b/nip05/nip05.go @@ -84,7 +84,7 @@ func Fetch(ctx context.Context, fullname string) (resp WellKnownResponse, name s return resp, name, fmt.Errorf("failed to decode json response: %w", err) } - return resp, name, nil + return result, name, nil } func NormalizeIdentifier(fullname string) string { diff --git a/nip05/nip05_test.go b/nip05/nip05_test.go index 5f60c2e..6d524fe 100644 --- a/nip05/nip05_test.go +++ b/nip05/nip05_test.go @@ -1,6 +1,7 @@ package nip05 import ( + "context" "testing" ) @@ -35,3 +36,15 @@ func TestParse(t *testing.T) { t.Fatalf("should have errored") } } + +func TestQuery(t *testing.T) { + pp, err := QueryIdentifier(context.Background(), "fiatjaf.com") + if err != nil || pp.PublicKey != "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d" { + t.Fatalf("invalid query for fiatjaf.com") + } + + pp, err = QueryIdentifier(context.Background(), "htlc@fiatjaf.com") + if err != nil || pp.PublicKey != "f9dd6a762506260b38a2d3e5b464213c2e47fa3877429fe9ee60e071a31a07d7" { + t.Fatalf("invalid query for htlc@fiatjaf.com") + } +}