use easyjson and envelopes.

This commit is contained in:
fiatjaf
2023-11-28 15:18:43 -03:00
parent f2f9dda33a
commit d9d36e7619
2 changed files with 5 additions and 4 deletions

View File

@@ -142,7 +142,7 @@ example:
kindWasSupplied := false
mustRehashAndResign := false
if stdinEvent != "" {
if err := json.Unmarshal([]byte(stdinEvent), &evt); err != nil {
if err := easyjson.Unmarshal([]byte(stdinEvent), &evt); err != nil {
lineProcessingError(c, "invalid event received from stdin: %s", err)
continue
}
@@ -235,7 +235,7 @@ example:
} else {
var result string
if c.Bool("envelope") {
j, _ := json.Marshal([]any{"EVENT", evt})
j, _ := json.Marshal(nostr.EventEnvelope{Event: evt})
result = string(j)
} else if c.Bool("nson") {
result, _ = nson.Marshal(&evt)