Skip to content
Snippets Groups Projects
Commit b2b2ac05 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Merge remote-tracking branch 'origin/release' into hotfix/improvedRestore

parents 316045ec 4050a353
No related branches found
No related tags found
3 merge requests!233Modify restore to call user-defined bindings callback. Add Sent requests to...,!231Revert "Update store to print changes to the partners list",!192Hotfix/improved restore
......@@ -976,6 +976,12 @@ func checkVersionAndSetupStorage(def *ndf.NetworkDefinition,
Source: protoUser.ReceptionID[:],
}, protoUser.ReceptionID)
storageSess.GetEdge().Add(edge.Preimage{
Data: preimage.GenerateRequest(protoUser.ReceptionID),
Type: preimage.Reset,
Source: protoUser.ReceptionID[:],
}, protoUser.ReceptionID)
if err != nil {
return nil, errors.WithMessage(err, "Failed to denote state "+
"change in session")
......
......@@ -34,7 +34,7 @@ func getMixPayloadSize(primeSize int) int {
// is created.
func sendAuthRequest(recipient *id.ID, contents, mac []byte, primeSize int,
fingerprint format.Fingerprint, net interfaces.NetworkManager,
cMixParams params.CMIX) (id.Round, error) {
cMixParams params.CMIX, reset bool) (id.Round, error) {
cmixMsg := format.NewMessage(primeSize)
cmixMsg.SetKeyFP(fingerprint)
cmixMsg.SetMac(mac)
......@@ -42,8 +42,12 @@ func sendAuthRequest(recipient *id.ID, contents, mac []byte, primeSize int,
jww.INFO.Printf("Requesting Auth with %s, msgDigest: %s",
recipient, cmixMsg.Digest())
if reset {
cMixParams.IdentityPreimage = preimage.GenerateRequest(recipient)
} else {
cMixParams.IdentityPreimage = preimage.GenerateReset(recipient)
}
cMixParams.IdentityPreimage = preimage.GenerateRequest(recipient)
cMixParams.DebugTag = "auth.Request"
round, _, err := net.SendCMIX(cmixMsg, recipient, cMixParams)
if err != nil {
......
......@@ -181,7 +181,7 @@ func requestAuth(partner, me contact.Contact, rng io.Reader, reset bool,
cMixParams := params.GetDefaultCMIX()
rndID, err := sendAuthRequest(partner.ID, contents, mac, cMixPrimeSize,
requestfp, net, cMixParams)
requestfp, net, cMixParams, reset)
return rndID, err
}
......
......@@ -54,6 +54,7 @@ func (mnfmr *ManyNotificationForMeReport) Len() int {
// TYPE SOURCE DESCRIPTION
// "default" recipient user ID A message with no association
// "request" sender user ID A channel request has been received
// "reset" sender user ID A channel reset has been received
// "confirm" sender user ID A channel request has been accepted
// "silent" sender user ID A message which should not be notified on
// "e2e" sender user ID reception of an E2E message
......
......@@ -28,3 +28,13 @@ func GenerateRequest(recipient *id.ID) []byte {
// Base 64 encode hash and truncate
return h.Sum(nil)
}
func GenerateReset(recipient *id.ID) []byte {
// Hash fingerprints
h, _ := blake2b.New256(nil)
h.Write(recipient[:])
h.Write([]byte(Reset))
// Base 64 encode hash and truncate
return h.Sum(nil)
}
......@@ -3,6 +3,7 @@ package preimage
const (
Default = "default"
Request = "request"
Reset = "reset"
Confirm = "confirm"
Silent = "silent"
E2e = "e2e"
......
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