test for json marshaling of ids and pubkeys.

This commit is contained in:
fiatjaf
2025-05-02 19:45:15 -03:00
parent 32360a4657
commit d59692781d
3 changed files with 98 additions and 4 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ type RelayEvent struct {
Relay *Relay
}
var ZeroID = [32]byte{}
var ZeroID = ID{}
// ID represents an event id
type ID [32]byte
@@ -32,7 +32,7 @@ func (id *ID) UnmarshalJSON(buf []byte) error {
if len(buf) != 66 {
return fmt.Errorf("must be a hex string of 64 characters")
}
_, err := hex.Decode(id[:], buf[1:])
_, err := hex.Decode(id[:], buf[1:65])
return err
}