fix nip05.

This commit is contained in:
fiatjaf 2024-03-11 13:44:58 -03:00
parent c844dc2ccb
commit 7284ebcf13
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1
2 changed files with 14 additions and 1 deletions

View File

@ -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 {

View File

@ -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")
}
}