From 5fa0c47a6fe811f2939cf386ec3c5ab33c20f999 Mon Sep 17 00:00:00 2001
From: "Richard T. Carback III" <rick.carback@gmail.com>
Date: Tue, 19 Dec 2023 23:47:17 +0000
Subject: [PATCH] Cleanup the command line for dm so it properly reports self.
 The latest libs now only require you to check the senderKey to determine if
 the message if self-sent

---
 cmd/dm.go | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/cmd/dm.go b/cmd/dm.go
index 3d73b9b96..3ddfe8b74 100644
--- a/cmd/dm.go
+++ b/cmd/dm.go
@@ -10,8 +10,8 @@
 package cmd
 
 import (
-	"bytes"
 	"crypto/ed25519"
+	"crypto/hmac"
 	"encoding/base64"
 	"fmt"
 	"sync"
@@ -154,13 +154,9 @@ var dmCmd = &cobra.Command{
 			case m := <-recvCh:
 				msg := myReceiver.msgData[m]
 				selfStr := "Partner"
-				if dmID.GetDMToken() == msg.dmToken {
+				if hmac.Equal(msg.senderKey[:],
+					dmID.PubKey[:]) {
 					selfStr = "Self"
-					if !bytes.Equal(dmID.PubKey[:],
-						msg.partnerKey[:]) {
-						jww.FATAL.Panicf(
-							"pubkey mismatch!\n")
-					}
 				}
 				fmt.Printf("Message received (%s, %s): %s\n",
 					selfStr, msg.mType, msg.content)
@@ -352,4 +348,4 @@ func (r *receiver) GetConversation(ed25519.PublicKey) *dm.ModelConversation {
 
 func (r *receiver) GetConversations() []dm.ModelConversation {
 	return nil
-}
\ No newline at end of file
+}
-- 
GitLab