better APIs for sending protocol messages

no longer tagging requiring the caller to construct them
This commit is contained in:
Matthias Radestock committed 2015-01-20 22:31:16 +00:00
1 parent 644697977b
commit 1181a0cb33
5 files changed
+40 -40

No files matched your search

+3 -3
View File
@@ -85,7 +85,7 @@ func EncodeNonce(df bool) (*[24]byte, []byte, error) {
flags = flags | 1
}
SetNonceLow15Bits(&nonce, flags)
return &nonce, Concat(ProtocolNonceByte, nonce[:]), nil
return &nonce, nonce[:], nil
}
func DecodeNonce(msg []byte) (bool, *[24]byte) {
@@ -206,7 +206,7 @@ func (ne *NaClEncryptor) Bytes() []byte {
if err = ne.conn.CheckFatal(err); err != nil {
return []byte{}
}
ne.conn.SendTCP(encodedNonce)
ne.conn.SendProtocolMsg(ProtocolNonce, encodedNonce)
ne.nonce = freshNonce
nonce = freshNonce
}
@@ -225,7 +225,7 @@ func (ne *NaClEncryptor) Bytes() []byte {
return []byte{}
}
ne.nonceChan <- nonce
ne.conn.SendTCP(encodedNonce)
ne.conn.SendProtocolMsg(ProtocolNonce, encodedNonce)
}
ne.offset = offset