Skip to content
Snippets Groups Projects
Commit 4050a353 authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

made session resets come in on a unique service

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