diff --git a/auth/callback.go b/auth/callback.go index 7d3f262165df1f8cb5eb1f30a5c3283a99da9150..7ae57d144bfb2a3c6e0b7b8cd02cb610d4694553 100644 --- a/auth/callback.go +++ b/auth/callback.go @@ -9,6 +9,8 @@ package auth import ( "fmt" + "strings" + "github.com/cloudflare/circl/dh/sidh" "github.com/pkg/errors" jww "github.com/spf13/jwalterweatherman" @@ -26,7 +28,6 @@ import ( "gitlab.com/elixxir/primitives/fact" "gitlab.com/elixxir/primitives/format" "gitlab.com/xx_network/crypto/csprng" - "strings" ) func (m *Manager) StartProcesses() (stoppable.Stoppable, error) { @@ -185,7 +186,7 @@ func (m *Manager) handleRequest(cmixMsg format.Message, events.Report(5, "Auth", "DuplicateRequest", em) // if the caller of the API wants requests replayed, // replay the duplicate request - if m.replayRequests{ + if m.replayRequests { cbList := m.requestCallbacks.Get(c.ID) for _, cb := range cbList { rcb := cb.(interfaces.RequestCallback) @@ -229,12 +230,28 @@ func (m *Manager) handleRequest(cmixMsg format.Message, } // If I do, delete my request on disk - _, _, partnerContact, _ := m.storage.Auth().GetRequest(partnerID) m.storage.Auth().Delete(partnerID) - // Use the public key sent to me, not the one I - // first retrieved to initiate the auth request - partnerContact.DhPubKey = partnerPubKey + //process the inner payload + facts, _, err := fact.UnstringifyFactList( + string(requestFmt.msgPayload)) + if err != nil { + em := fmt.Sprintf("failed to parse facts and message "+ + "from Auth Request: %s", err) + jww.WARN.Print(em) + events.Report(10, "Auth", "RequestError", em) + return + } + + // create the contact, note that we use the data + // sent in the request and not any data we had + // already + partnerContact := contact.Contact{ + ID: partnerID, + DhPubKey: partnerPubKey, + OwnershipProof: copySlice(ownership), + Facts: facts, + } // add a confirmation to disk if err = m.storage.Auth().AddReceived(partnerContact,