diff --git a/api/authenticatedChannel.go b/api/authenticatedChannel.go index 4b5f15c16a7a8d1e03fdea41e5a9e2338bb0ceee..b9f89afa40bd311a8876a500e63ade23d68d530e 100644 --- a/api/authenticatedChannel.go +++ b/api/authenticatedChannel.go @@ -119,10 +119,10 @@ func (c *Client) MakePrecannedAuthenticatedChannel(precannedID uint) (contact.Co Source: precan.ID[:], }, me) - //rekey + //slient (rekey) c.storage.GetEdge().Add(edge.Preimage{ - Data: sessionPartner.GetRekeyPreimage(), - Type: preimage.Rekey, + Data: sessionPartner.GetSilentPreimage(), + Type: preimage.Silent, Source: precan.ID[:], }, me) diff --git a/api/client.go b/api/client.go index 6ea04f78cc4b4156899f93cf67947c3170aae79a..afb902a2d0ab8f97c5823074bef39fc9d167c17a 100644 --- a/api/client.go +++ b/api/client.go @@ -632,7 +632,7 @@ func (c *Client) DeleteContact(partnerId *id.ID) error { "they could not be found", partnerId) } e2ePreimage := partner.GetE2EPreimage() - rekeyPreimage := partner.GetRekeyPreimage() + rekeyPreimage := partner.GetSilentPreimage() fileTransferPreimage := partner.GetFileTransferPreimage() //delete the partner @@ -651,7 +651,7 @@ func (c *Client) DeleteContact(partnerId *id.ID) error { if err = c.storage.GetEdge().Remove(edge.Preimage{ Data: rekeyPreimage, - Type: preimage.Rekey, + Type: preimage.Silent, Source: partnerId[:], }, c.storage.GetUser().ReceptionID); err != nil { jww.WARN.Printf("Failed delete the preimage for rekey "+ diff --git a/api/results.go b/api/results.go index f3987393121402f3565ec392c1930a8b29fcafd7..20d4871c5fa6610bfe379c81a6e006281e46d396 100644 --- a/api/results.go +++ b/api/results.go @@ -166,7 +166,6 @@ func (c *Client) getRoundResults(roundList []id.Round, timeout time.Duration, } else { roundsResults[roundId] = Failed allRoundsSucceeded = false - } } } diff --git a/auth/callback.go b/auth/callback.go index 7f10aa06b948ba405da33e64ccea615d6ee09b1d..d9abe2a60518abda1845b011a9e4727fc4626a8e 100644 --- a/auth/callback.go +++ b/auth/callback.go @@ -340,10 +340,10 @@ func (m *Manager) doConfirm(sr *auth.SentRequest, grp *cyclic.Group, Source: sr.GetPartner()[:], }, me) - //rekey + //silent (rekey) m.storage.GetEdge().Add(edge.Preimage{ - Data: sessionPartner.GetRekeyPreimage(), - Type: preimage.Rekey, + Data: sessionPartner.GetSilentPreimage(), + Type: preimage.Silent, Source: sr.GetPartner()[:], }, me) diff --git a/auth/confirm.go b/auth/confirm.go index 1afe54b9cfbd9f541731c89fc8de422c4efff692..d6bc3b54332617bf08df144b1a4a323ef4aacc7b 100644 --- a/auth/confirm.go +++ b/auth/confirm.go @@ -131,10 +131,10 @@ func ConfirmRequestAuth(partner contact.Contact, rng io.Reader, Source: partner.ID[:], }, me) - //rekey + //slient (rekey) storage.GetEdge().Add(edge.Preimage{ - Data: sessionPartner.GetRekeyPreimage(), - Type: preimage.Rekey, + Data: sessionPartner.GetSilentPreimage(), + Type: preimage.Silent, Source: partner.ID[:], }, me) diff --git a/bindings/notifications.go b/bindings/notifications.go index c7d4b605578b2cafe98f2042f06d64adbbd48a10..1a736f722a200cc439e1be41c0facbc47edcba13 100644 --- a/bindings/notifications.go +++ b/bindings/notifications.go @@ -40,7 +40,7 @@ func (nfmr *NotificationForMeReport) Source() []byte { // "default" recipient user ID A message with no association // "request" sender user ID A channel request has been received // "confirm" sender user ID A channel request has been accepted -// "rekey" sender user ID keys with a user have been rotated +// "silent" sender user ID A message which should not be notified on // "e2e" sender user ID reception of an E2E message // "group" group ID reception of a group chat message // "endFT" sender user ID Last message sent confirming end of file transfer diff --git a/interfaces/params/E2E.go b/interfaces/params/E2E.go index 3e0aa95f80803aa138849101d6ae06b4559c20e8..a33ae9fc2d9513b69b8d50fee260ff3284dd928f 100644 --- a/interfaces/params/E2E.go +++ b/interfaces/params/E2E.go @@ -16,6 +16,7 @@ import ( type E2E struct { Type SendType RetryCount int + OnlyNotifyOnLastSend bool CMIX } @@ -23,6 +24,7 @@ func GetDefaultE2E() E2E { return E2E{ Type: Standard, CMIX: GetDefaultCMIX(), + OnlyNotifyOnLastSend: true, RetryCount: 10, } } diff --git a/interfaces/params/E2E_test.go b/interfaces/params/E2E_test.go index 1f4b599bdec30b5ed2461d7e6bdee3c172a279d5..1f88dba4cbf3252f27d62c28961f29301622d041 100644 --- a/interfaces/params/E2E_test.go +++ b/interfaces/params/E2E_test.go @@ -13,6 +13,9 @@ func TestGetDefaultE2E(t *testing.T) { if GetDefaultE2E().Type != Standard { t.Errorf("GetDefaultE2E did not return Standard") } + if !GetDefaultE2E().OnlyNotifyOnLastSend { + t.Errorf("GetDefaultE2E did not return OnlyNotifyOnLastSend == true") + } } func TestSendType_String(t *testing.T) { diff --git a/interfaces/preimage/types.go b/interfaces/preimage/types.go index 52842446a235b265d53812c1343a12156272e7cf..0b87ef34c47bc1574a94813ebb77ebb0155a67d8 100644 --- a/interfaces/preimage/types.go +++ b/interfaces/preimage/types.go @@ -4,7 +4,7 @@ const ( Default = "default" Request = "request" Confirm = "confirm" - Rekey = "rekey" + Silent = "silent" E2e = "e2e" Group = "group" EndFT = "endFT" diff --git a/keyExchange/rekey.go b/keyExchange/rekey.go index f549d7a57a69674565618048828b3a8586a42717..3a49304ecb0aca7309ad186d86c9e4df2bba9fea 100644 --- a/keyExchange/rekey.go +++ b/keyExchange/rekey.go @@ -62,7 +62,7 @@ func trigger(instance *network.Instance, sendE2E interfaces.SendE2E, "negotiating status: %s", session, session.NegotiationStatus()) } - rekeyPreimage := manager.GetRekeyPreimage() + rekeyPreimage := manager.GetSilentPreimage() // send the rekey notification to the partner err := negotiate(instance, sendE2E, sess, negotiatingSession, sendTimeout, rekeyPreimage, stop) diff --git a/keyExchange/trigger.go b/keyExchange/trigger.go index b4f6eb69c95707e1d330b255d10df6d3f6ae83e5..6ed48b8583bad7404b4448c0546dbf69a9880780 100644 --- a/keyExchange/trigger.go +++ b/keyExchange/trigger.go @@ -122,7 +122,7 @@ func handleTrigger(sess *storage.Session, net interfaces.NetworkManager, //send the message under the key exchange e2eParams := params.GetDefaultE2E() - e2eParams.IdentityPreimage = partner.GetRekeyPreimage() + e2eParams.IdentityPreimage = partner.GetSilentPreimage() // store in critical messages buffer first to ensure it is resent if the // send fails diff --git a/network/message/sendE2E.go b/network/message/sendE2E.go index 52d202393cc8817f2bf9ffd8acace69fb9df72eb..89f72fd5aa5bf0ff9269d2649b28944dc36e6e32 100644 --- a/network/message/sendE2E.go +++ b/network/message/sendE2E.go @@ -93,9 +93,12 @@ func (m *Manager) SendE2E(msg message.Send, param params.E2E, jww.INFO.Printf("E2E sending %d/%d to %s with msgDigest: %s, key fp: %s", i+i, len(partitions), msg.Recipient, msgEnc.Digest(), key.Fingerprint()) + localParam := param //set the preimage to the default e2e one if it is not already set - if param.IdentityPreimage == nil { - param.IdentityPreimage = partner.GetE2EPreimage() + if localParam.OnlyNotifyOnLastSend && i < len(partitions)-1{ + localParam.IdentityPreimage = partner.GetSilentPreimage() + }else if localParam.IdentityPreimage == nil { + localParam.IdentityPreimage = partner.GetE2EPreimage() } //send the cmix message, each partition in its own thread @@ -103,7 +106,7 @@ func (m *Manager) SendE2E(msg message.Send, param params.E2E, go func(i int) { var err error roundIds[i], _, err = m.SendCMIX(m.sender, msgEnc, msg.Recipient, - param.CMIX, stop) + localParam.CMIX, stop) if err != nil { errCh <- err } diff --git a/storage/e2e/manager.go b/storage/e2e/manager.go index f7537fb34f770ea64c3d74a4f88d21cef2394ca6..6380b8eb981303c42e64b06784d2fff8f7787a5b 100644 --- a/storage/e2e/manager.go +++ b/storage/e2e/manager.go @@ -261,10 +261,10 @@ func (m *Manager) GetE2EPreimage() []byte { return preimage.Generate(m.GetRelationshipFingerprintBytes(), preimage.E2e) } -// GetRekeyPreimage returns a hash of the unique -// fingerprint for an E2E rekey message. -func (m *Manager) GetRekeyPreimage() []byte { - return preimage.Generate(m.GetRelationshipFingerprintBytes(), preimage.Rekey) +// GetSilentPreimage returns a hash of the unique +// fingerprint for silent messages like E2E rekey message. +func (m *Manager) GetSilentPreimage() []byte { + return preimage.Generate(m.GetRelationshipFingerprintBytes(), preimage.Silent) } // GetFileTransferPreimage returns a hash of the unique