feat(kind): using constants

This commit is contained in:
Isaque Veras
2023-09-06 21:00:05 -03:00
committed by fiatjaf_
parent eef7c40dc7
commit 0f66883dc7
12 changed files with 38 additions and 35 deletions

View File

@@ -14,7 +14,7 @@ func CreateUnsignedAuthEvent(challenge, pubkey, relayURL string) nostr.Event {
return nostr.Event{
PubKey: pubkey,
CreatedAt: nostr.Now(),
Kind: 22242,
Kind: nostr.KindClientAuthentication,
Tags: nostr.Tags{
nostr.Tag{"relay", relayURL},
nostr.Tag{"challenge", challenge},
@@ -35,7 +35,7 @@ func parseURL(input string) (*url.URL, error) {
// ValidateAuthEvent checks whether event is a valid NIP-42 event for given challenge and relayURL.
// The result of the validation is encoded in the ok bool.
func ValidateAuthEvent(event *nostr.Event, challenge string, relayURL string) (pubkey string, ok bool) {
if event.Kind != 22242 {
if event.Kind != nostr.KindClientAuthentication {
return "", false
}