From b274f043924b73fc519d414d0545fb1b6c6c8ca8 Mon Sep 17 00:00:00 2001
From: Benjamin Wenger <ben@elixxir.ioo>
Date: Thu, 30 Sep 2021 15:13:55 -0700
Subject: [PATCH] printed single use keys on creation and on use to figure out
 why they are broken

---
 single/reception.go       |  3 +++
 single/transmission.go    |  3 +++
 single/transmitMessage.go | 10 ++++++++++
 3 files changed, 16 insertions(+)

diff --git a/single/reception.go b/single/reception.go
index 23ca6f8be..54a415afe 100644
--- a/single/reception.go
+++ b/single/reception.go
@@ -108,5 +108,8 @@ func (m *Manager) processTransmission(msg format.Message,
 	c := NewContact(payload.GetRID(transmitMsg.GetPubKey(grp)),
 		transmitMsg.GetPubKey(grp), dhKey, payload.GetTagFP(), payload.GetMaxParts())
 
+	jww.INFO.Printf("generated by singe use receiver reception id for single use: %s, " +
+		"ephId: %d, pubkey: %x, msg: %s", c.partner, "unknown:", transmitMsg.GetPubKey(grp), msg)
+
 	return payload.GetContents(), c, nil
 }
diff --git a/single/transmission.go b/single/transmission.go
index 25cd73276..b5375a2e1 100644
--- a/single/transmission.go
+++ b/single/transmission.go
@@ -289,5 +289,8 @@ func makeIDs(msg *transmitMessagePayload, publicKey *cyclic.Int,
 		jww.DEBUG.Printf("ephemeral.GetId(%s, %d, %d) = %d", rid, addressSize, timeNow.UnixNano(), ephID.Int64())
 	}
 
+	jww.INFO.Printf("generated by singe use sender reception id for single use: %s, " +
+		"ephId: %d, pubkey: %x, msg: %s", rid, ephID.Int64(), publicKey.Bytes(), msg)
+
 	return rid, ephID, nil
 }
diff --git a/single/transmitMessage.go b/single/transmitMessage.go
index 768c47e26..da7f88d94 100644
--- a/single/transmitMessage.go
+++ b/single/transmitMessage.go
@@ -9,6 +9,7 @@ package single
 
 import (
 	"encoding/binary"
+	"fmt"
 	"github.com/pkg/errors"
 	jww "github.com/spf13/jwalterweatherman"
 	"gitlab.com/elixxir/crypto/cyclic"
@@ -246,3 +247,12 @@ func (mp transmitMessagePayload) SetContents(contents []byte) {
 
 	copy(mp.contents, contents)
 }
+
+
+// String returns the contents for printing adhering to the stringer interface.
+func (mp transmitMessagePayload) String()string {
+	return fmt.Sprintf("Data: %x [tagFP: %x, nonce: %x, " +
+		"maxParts: %x, size: %x, content: %x]", mp.data, mp.tagFP,
+		mp.nonce, mp.maxParts, mp.size, mp.contents)
+
+}
-- 
GitLab