Skip to content
Snippets Groups Projects
Commit 5fa0c47a authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Cleanup the command line for dm so it properly reports self. The latest libs...

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
parent ff2e787f
No related branches found
No related tags found
No related merge requests found
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
package cmd package cmd
import ( import (
"bytes"
"crypto/ed25519" "crypto/ed25519"
"crypto/hmac"
"encoding/base64" "encoding/base64"
"fmt" "fmt"
"sync" "sync"
...@@ -154,13 +154,9 @@ var dmCmd = &cobra.Command{ ...@@ -154,13 +154,9 @@ var dmCmd = &cobra.Command{
case m := <-recvCh: case m := <-recvCh:
msg := myReceiver.msgData[m] msg := myReceiver.msgData[m]
selfStr := "Partner" selfStr := "Partner"
if dmID.GetDMToken() == msg.dmToken { if hmac.Equal(msg.senderKey[:],
dmID.PubKey[:]) {
selfStr = "Self" selfStr = "Self"
if !bytes.Equal(dmID.PubKey[:],
msg.partnerKey[:]) {
jww.FATAL.Panicf(
"pubkey mismatch!\n")
}
} }
fmt.Printf("Message received (%s, %s): %s\n", fmt.Printf("Message received (%s, %s): %s\n",
selfStr, msg.mType, msg.content) selfStr, msg.mType, msg.content)
...@@ -352,4 +348,4 @@ func (r *receiver) GetConversation(ed25519.PublicKey) *dm.ModelConversation { ...@@ -352,4 +348,4 @@ func (r *receiver) GetConversation(ed25519.PublicKey) *dm.ModelConversation {
func (r *receiver) GetConversations() []dm.ModelConversation { func (r *receiver) GetConversations() []dm.ModelConversation {
return nil return nil
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment