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

Print the state of the sentrequest when saved/loaded

parent 0d7c1df7
No related branches found
No related tags found
1 merge request!23Release
...@@ -8,8 +8,10 @@ ...@@ -8,8 +8,10 @@
package auth package auth
import ( import (
"encoding/hex"
"encoding/json" "encoding/json"
"github.com/pkg/errors" "github.com/pkg/errors"
jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/storage/versioned" "gitlab.com/elixxir/client/storage/versioned"
"gitlab.com/elixxir/crypto/cyclic" "gitlab.com/elixxir/crypto/cyclic"
"gitlab.com/elixxir/primitives/format" "gitlab.com/elixxir/primitives/format"
...@@ -51,8 +53,8 @@ func loadSentRequest(kv *versioned.KV, partner *id.ID, grp *cyclic.Group) (*Sent ...@@ -51,8 +53,8 @@ func loadSentRequest(kv *versioned.KV, partner *id.ID, grp *cyclic.Group) (*Sent
"SentRequest Auth with %s", partner) "SentRequest Auth with %s", partner)
} }
historicalPrivKey := grp.NewInt(1) historicalPubKey := grp.NewInt(1)
if err = historicalPrivKey.GobDecode(srd.PartnerHistoricalPubKey); err != nil { if err = historicalPubKey.GobDecode(srd.PartnerHistoricalPubKey); err != nil {
return nil, errors.WithMessagef(err, "Failed to decode historical "+ return nil, errors.WithMessagef(err, "Failed to decode historical "+
"private key with %s for SentRequest Auth", partner) "private key with %s for SentRequest Auth", partner)
} }
...@@ -72,10 +74,21 @@ func loadSentRequest(kv *versioned.KV, partner *id.ID, grp *cyclic.Group) (*Sent ...@@ -72,10 +74,21 @@ func loadSentRequest(kv *versioned.KV, partner *id.ID, grp *cyclic.Group) (*Sent
fp := format.Fingerprint{} fp := format.Fingerprint{}
copy(fp[:], srd.Fingerprint) copy(fp[:], srd.Fingerprint)
jww.INFO.Printf("loadSentRequest partner: %s",
hex.EncodeToString(partner[:]))
jww.INFO.Printf("loadSentRequest historicalPubKey: %s",
hex.EncodeToString(historicalPubKey.Bytes()))
jww.INFO.Printf("loadSentRequest myPrivKey: %s",
hex.EncodeToString(myPrivKey.Bytes()))
jww.INFO.Printf("loadSentRequest myPubKey: %s",
hex.EncodeToString(myPubKey.Bytes()))
jww.INFO.Printf("loadSentRequest fingerprint: %s",
hex.EncodeToString(fp[:]))
return &SentRequest{ return &SentRequest{
kv: kv, kv: kv,
partner: partner, partner: partner,
partnerHistoricalPubKey: historicalPrivKey, partnerHistoricalPubKey: historicalPubKey,
myPrivKey: myPrivKey, myPrivKey: myPrivKey,
myPubKey: myPubKey, myPubKey: myPubKey,
fingerprint: fp, fingerprint: fp,
...@@ -93,13 +106,24 @@ func (sr *SentRequest) save() error { ...@@ -93,13 +106,24 @@ func (sr *SentRequest) save() error {
return err return err
} }
historicalPrivKey, err := sr.partnerHistoricalPubKey.GobEncode() historicalPubKey, err := sr.partnerHistoricalPubKey.GobEncode()
if err != nil { if err != nil {
return err return err
} }
jww.INFO.Printf("saveSentRequest partner: %s",
hex.EncodeToString(sr.partner[:]))
jww.INFO.Printf("saveSentRequest historicalPubKey: %s",
hex.EncodeToString(sr.partnerHistoricalPubKey.Bytes()))
jww.INFO.Printf("saveSentRequest myPrivKey: %s",
hex.EncodeToString(sr.myPrivKey.Bytes()))
jww.INFO.Printf("saveSentRequest myPubKey: %s",
hex.EncodeToString(sr.myPubKey.Bytes()))
jww.INFO.Printf("saveSentRequest fingerprint: %s",
hex.EncodeToString(sr.fingerprint[:]))
ipd := sentRequestDisk{ ipd := sentRequestDisk{
PartnerHistoricalPubKey: historicalPrivKey, PartnerHistoricalPubKey: historicalPubKey,
MyPrivKey: privKey, MyPrivKey: privKey,
MyPubKey: pubKey, MyPubKey: pubKey,
Fingerprint: sr.fingerprint[:], Fingerprint: sr.fingerprint[:],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment