non ported html fix

This commit is contained in:
Richard Bondi 2021-02-21 21:42:28 -06:00 committed by fiatjaf
parent e6cc6347e2
commit acff24ad46

View File

@ -1,6 +1,7 @@
package event
import (
"bytes"
"crypto/rand"
"crypto/sha256"
"encoding/hex"
@ -81,8 +82,12 @@ func (evt *Event) Serialize() []byte {
// content
arr[5] = evt.Content
serialized, _ := json.Marshal(arr)
return serialized
serialized := new(bytes.Buffer)
enc := json.NewEncoder(serialized)
enc.SetEscapeHTML(false)
_ = enc.Encode(arr)
return serialized.Bytes()[:serialized.Len()-1] // Encode add new line char
}
// CheckSignature checks if the signature is valid for the id