From 2bbba3ffcabc2b5583881a10c1041ed8cadfe909 Mon Sep 17 00:00:00 2001
From: Benjamin Wenger <ben@elixxir.ioo>
Date: Thu, 21 Oct 2021 16:50:58 -0700
Subject: [PATCH] added preimages to precanned e2e

---
 api/authenticatedChannel.go | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/api/authenticatedChannel.go b/api/authenticatedChannel.go
index 746572e94..b302f78d4 100644
--- a/api/authenticatedChannel.go
+++ b/api/authenticatedChannel.go
@@ -12,6 +12,8 @@ import (
 	jww "github.com/spf13/jwalterweatherman"
 	"gitlab.com/elixxir/client/auth"
 	"gitlab.com/elixxir/client/interfaces"
+	"gitlab.com/elixxir/client/interfaces/preimage"
+	"gitlab.com/elixxir/client/storage/edge"
 	"gitlab.com/elixxir/crypto/contact"
 	"gitlab.com/elixxir/primitives/fact"
 	"gitlab.com/xx_network/primitives/id"
@@ -103,6 +105,27 @@ func (c *Client) MakePrecannedAuthenticatedChannel(precannedID uint) (contact.Co
 	// the channel
 	c.network.CheckGarbledMessages()
 
+	//add the e2e and rekey firngeprints
+	//e2e
+	sessionPartner, err := c.storage.E2e().GetPartner(precan.ID)
+	if err != nil {
+		jww.FATAL.Panicf("Cannot find %s right after creating: %+v", precan.ID, err)
+	}
+	me := c.storage.GetUser().ReceptionID
+
+	c.storage.GetEdge().Add(edge.Preimage{
+		Data:   sessionPartner.GetE2EPreimage(),
+		Type:   preimage.E2e,
+		Source: precan.ID[:],
+	}, me)
+
+	//rekey
+	c.storage.GetEdge().Add(edge.Preimage{
+		Data:   sessionPartner.GetRekeyPreimage(),
+		Type:   preimage.Rekey,
+		Source: precan.ID[:],
+	}, me)
+
 	return precan, err
 }
 
-- 
GitLab