Skip to content
Snippets Groups Projects
Commit 077203f8 authored by Josh Brooks's avatar Josh Brooks
Browse files

Partial response to review

parent 4a444a73
No related branches found
No related tags found
2 merge requests!510Release,!344Xx 4084/send e2e residue
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
package parse package parse
import ( import (
e2eCrypto "gitlab.com/elixxir/crypto/e2e" "gitlab.com/elixxir/crypto/e2e"
"time" "time"
"github.com/pkg/errors" "github.com/pkg/errors"
...@@ -80,7 +80,7 @@ func (p *Partitioner) Partition(recipient *id.ID, mt catalog.MessageType, ...@@ -80,7 +80,7 @@ func (p *Partitioner) Partition(recipient *id.ID, mt catalog.MessageType,
func (p *Partitioner) HandlePartition(sender *id.ID, func (p *Partitioner) HandlePartition(sender *id.ID,
contents []byte, relationshipFingerprint []byte, contents []byte, relationshipFingerprint []byte,
residue e2eCrypto.KeyResidue) (receive.Message, e2eCrypto.KeyResidue, bool) { residue e2e.KeyResidue) (receive.Message, e2e.KeyResidue, bool) {
if isFirst(contents) { if isFirst(contents) {
// If it is the first message in a set, then handle it as so // If it is the first message in a set, then handle it as so
......
...@@ -51,6 +51,7 @@ func NewOrLoad(kv *versioned.KV) *Store { ...@@ -51,6 +51,7 @@ func NewOrLoad(kv *versioned.KV) *Store {
return partitionStore return partitionStore
} }
// AddFirst adds the first partition message to the Store object.
func (s *Store) AddFirst(partner *id.ID, mt catalog.MessageType, func (s *Store) AddFirst(partner *id.ID, mt catalog.MessageType,
messageID uint64, partNum, numParts uint8, senderTimestamp, messageID uint64, partNum, numParts uint8, senderTimestamp,
storageTimestamp time.Time, part []byte, relationshipFingerprint []byte, storageTimestamp time.Time, part []byte, relationshipFingerprint []byte,
......
...@@ -30,8 +30,8 @@ func (p *processor) Process(ecrMsg format.Message, ...@@ -30,8 +30,8 @@ func (p *processor) Process(ecrMsg format.Message,
return return
} }
// todo: handle residue here
sess := p.cy.GetSession() sess := p.cy.GetSession()
// todo: handle residue here
message, _, done := p.m.partitioner.HandlePartition(sess.GetPartner(), message, _, done := p.m.partitioner.HandlePartition(sess.GetPartner(),
contents, sess.GetRelationshipFingerprint(), residue) contents, sess.GetRelationshipFingerprint(), residue)
if done { if done {
......
...@@ -70,7 +70,7 @@ type Cypher interface { ...@@ -70,7 +70,7 @@ type Cypher interface {
// Decrypt uses the E2E key to decrypt the message. It returns an error in // Decrypt uses the E2E key to decrypt the message. It returns an error in
// case of HMAC verification failure or in case of a decryption error // case of HMAC verification failure or in case of a decryption error
// (related to padding). It generates a residue of the // (related to padding). It generates a residue of the
// // key used to encrypt the contents. // key used to encrypt the contents.
Decrypt(msg format.Message) (decryptedPayload []byte, residue e2eCrypto.KeyResidue, err error) Decrypt(msg format.Message) (decryptedPayload []byte, residue e2eCrypto.KeyResidue, err error)
// Use sets the key as used. It cannot be used again. // Use sets the key as used. It cannot be used again.
......
...@@ -19,6 +19,19 @@ import ( ...@@ -19,6 +19,19 @@ import (
"gitlab.com/xx_network/primitives/netTime" "gitlab.com/xx_network/primitives/netTime"
) )
// SendE2E send a message containing the payload to the
// recipient of the passed message type, per the given
// parameters - encrypted with end-to-end encryption.
// Default parameters can be retrieved through
// GetDefaultParams()
// If too long, it will chunk a message up into its messages
// and send each as a separate cmix message. It will return
// the list of all rounds sent on, a unique ID for the
// message, and the timestamp sent on.
// the recipient must already have an e2e relationship,
// otherwise an error will be returned.
// Will return an error if the network is not healthy or in
// the event of a failed send
func (m *manager) SendE2E(mt catalog.MessageType, recipient *id.ID, func (m *manager) SendE2E(mt catalog.MessageType, recipient *id.ID,
payload []byte, params Params) (e2e.SendReport, error) { payload []byte, params Params) (e2e.SendReport, error) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment