From bb72af908f498667861d6fff94e28a339b07eac0 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Mon, 28 Jul 2025 09:35:37 -0300 Subject: [PATCH] nip53: typed participant pubkey. --- nip53/nip53.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nip53/nip53.go b/nip53/nip53.go index e90ee66..26d32eb 100644 --- a/nip53/nip53.go +++ b/nip53/nip53.go @@ -24,7 +24,7 @@ type LiveEvent struct { } type Participant struct { - PubKey string + PubKey nostr.PubKey Relay string Role string } @@ -64,9 +64,9 @@ func ParseLiveEvent(event nostr.Event) LiveEvent { case "recording": liev.Recording = append(liev.Recording, tag[1]) case "p": - if nostr.IsValid32ByteHex(tag[1]) { + if pk, err := nostr.PubKeyFromHex(tag[1]); err == nil { part := Participant{ - PubKey: tag[1], + PubKey: pk, } if len(tag) > 2 { part.Relay = tag[2] @@ -118,7 +118,7 @@ func (liev LiveEvent) ToHashtags() nostr.Tags { tags = append(tags, nostr.Tag{"recording", url}) } for _, part := range liev.Participants { - tags = append(tags, nostr.Tag{"p", part.PubKey, part.Relay, part.Role}) + tags = append(tags, nostr.Tag{"p", part.PubKey.Hex(), part.Relay, part.Role}) } for _, hashtag := range liev.Hashtags { tags = append(tags, nostr.Tag{"t", hashtag})