Added json tags to Message and MessageHeader

This commit is contained in:
Ivan Tomilov 2017-06-14 19:16:03 +07:00
parent 3c4ad2c0bd
commit d3aa2e75ba
1 changed files with 5 additions and 5 deletions

View File

@ -4,20 +4,20 @@ import "fmt"
// Message is a single message exchanged by the parties. // Message is a single message exchanged by the parties.
type Message struct { type Message struct {
Header MessageHeader Header MessageHeader `json:"header"`
Ciphertext []byte Ciphertext []byte `json:"ciphertext"`
} }
// MessageHeader that is prepended to every message. // MessageHeader that is prepended to every message.
type MessageHeader struct { type MessageHeader struct {
// DHr is the sender's current ratchet public key. // DHr is the sender's current ratchet public key.
DH Key DH Key `json:"dh"`
// N is the number of the message in the sending chain. // N is the number of the message in the sending chain.
N uint N uint `json:"n"`
// PN is the length of the previous sending chain. // PN is the length of the previous sending chain.
PN uint PN uint `json:"pn"`
} }
// MarshalBinary makes MessageHeader implement the BinaryMarshaler interface. // MarshalBinary makes MessageHeader implement the BinaryMarshaler interface.