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

MORE WORK

parent 99fa093d
No related branches found
No related tags found
No related merge requests found
......@@ -167,6 +167,8 @@ func handleRequest(cmixMsg format.Message, myHistoricalPrivKey *cyclic.Int,
Facts: facts,
}
// fixme: the client will never be notified of the channel creation if a
// crash occurs after the store but before the conclusion of the callback
//create the auth storage
if err = storage.Auth().AddReceived(c); err != nil {
jww.WARN.Printf("failed to store contact Auth "+
......@@ -233,7 +235,8 @@ func doConfirm(sr *auth.SentRequest, grp *cyclic.Group,
"confirmation of %s", sr.GetPartner())
}
// create the relationship
// fixme: channel can get into a bricked state if the first save occurs and
// the second does not
p := e2e.GetDefaultSessionParams()
if err := storage.E2e().AddPartner(sr.GetPartner(),
partnerPubKey, p, p); err != nil {
......@@ -241,7 +244,6 @@ func doConfirm(sr *auth.SentRequest, grp *cyclic.Group,
"after confirmation: %+v",
sr.GetPartner(), err)
}
net.CheckGarbledMessages()
// delete the in progress negotiation
if err := storage.Auth().Delete(sr.GetPartner()); err != nil {
......@@ -258,8 +260,12 @@ func doConfirm(sr *auth.SentRequest, grp *cyclic.Group,
Facts: make([]contact.Fact, 0),
}
// fixme: if a crash occurs before or during the call, the notification
// will never be sent.
go ccb(c)
net.CheckGarbledMessages()
return nil
}
......
......@@ -5,7 +5,9 @@ import (
"gitlab.com/elixxir/client/interfaces"
"gitlab.com/elixxir/client/interfaces/contact"
"gitlab.com/elixxir/client/storage"
"gitlab.com/elixxir/crypto/diffieHellman"
"io"
cAuth "gitlab.com/elixxir/crypto/e2e/auth"
)
func ConfirmRequestAuth(partner contact.Contact, rng io.Reader,
......@@ -19,17 +21,27 @@ func ConfirmRequestAuth(partner contact.Contact, rng io.Reader,
// check if the partner has an auth in progress
storedContact, err := storage.Auth().GetReceivedRequest(partner.ID)
if err == nil {
if err != nil {
return errors.Errorf("failed to find a pending Auth Request: %s",
err)
}
// verify the passed contact matches what is stored
if storedContact.DhPubKey.Cmp(partner.DhPubKey) != 0 {
return errors.Errorf("Pending Auth Request has diferent pubkey than : %s",
return errors.Errorf("Pending Auth Request has different "+
"pubkey than stored",
err)
}
// chec
grp := storage.E2e().GetGroup()
//generate ownership proof
ownership := cAuth.MakeOwnershipProof(storage.E2e().GetDHPrivateKey(),
partner.DhPubKey, storage.E2e().GetGroup())
//generate new keypair
newPrivKey := diffieHellman.GeneratePrivateKey(256, grp, rng)
newPubKey := diffieHellman.GeneratePublicKey(newPrivKey, grp)
}
......@@ -150,6 +150,9 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
jww.ERROR.Printf("request failed to transmit, will be " +
"handled on reconnect")
storage.GetCriticalRawMessages().Failed(cmixMsg)
} else {
storage.GetCriticalRawMessages().Succeeded(cmixMsg)
}
return nil
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment