diff --git a/api/auth.go b/api/auth.go index d7a5cc362ea49dc9108e220d05c5fd45eeb5586f..550b6ebfa0965a7aa4345fd2318f5314c48acbc3 100644 --- a/api/auth.go +++ b/api/auth.go @@ -178,5 +178,5 @@ func (c *Client) GetRelationshipFingerprint(partner *id.ID) (string, error) { partner) } - return m.GetConnectionFingerprint(), nil + return m.ConnectionFingerprint(), nil } diff --git a/e2e/interface.go b/e2e/interface.go index f93897ec5c73457d21c16328fd2ee7d0677a8e77..43644636361a97c310f60ca0cf2ca1651fee1078 100644 --- a/e2e/interface.go +++ b/e2e/interface.go @@ -107,9 +107,7 @@ type Handler interface { // AddPartner adds a partner. Automatically creates both send // and receive sessions using the passed cryptographic data - // and per the parameters sent. If an alternate ID public key - // are to be used for this relationship, then pass them in, - // otherwise, leave myID and myPrivateKey nil + // and per the parameters sent AddPartner(partnerID *id.ID, partnerPubKey, myPrivKey *cyclic.Int, partnerSIDHPubKey *sidh.PublicKey, @@ -117,13 +115,11 @@ type Handler interface { receiveParams session.Params) (partner.Manager, error) // GetPartner returns the partner per its ID, if it exists - // myID is your ID in the relationship. If left blank, it will - // assume to be your defaultID + // myID is your ID in the relationship GetPartner(partnerID *id.ID) (partner.Manager, error) // DeletePartner removes the associated contact from the E2E store - // myID is your ID in the relationship. If left blank, it will - // assume to be your defaultID + // myID is your ID in the relationship DeletePartner(partnerId *id.ID) error // GetAllPartnerIDs returns a list of all partner IDs that the user has diff --git a/e2e/manager_test.go b/e2e/manager_test.go index 5367f9b3fd89dd7f562ada8fa2be9dbeb04b0999..54a04e1ec096c0106cc5711982c46eb0524ed8e3 100644 --- a/e2e/manager_test.go +++ b/e2e/manager_test.go @@ -124,16 +124,16 @@ func TestLoadLegacy(t *testing.T) { t.Errorf("Partner %d does not exist in handler.", legacyPartner.partnerId) } - if !bytes.Equal(partnerManager.GetSendRelationshipFingerprint(), legacyPartner.sendFP) { + if !bytes.Equal(partnerManager.SendRelationshipFingerprint(), legacyPartner.sendFP) { t.Fatalf("Send relationship fingerprint pulled from legacy does not match expected data."+ "\nExpected: %v"+ - "\nReceived: %v", legacyPartner.sendFP, partnerManager.GetSendRelationshipFingerprint()) + "\nReceived: %v", legacyPartner.sendFP, partnerManager.SendRelationshipFingerprint()) } - if !bytes.Equal(partnerManager.GetReceiveRelationshipFingerprint(), legacyPartner.recieveFp) { + if !bytes.Equal(partnerManager.ReceiveRelationshipFingerprint(), legacyPartner.recieveFp) { t.Fatalf("Receive relationship fingerprint pulled from legacy does not match expected data."+ "\nExpected: %v"+ - "\nReceived: %v", legacyPartner.sendFP, partnerManager.GetSendRelationshipFingerprint()) + "\nReceived: %v", legacyPartner.sendFP, partnerManager.SendRelationshipFingerprint()) } } diff --git a/e2e/ratchet/partner/interface.go b/e2e/ratchet/partner/interface.go index ed3cad56a66d3a458264a06b2c178e3e72bb5d20..02315b1ff7e4f63845f79a9feee3bd8668e79656 100644 --- a/e2e/ratchet/partner/interface.go +++ b/e2e/ratchet/partner/interface.go @@ -11,24 +11,22 @@ import ( // Manager create and manages both E2E send and receive sessions using the passed cryptographic data type Manager interface { - // GetPartnerID returns the ID of the E2E partner - GetPartnerID() *id.ID - // GetMyID returns my ID used for the E2E relationship - GetMyID() *id.ID - // GetMyOriginPrivateKey returns my private key - GetMyOriginPrivateKey() *cyclic.Int - // GetPartnerOriginPublicKey returns the partner's public key - GetPartnerOriginPublicKey() *cyclic.Int - // GetSendRelationshipFingerprint returns the fingerprint of the send session - GetSendRelationshipFingerprint() []byte - // GetReceiveRelationshipFingerprint returns the fingerprint of the receive session - GetReceiveRelationshipFingerprint() []byte - // GetConnectionFingerprintBytes returns a unique fingerprint for an E2E relationship in bytes format - GetConnectionFingerprintBytes() []byte - // GetConnectionFingerprint returns a unique fingerprint for an E2E relationship in string format - GetConnectionFingerprint() string - // GetContact returns the contact of the E2E partner - GetContact() contact.Contact + // PartnerId returns the ID of the E2E partner + PartnerId() *id.ID + // MyId returns my ID used for the E2E relationship + MyId() *id.ID + // MyRootPrivateKey returns first private key in the DAG + MyRootPrivateKey() *cyclic.Int + // PartnerRootPublicKey returns the partner's first public key in the DAG + PartnerRootPublicKey() *cyclic.Int + // SendRelationshipFingerprint returns the fingerprint of the send session + SendRelationshipFingerprint() []byte + // ReceiveRelationshipFingerprint returns the fingerprint of the receive session + ReceiveRelationshipFingerprint() []byte + // ConnectionFingerprint returns a unique fingerprint for an E2E relationship in string format + ConnectionFingerprint() ConnectionFp + // Contact returns the contact of the E2E partner + Contact() contact.Contact // PopSendCypher returns the key which is most likely to be successful for sending PopSendCypher() (*session.Cypher, error) diff --git a/e2e/ratchet/partner/manager.go b/e2e/ratchet/partner/manager.go index 93ddb6de693d7865578a9168f37183cf3794afd9..fbb33af91e1cb1b00508cb471422a41e925d46dd 100644 --- a/e2e/ratchet/partner/manager.go +++ b/e2e/ratchet/partner/manager.go @@ -8,9 +8,9 @@ package partner import ( - "bytes" "encoding/base64" "fmt" + "gitlab.com/elixxir/crypto/e2e" "github.com/cloudflare/circl/dh/sidh" "github.com/pkg/errors" @@ -23,12 +23,12 @@ import ( "gitlab.com/elixxir/crypto/cyclic" "gitlab.com/elixxir/crypto/fastRNG" "gitlab.com/xx_network/primitives/id" - "golang.org/x/crypto/blake2b" ) const managerPrefix = "Manager{partner:%s}" const originMyPrivKeyKey = "originMyPrivKey" const originPartnerPubKey = "originPartnerPubKey" +const relationshipFpLength = 15 // Implements the partner.Manager interface type manager struct { @@ -94,6 +94,21 @@ func NewManager(kv *versioned.KV, myID, partnerID *id.ID, myPrivKey, return m } +// ConnectionFp represents a Partner connection fingerprint +type ConnectionFp struct { + fingerprint []byte +} + +func (c ConnectionFp) Bytes() []byte { + return c.fingerprint +} + +func (c ConnectionFp) String() string { + // Base 64 encode hash and truncate + return base64.StdEncoding.EncodeToString( + c.fingerprint)[:relationshipFpLength] +} + //LoadManager loads a relationship and all buffers and sessions from disk func LoadManager(kv *versioned.KV, myID, partnerID *id.ID, cyHandler session.CypherHandler, grp *cyclic.Group, @@ -243,13 +258,13 @@ func (m *manager) PopRekeyCypher() (*session.Cypher, error) { } -// GetPartnerID returns a copy of the ID of the partner. -func (m *manager) GetPartnerID() *id.ID { +// PartnerId returns a copy of the ID of the partner. +func (m *manager) PartnerId() *id.ID { return m.partner.DeepCopy() } -// GetMyID returns a copy of the ID used as self. -func (m *manager) GetMyID() *id.ID { +// MyId returns a copy of the ID used as self. +func (m *manager) MyId() *id.ID { return m.myID.DeepCopy() } @@ -265,13 +280,13 @@ func (m *manager) GetReceiveSession(sid session.SessionID) *session.Session { return m.receive.GetByID(sid) } -// GetSendRelationshipFingerprint -func (m *manager) GetSendRelationshipFingerprint() []byte { +// SendRelationshipFingerprint +func (m *manager) SendRelationshipFingerprint() []byte { return m.send.fingerprint } -// GetReceiveRelationshipFingerprint -func (m *manager) GetReceiveRelationshipFingerprint() []byte { +// ReceiveRelationshipFingerprint +func (m *manager) ReceiveRelationshipFingerprint() []byte { return m.receive.fingerprint } @@ -285,46 +300,18 @@ func (m *manager) TriggerNegotiations() []*session.Session { return m.send.TriggerNegotiation() } -func (m *manager) GetMyOriginPrivateKey() *cyclic.Int { +func (m *manager) MyRootPrivateKey() *cyclic.Int { return m.originMyPrivKey.DeepCopy() } -func (m *manager) GetPartnerOriginPublicKey() *cyclic.Int { +func (m *manager) PartnerRootPublicKey() *cyclic.Int { return m.originPartnerPubKey.DeepCopy() } -const relationshipFpLength = 15 - -// GetConnectionFingerprint returns a unique fingerprint for an E2E -// relationship. The fingerprint is a base 64 encoded hash of the two -// relationship fingerprints truncated to 15 characters. -func (m *manager) GetConnectionFingerprint() string { - - // Base 64 encode hash and truncate - return base64.StdEncoding.EncodeToString( - m.GetConnectionFingerprintBytes())[:relationshipFpLength] -} - -// GetConnectionFingerprintBytes returns a unique fingerprint for an E2E +// ConnectionFingerprint returns a unique fingerprint for an E2E // relationship used for the e2e preimage. -func (m *manager) GetConnectionFingerprintBytes() []byte { - // Sort fingerprints - var fps [][]byte - - if bytes.Compare(m.receive.fingerprint, m.send.fingerprint) == 1 { - fps = [][]byte{m.send.fingerprint, m.receive.fingerprint} - } else { - fps = [][]byte{m.receive.fingerprint, m.send.fingerprint} - } - - // Hash fingerprints - h, _ := blake2b.New256(nil) - for _, fp := range fps { - h.Write(fp) - } - - // Base 64 encode hash and truncate - return h.Sum(nil) +func (m *manager) ConnectionFingerprint() ConnectionFp { + return ConnectionFp{fingerprint: e2e.GenerateConnectionFingerprint(m.send.fingerprint, m.receive.fingerprint)} } // MakeService Returns a service interface with the @@ -332,19 +319,18 @@ func (m *manager) GetConnectionFingerprintBytes() []byte { // the metadata with the partner func (m *manager) MakeService(tag string) message.Service { return message.Service{ - Identifier: m.GetConnectionFingerprintBytes(), + Identifier: m.ConnectionFingerprint().Bytes(), Tag: tag, Metadata: m.partner[:], } } -// GetContact assembles and returns a contact.Contact with the partner's ID -// and DH key. -func (m *manager) GetContact() contact.Contact { +// Contact assembles and returns a contact.Contact with the partner's ID and DH key. +func (m *manager) Contact() contact.Contact { // Assemble Contact return contact.Contact{ - ID: m.GetPartnerID(), - DhPubKey: m.GetPartnerOriginPublicKey(), + ID: m.PartnerId(), + DhPubKey: m.PartnerRootPublicKey(), } } diff --git a/e2e/ratchet/partner/manager_test.go b/e2e/ratchet/partner/manager_test.go index 944121e069191ebd0946df8e33548f32fb7e64fa..ae428301bc3400db91cd1a8d5df0b800a92543cc 100644 --- a/e2e/ratchet/partner/manager_test.go +++ b/e2e/ratchet/partner/manager_test.go @@ -243,10 +243,10 @@ func TestManager_GetKeyForSending_Error(t *testing.T) { func TestManager_GetPartnerID(t *testing.T) { m, _ := newTestManager(t) - pid := m.GetPartnerID() + pid := m.PartnerId() if !m.partner.Cmp(pid) { - t.Errorf("GetPartnerID() returned incorrect partner ID."+ + t.Errorf("PartnerId() returned incorrect partner ID."+ "\n\texpected: %s\n\treceived: %s", m.partner, pid) } } @@ -257,10 +257,10 @@ func TestManager_GetMyID(t *testing.T) { m := &manager{myID: myId} - receivedMyId := m.GetMyID() + receivedMyId := m.MyId() if !myId.Cmp(receivedMyId) { - t.Errorf("GetMyID() returned incorrect partner ID."+ + t.Errorf("MyId() returned incorrect partner ID."+ "\n\texpected: %s\n\treceived: %s", myId, receivedMyId) } } @@ -345,18 +345,18 @@ func TestManager_GetRelationshipFingerprint(t *testing.T) { h.Write(append(m.receive.fingerprint, m.send.fingerprint...)) expected := base64.StdEncoding.EncodeToString(h.Sum(nil))[:relationshipFpLength] - fp := m.GetConnectionFingerprint() + fp := m.ConnectionFingerprint() if fp != expected { - t.Errorf("GetConnectionFingerprint did not return the expected "+ + t.Errorf("ConnectionFingerprint did not return the expected "+ "fingerprint.\nexpected: %s\nreceived: %s", expected, fp) } // Flip the order and show that the output is the same. m.receive.fingerprint, m.send.fingerprint = m.send.fingerprint, m.receive.fingerprint - fp = m.GetConnectionFingerprint() + fp = m.ConnectionFingerprint() if fp != expected { - t.Errorf("GetConnectionFingerprint did not return the expected "+ + t.Errorf("ConnectionFingerprint did not return the expected "+ "fingerprint.\nexpected: %s\nreceived: %s", expected, fp) } } @@ -379,18 +379,18 @@ func TestManager_GetRelationshipFingerprint_Consistency(t *testing.T) { prng.Read(m.receive.fingerprint) prng.Read(m.send.fingerprint) - fp := m.GetConnectionFingerprint() + fp := m.ConnectionFingerprint() if fp != expected { - t.Errorf("GetConnectionFingerprint did not return the expected "+ + t.Errorf("ConnectionFingerprint did not return the expected "+ "fingerprint (%d).\nexpected: %s\nreceived: %s", i, expected, fp) } // Flip the order and show that the output is the same. m.receive.fingerprint, m.send.fingerprint = m.send.fingerprint, m.receive.fingerprint - fp = m.GetConnectionFingerprint() + fp = m.ConnectionFingerprint() if fp != expected { - t.Errorf("GetConnectionFingerprint did not return the expected "+ + t.Errorf("ConnectionFingerprint did not return the expected "+ "fingerprint (%d).\nexpected: %s\nreceived: %s", i, expected, fp) } @@ -402,7 +402,7 @@ func TestManager_MakeService(t *testing.T) { m, _ := newTestManager(t) tag := "hunter2" expected := message.Service{ - Identifier: m.GetConnectionFingerprintBytes(), + Identifier: m.ConnectionFingerprintBytes(), Tag: tag, Metadata: m.partner[:], } diff --git a/e2e/ratchet/partner/utils.go b/e2e/ratchet/partner/utils.go index 55a25ab9b2f9da82f655eed4dcf85b2331fffa9a..656a847fc5d5324e8b3181be9385c908a14338fa 100644 --- a/e2e/ratchet/partner/utils.go +++ b/e2e/ratchet/partner/utils.go @@ -36,39 +36,39 @@ func NewTestManager(partnerId *id.ID, partnerPubKey, myPrivKey *cyclic.Int, t *t return &testManager{partnerId: partnerId, partnerPubKey: partnerPubKey, myPrivKey: myPrivKey} } -func (p *testManager) GetPartnerID() *id.ID { +func (p *testManager) PartnerId() *id.ID { return p.partnerId } -func (p *testManager) GetMyID() *id.ID { +func (p *testManager) MyId() *id.ID { panic("implement me") } -func (p *testManager) GetMyOriginPrivateKey() *cyclic.Int { +func (p *testManager) MyRootPrivateKey() *cyclic.Int { return p.myPrivKey } -func (p *testManager) GetPartnerOriginPublicKey() *cyclic.Int { +func (p *testManager) PartnerRootPublicKey() *cyclic.Int { return p.partnerPubKey } -func (p *testManager) GetSendRelationshipFingerprint() []byte { +func (p *testManager) SendRelationshipFingerprint() []byte { panic("implement me") } -func (p *testManager) GetReceiveRelationshipFingerprint() []byte { +func (p *testManager) ReceiveRelationshipFingerprint() []byte { panic("implement me") } -func (p *testManager) GetConnectionFingerprintBytes() []byte { +func (p *testManager) ConnectionFingerprintBytes() []byte { panic("implement me") } -func (p *testManager) GetConnectionFingerprint() string { +func (p *testManager) ConnectionFingerprint() string { panic("implement me") } -func (p *testManager) GetContact() contact.Contact { +func (p *testManager) Contact() contact.Contact { panic("implement me") } diff --git a/e2e/ratchet/ratchet.go b/e2e/ratchet/ratchet.go index 3bc73f3b953bb3b3b1f83037049335803ccc5340..92ff4ba4250d23138c5559bd90cc4e5a584080ce 100644 --- a/e2e/ratchet/ratchet.go +++ b/e2e/ratchet/ratchet.go @@ -175,7 +175,7 @@ func (r *Ratchet) GetAllPartnerIDs() []*id.ID { partnerIDs := make([]*id.ID, 0, len(r.managers)) for _, m := range r.managers { - partnerIDs = append(partnerIDs, m.GetPartnerID()) + partnerIDs = append(partnerIDs, m.PartnerId()) } return partnerIDs diff --git a/e2e/ratchet/storage.go b/e2e/ratchet/storage.go index 5ffea5fa63b6f9fcd685be70a8baae5feac592a3..cd285816f3fb055ac6d2fe3d98b13402bf73e62a 100644 --- a/e2e/ratchet/storage.go +++ b/e2e/ratchet/storage.go @@ -87,7 +87,7 @@ func (r *Ratchet) marshal() ([]byte, error) { contacts := make([]id.ID, len(r.managers)) index := 0 - for rid, _ := range r.managers { + for rid := range r.managers { contacts[index] = rid index++ } @@ -118,10 +118,10 @@ func (r *Ratchet) unmarshal(b []byte) error { " %s: %s", partnerID, err.Error()) } - if !manager.GetPartnerID().Cmp(partnerID) { + if !manager.PartnerId().Cmp(partnerID) { jww.FATAL.Panicf("Loaded manager with the wrong "+ "partner ID: \n\t loaded: %s \n\t present: %s", - partnerID, manager.GetPartnerID()) + partnerID, manager.PartnerId()) } //add services for the manager diff --git a/e2e/ratchet/utils_test.go b/e2e/ratchet/utils_test.go index c3497872084493d7e5c8e6dc65997365ad191c3b..02c9ed79297487e013c72174aea994d2840ccb3e 100644 --- a/e2e/ratchet/utils_test.go +++ b/e2e/ratchet/utils_test.go @@ -45,37 +45,37 @@ func makeTestRatchet() (*Ratchet, *versioned.KV, error) { func managersEqual(expected, received partner.Manager, t *testing.T) bool { equal := true - if !reflect.DeepEqual(expected.GetPartnerID(), received.GetPartnerID()) { + if !reflect.DeepEqual(expected.PartnerId(), received.PartnerId()) { t.Errorf("Did not Receive expected Manager.partnerID."+ "\n\texpected: %+v\n\treceived: %+v", - expected.GetPartnerID(), received.GetPartnerID()) + expected.PartnerId(), received.PartnerId()) equal = false } - if !strings.EqualFold(expected.GetConnectionFingerprint(), received.GetConnectionFingerprint()) { + if !strings.EqualFold(expected.ConnectionFingerprint(), received.ConnectionFingerprint()) { t.Errorf("Did not Receive expected Manager.Receive."+ "\n\texpected: %+v\n\treceived: %+v", - expected.GetConnectionFingerprint(), received.GetConnectionFingerprint()) + expected.ConnectionFingerprint(), received.ConnectionFingerprint()) equal = false } - if !reflect.DeepEqual(expected.GetMyID(), received.GetMyID()) { + if !reflect.DeepEqual(expected.MyId(), received.MyId()) { t.Errorf("Did not Receive expected Manager.myId."+ "\n\texpected: %+v\n\treceived: %+v", - expected.GetMyID(), received.GetPartnerID()) + expected.MyId(), received.PartnerId()) equal = false } - if !reflect.DeepEqual(expected.GetMyOriginPrivateKey(), received.GetMyOriginPrivateKey()) { + if !reflect.DeepEqual(expected.MyRootPrivateKey(), received.MyRootPrivateKey()) { t.Errorf("Did not Receive expected Manager.MyPrivateKey."+ "\n\texpected: %+v\n\treceived: %+v", - expected.GetMyOriginPrivateKey(), received.GetMyOriginPrivateKey()) + expected.MyRootPrivateKey(), received.MyRootPrivateKey()) equal = false } - if !reflect.DeepEqual(expected.GetSendRelationshipFingerprint(), received.GetSendRelationshipFingerprint()) { + if !reflect.DeepEqual(expected.SendRelationshipFingerprint(), received.SendRelationshipFingerprint()) { t.Errorf("Did not Receive expected Manager.SendRelationshipFingerprint."+ "\n\texpected: %+v\n\treceived: %+v", - expected.GetSendRelationshipFingerprint(), received.GetSendRelationshipFingerprint()) + expected.SendRelationshipFingerprint(), received.SendRelationshipFingerprint()) equal = false } diff --git a/e2e/rekey/confirm.go b/e2e/rekey/confirm.go index a7094d9254ed15390d66ce0542109169341019d3..b6ae0a6ddaec07fa19dab7b8e86a0d374ad27b50 100644 --- a/e2e/rekey/confirm.go +++ b/e2e/rekey/confirm.go @@ -74,11 +74,11 @@ func handleConfirm(ratchet *ratchet.Ratchet, confirmation receive.Message) { jww.WARN.Printf("[REKEY] Failed to set the negotiation status for the "+ "confirmation of session %s from partner %s. This is expected in "+ "some edge cases but could be a sign of an issue if it persists: %s", - confirmedSession, partner.GetPartnerID(), err) + confirmedSession, partner.PartnerId(), err) } jww.DEBUG.Printf("[REKEY] handled confirmation for session "+ - "%s from partner %s.", confirmedSession, partner.GetPartnerID()) + "%s from partner %s.", confirmedSession, partner.PartnerId()) } func unmarshalConfirm(payload []byte) (session2.SessionID, error) { diff --git a/e2e/rekey/utils_test.go b/e2e/rekey/utils_test.go index 706d4b7bc19371cb771a845829bf507074e3b489..c7296ecd26fe92a207e39cf43140805c4af6710c 100644 --- a/e2e/rekey/utils_test.go +++ b/e2e/rekey/utils_test.go @@ -17,9 +17,9 @@ import ( "gitlab.com/elixxir/client/catalog" "gitlab.com/elixxir/client/cmix" "gitlab.com/elixxir/client/cmix/gateway" - "gitlab.com/elixxir/client/cmix/rounds" "gitlab.com/elixxir/client/cmix/identity" "gitlab.com/elixxir/client/cmix/message" + "gitlab.com/elixxir/client/cmix/rounds" session2 "gitlab.com/elixxir/client/e2e/ratchet/partner/session" "gitlab.com/elixxir/client/e2e/receive" "gitlab.com/elixxir/client/stoppable" @@ -84,8 +84,8 @@ func testSendE2E(mt catalog.MessageType, recipient *id.ID, print(err) } - alicePrivKey := alicePartner.GetMyOriginPrivateKey() - bobPubKey := bobPartner.GetMyOriginPrivateKey() + alicePrivKey := alicePartner.MyRootPrivateKey() + bobPubKey := bobPartner.MyRootPrivateKey() grp := getGroup() aliceSIDHPrivKey, bobSIDHPubKey, _, _ := genSidhKeys() diff --git a/e2e/sendE2E.go b/e2e/sendE2E.go index 1a3c8b8850f98568d00316278b8e4e7b08de0d62..0dcd4acdc4977b2ef8c4e0c42d3d2cb9a22e438d 100644 --- a/e2e/sendE2E.go +++ b/e2e/sendE2E.go @@ -73,7 +73,7 @@ func (m *manager) sendE2E(mt catalog.MessageType, recipient *id.ID, return nil, e2e.MessageID{}, time.Time{}, err } - msgID := e2e.NewMessageID(partner.GetSendRelationshipFingerprint(), + msgID := e2e.NewMessageID(partner.SendRelationshipFingerprint(), internalMsgId) wg := sync.WaitGroup{} diff --git a/go.mod b/go.mod index 2ba64aa4a329a8c7860a112d2abe02ee77bbcca2..f10455acd0d08d2b1332403f8e99c3749651bbee 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/spf13/viper v1.7.1 gitlab.com/elixxir/bloomfilter v0.0.0-20200930191214-10e9ac31b228 gitlab.com/elixxir/comms v0.0.4-0.20220323190139-9ed75f3a8b2c - gitlab.com/elixxir/crypto v0.0.7-0.20220414225314-6f3eb9c073a5 + gitlab.com/elixxir/crypto v0.0.7-0.20220415172207-7de5e3cdb340 gitlab.com/elixxir/ekv v0.1.6 gitlab.com/elixxir/primitives v0.0.3-0.20220330212736-cce83b5f948f gitlab.com/xx_network/comms v0.0.4-0.20220315161313-76acb14429ac diff --git a/go.sum b/go.sum index b6657d08aa719b8928c71dcb0e2f9989b0ab3225..118b83d50d196d88162a2a23c234279b524f3fdc 100644 --- a/go.sum +++ b/go.sum @@ -283,6 +283,7 @@ gitlab.com/elixxir/crypto v0.0.3/go.mod h1:ZNgBOblhYToR4m8tj4cMvJ9UsJAUKq+p0gCp0 gitlab.com/elixxir/crypto v0.0.7-0.20220222221347-95c7ae58da6b/go.mod h1:tD6XjtQh87T2nKZL5I/pYPck5M2wLpkZ1Oz7H/LqO10= gitlab.com/elixxir/crypto v0.0.7-0.20220309234716-1ba339865787 h1:+qmsWov412+Yn7AKUhTbOcDgAydNXlNLPmFpO2W5LwY= gitlab.com/elixxir/crypto v0.0.7-0.20220309234716-1ba339865787/go.mod h1:tD6XjtQh87T2nKZL5I/pYPck5M2wLpkZ1Oz7H/LqO10= +gitlab.com/elixxir/crypto v0.0.7-0.20220317172048-3de167bd9406/go.mod h1:tD6XjtQh87T2nKZL5I/pYPck5M2wLpkZ1Oz7H/LqO10= gitlab.com/elixxir/crypto v0.0.7-0.20220325215559-7489d68d7714 h1:epnov8zyFWod14MUNtGHSbZCVSkZjN4NvoiBs1TgEV8= gitlab.com/elixxir/crypto v0.0.7-0.20220325215559-7489d68d7714/go.mod h1:tD6XjtQh87T2nKZL5I/pYPck5M2wLpkZ1Oz7H/LqO10= gitlab.com/elixxir/crypto v0.0.7-0.20220325224306-705ce59288bb h1:WdlmG+KPaM2Pjo1EFiFFPYEVSMV64Di1CitQnXGWBOQ= @@ -297,8 +298,12 @@ gitlab.com/elixxir/crypto v0.0.7-0.20220331001626-1829e71edf56 h1:1HJHlRwh3dDbvw gitlab.com/elixxir/crypto v0.0.7-0.20220331001626-1829e71edf56/go.mod h1:JkByWX/TXCjdu6pRJsx+jwttbBGvlAljYSJMImDmt+4= gitlab.com/elixxir/crypto v0.0.7-0.20220406193349-d25222ea3c6e h1:P+E0+AdevTNWBdqf4+covcmTrRfe6rKPLtevFrjbKQA= gitlab.com/elixxir/crypto v0.0.7-0.20220406193349-d25222ea3c6e/go.mod h1:JkByWX/TXCjdu6pRJsx+jwttbBGvlAljYSJMImDmt+4= +gitlab.com/elixxir/crypto v0.0.7-0.20220414175442-6d2304df43d7 h1:xEE795GeUyQaa4lRAI8IjyH31glm2OvFgzY9eiMEr1M= +gitlab.com/elixxir/crypto v0.0.7-0.20220414175442-6d2304df43d7/go.mod h1:JkByWX/TXCjdu6pRJsx+jwttbBGvlAljYSJMImDmt+4= gitlab.com/elixxir/crypto v0.0.7-0.20220414225314-6f3eb9c073a5 h1:yw3G8ZEiWu2eSZWRQmj6nBhiJIYK3Cw2MJzDPkNHYVA= gitlab.com/elixxir/crypto v0.0.7-0.20220414225314-6f3eb9c073a5/go.mod h1:tD6XjtQh87T2nKZL5I/pYPck5M2wLpkZ1Oz7H/LqO10= +gitlab.com/elixxir/crypto v0.0.7-0.20220415172207-7de5e3cdb340 h1:f1JsT60cKFXcHPoaOD1ohIOA22FQd42vbKjF9wrKfNs= +gitlab.com/elixxir/crypto v0.0.7-0.20220415172207-7de5e3cdb340/go.mod h1:JkByWX/TXCjdu6pRJsx+jwttbBGvlAljYSJMImDmt+4= gitlab.com/elixxir/ekv v0.1.6 h1:M2hUSNhH/ChxDd+s8xBqSEKgoPtmE6hOEBqQ73KbN6A= gitlab.com/elixxir/ekv v0.1.6/go.mod h1:e6WPUt97taFZe5PFLPb1Dupk7tqmDCTQu1kkstqJvw4= gitlab.com/elixxir/primitives v0.0.0-20200731184040-494269b53b4d/go.mod h1:OQgUZq7SjnE0b+8+iIAT2eqQF+2IFHn73tOo+aV11mg= diff --git a/groupChat/makeGroup.go b/groupChat/makeGroup.go index cc0d22da3119d16a05b7f5dade00cc928ff1cf58..32be2b8318562da54cf0841cdda018aa411db58d 100644 --- a/groupChat/makeGroup.go +++ b/groupChat/makeGroup.go @@ -119,13 +119,13 @@ func (m Manager) buildMembership(members []*id.ID) (group.Membership, } contacts[i] = contact.Contact{ - ID: partner.GetPartnerID(), - DhPubKey: partner.GetPartnerOriginPublicKey(), + ID: partner.PartnerId(), + DhPubKey: partner.PartnerRootPublicKey(), } - dkl.Add(partner.GetMyOriginPrivateKey(), group.Member{ - ID: partner.GetPartnerID(), - DhKey: partner.GetPartnerOriginPublicKey(), + dkl.Add(partner.MyRootPrivateKey(), group.Member{ + ID: partner.PartnerId(), + DhKey: partner.PartnerRootPublicKey(), }, m.grp) } diff --git a/groupChat/manager_test.go b/groupChat/manager_test.go index 5a9c30cdc4db6e31d486bdd54a7a5243b846a30d..db891b387280540bf2d27b2a4f4c7e25da41d98e 100644 --- a/groupChat/manager_test.go +++ b/groupChat/manager_test.go @@ -150,8 +150,8 @@ func Test_newManager_LoadError(t *testing.T) { // m2, _ := newTestManagerWithStore(prng, 10, 0, requestFunc2, receiveFunc2, t) // m3, _ := newTestManagerWithStore(prng, 10, 0, requestFunc3, receiveFunc3, t) // -// membership, err := group.NewMembership(m1.store.GetUser().GetContact(), -// m2.store.GetUser().GetContact(), m3.store.GetUser().GetContact()) +// membership, err := group.NewMembership(m1.store.GetUser().Contact(), +// m2.store.GetUser().Contact(), m3.store.GetUser().Contact()) // if err != nil { // t.Errorf("Failed to generate new membership: %+v", err) // } diff --git a/groupChat/receiveRequest.go b/groupChat/receiveRequest.go index 3a8741d6b0a7e494c137ac53c6f1f7de9834a389..0d2224cbbcba375da4f440224c16b9d03e507eb5 100644 --- a/groupChat/receiveRequest.go +++ b/groupChat/receiveRequest.go @@ -85,10 +85,10 @@ func (m *Manager) readRequest(msg receive.Message) (gs.Group, error) { // Replace leader's public key with the one from the partnership leaderPubKey := membership[0].DhKey.DeepCopy() - membership[0].DhKey = partner.GetPartnerOriginPublicKey() + membership[0].DhKey = partner.PartnerRootPublicKey() // Generate the DH keys with each group member - privKey := partner.GetMyOriginPrivateKey() + privKey := partner.MyRootPrivateKey() dkl := gs.GenerateDhKeyList(m.receptionId, privKey, membership, m.grp) // Restore the original public key for the leader so that the membership