diff --git a/event.go b/event.go index b093934..844925b 100644 --- a/event.go +++ b/event.go @@ -3,6 +3,7 @@ package nostr import ( "crypto/sha256" "encoding/hex" + "encoding/json" "fmt" "time" @@ -41,6 +42,15 @@ const ( KindZap int = 9735 ) +// Event Stringer interface, just returns the raw JSON as a string +func (evt *Event) String() string { + if evt == nil { + return "null" + } + j, _ := json.Marshal(evt) + return string(j) +} + // GetID serializes and returns the event ID as a string func (evt *Event) GetID() string { h := sha256.Sum256(evt.Serialize())