mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-03-17 21:32:56 +01:00
case insenstive for nip42 service url validation, some cleanup
This commit is contained in:
parent
443c7cf633
commit
839154da5a
@ -42,12 +42,20 @@ func ValidateAuthEvent(event *nostr.Event, challenge string, relayURL string) (p
|
||||
return "", false
|
||||
}
|
||||
|
||||
expected, err := url.Parse(strings.TrimSuffix(relayURL, "/"))
|
||||
parseUrl := func(input string) (*url.URL, error) {
|
||||
return url.Parse(
|
||||
strings.ToLower(
|
||||
strings.TrimSuffix(input, "/"),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
expected, err := parseUrl(relayURL)
|
||||
if err != nil {
|
||||
return "", false
|
||||
}
|
||||
|
||||
found, err := url.Parse(strings.TrimSuffix(event.Tags.GetFirst([]string{"relay", ""}).Value(), "/"))
|
||||
found, err := parseUrl(event.Tags.GetFirst([]string{"relay", ""}).Value())
|
||||
if err != nil {
|
||||
return "", false
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user