From 9a6df7d2a80c2fa32b992064be8adc49b659c747 Mon Sep 17 00:00:00 2001
From: jbhusson <jonah@elixxir.io>
Date: Fri, 22 Jan 2021 14:42:53 -0500
Subject: [PATCH] Flip some identity uses from transmission to receiption

---
 auth/request.go    |  4 ++--
 cmd/init.go        |  4 ++--
 cmd/root.go        |  2 +-
 cmd/ud.go          |  2 +-
 network/manager.go |  2 +-
 ud/addFact.go      |  2 +-
 ud/manager.go      |  2 +-
 ud/register.go     | 14 +++++++-------
 8 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/auth/request.go b/auth/request.go
index 5ba9d412b..dd8ba1525 100644
--- a/auth/request.go
+++ b/auth/request.go
@@ -47,7 +47,7 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
 	}
 
 	// check that the request is being sent from the proper ID
-	if !me.ID.Cmp(storage.GetUser().TransmissionID) {
+	if !me.ID.Cmp(storage.GetUser().ReceptionID) {
 		return errors.Errorf("Authenticated channel request " +
 			"can only be sent from user's identity")
 	}
@@ -116,7 +116,7 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
 	jww.INFO.Printf("RequestAuth THEIRPUBKEY: %v", partner.DhPubKey.Bytes())
 
 	/*encrypt payload*/
-	requestFmt.SetID(storage.GetUser().TransmissionID)
+	requestFmt.SetID(storage.GetUser().ReceptionID)
 	requestFmt.SetMsgPayload(msgPayloadBytes)
 	ecrFmt.SetOwnership(ownership)
 	ecrPayload, mac := cAuth.Encrypt(newPrivKey, partner.DhPubKey,
diff --git a/cmd/init.go b/cmd/init.go
index d5d3b91ae..cf19521f0 100644
--- a/cmd/init.go
+++ b/cmd/init.go
@@ -22,9 +22,9 @@ var initCmd = &cobra.Command{
 	Run: func(cmd *cobra.Command, args []string) {
 		client := createClient()
 		user := client.GetUser()
-		jww.INFO.Printf("User: %s", user.TransmissionID)
+		jww.INFO.Printf("User: %s", user.ReceptionID)
 		writeContact(user.GetContact())
-		fmt.Printf("%s\n", user.TransmissionID)
+		fmt.Printf("%s\n", user.ReceptionID)
 	},
 }
 
diff --git a/cmd/root.go b/cmd/root.go
index 656ac527f..7fcc9a5b0 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -49,7 +49,7 @@ var rootCmd = &cobra.Command{
 		client := initClient()
 
 		user := client.GetUser()
-		jww.INFO.Printf("User: %s", user.TransmissionID)
+		jww.INFO.Printf("User: %s", user.ReceptionID)
 		writeContact(user.GetContact())
 
 		// Set up reception handler
diff --git a/cmd/ud.go b/cmd/ud.go
index c5c59666f..c267a68ed 100644
--- a/cmd/ud.go
+++ b/cmd/ud.go
@@ -34,7 +34,7 @@ var udCmd = &cobra.Command{
 	Run: func(cmd *cobra.Command, args []string) {
 		client := initClient()
 		user := client.GetUser()
-		jww.INFO.Printf("User: %s", user.TransmissionID)
+		jww.INFO.Printf("User: %s", user.ReceptionID)
 		writeContact(user.GetContact())
 
 		// Set up reception handler
diff --git a/network/manager.go b/network/manager.go
index d10622db5..39718e6d3 100644
--- a/network/manager.go
+++ b/network/manager.go
@@ -77,7 +77,7 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard,
 		Health:           health.Init(instance, params.NetworkHealthTimeout),
 		NodeRegistration: make(chan network.NodeGateway, params.RegNodesBufferLen),
 		Instance:         instance,
-		Uid:              session.User().GetCryptographicIdentity().GetReceptionID(),
+		Uid:              session.User().GetCryptographicIdentity().GetTransmissionID(),
 	}
 
 	//create sub managers
diff --git a/ud/addFact.go b/ud/addFact.go
index 6b2cd3b43..41d3e8451 100644
--- a/ud/addFact.go
+++ b/ud/addFact.go
@@ -26,7 +26,7 @@ type addFactComms interface {
 // called along with the code to finalize the fact.
 func (m *Manager) SendRegisterFact(fact fact.Fact) (string, error) {
 	jww.INFO.Printf("ud.SendRegisterFact(%s)", fact.Stringify())
-	uid := m.storage.User().GetCryptographicIdentity().GetTransmissionID()
+	uid := m.storage.User().GetCryptographicIdentity().GetReceptionID()
 	return m.addFact(fact, uid, m.comms)
 }
 
diff --git a/ud/manager.go b/ud/manager.go
index eabb0750f..d0a3ba4a3 100644
--- a/ud/manager.go
+++ b/ud/manager.go
@@ -92,7 +92,7 @@ func NewManager(client *api.Client) (*Manager, error) {
 	}
 
 	//get the commonly used data from storage
-	m.privKey = m.storage.GetUser().TransmissionRSA
+	m.privKey = m.storage.GetUser().ReceptionRSA
 
 	//load the last used commID
 	m.loadCommID()
diff --git a/ud/register.go b/ud/register.go
index c54e768ec..c280ce58d 100644
--- a/ud/register.go
+++ b/ud/register.go
@@ -41,19 +41,19 @@ func (m *Manager) register(username string, comm registerUserComms) error {
 
 	// Construct the user registration message
 	msg := &pb.UDBUserRegistration{
-		PermissioningSignature: user.GetTransmissionRegistrationValidationSignature(),
-		RSAPublicPem:           string(rsa.CreatePublicKeyPem(cryptoUser.GetTransmissionRSA().GetPublic())),
+		PermissioningSignature: user.GetReceptionRegistrationValidationSignature(),
+		RSAPublicPem:           string(rsa.CreatePublicKeyPem(cryptoUser.GetReceptionRSA().GetPublic())),
 		IdentityRegistration: &pb.Identity{
 			Username: username,
 			DhPubKey: m.storage.E2e().GetDHPublicKey().Bytes(),
-			Salt:     cryptoUser.GetTransmissionSalt(),
+			Salt:     cryptoUser.GetReceptionSalt(),
 		},
-		UID: cryptoUser.GetTransmissionID().Marshal(),
+		UID: cryptoUser.GetReceptionID().Marshal(),
 	}
 
 	// Sign the identity data and add to user registration message
 	identityDigest := msg.IdentityRegistration.Digest()
-	msg.IdentitySignature, err = rsa.Sign(rng, cryptoUser.GetTransmissionRSA(),
+	msg.IdentitySignature, err = rsa.Sign(rng, cryptoUser.GetReceptionRSA(),
 		hash.CMixHash, identityDigest, nil)
 	if err != nil {
 		return errors.Errorf("Failed to sign user's IdentityRegistration: %+v", err)
@@ -67,11 +67,11 @@ func (m *Manager) register(username string, comm registerUserComms) error {
 
 	// Hash and sign fact
 	hashedFact := factID.Fingerprint(usernameFact)
-	signedFact, err := rsa.Sign(rng, cryptoUser.GetTransmissionRSA(), hash.CMixHash, hashedFact, nil)
+	signedFact, err := rsa.Sign(rng, cryptoUser.GetReceptionRSA(), hash.CMixHash, hashedFact, nil)
 
 	// Add username fact register request to the user registration message
 	msg.Frs = &pb.FactRegisterRequest{
-		UID: cryptoUser.GetTransmissionID().Marshal(),
+		UID: cryptoUser.GetReceptionID().Marshal(),
 		Fact: &pb.Fact{
 			Fact:     username,
 			FactType: 0,
-- 
GitLab