diff --git a/api/e2eApi/precan.go b/api/e2eApi/precan.go deleted file mode 100644 index 09343060746c34f8468a2f9a49d0c91bc7b5e02b..0000000000000000000000000000000000000000 --- a/api/e2eApi/precan.go +++ /dev/null @@ -1,87 +0,0 @@ -package e2eApi - -import ( - "encoding/binary" - "github.com/cloudflare/circl/dh/sidh" - "gitlab.com/elixxir/client/api" - "gitlab.com/elixxir/client/e2e/ratchet/partner/session" - util "gitlab.com/elixxir/client/storage/utility" - "gitlab.com/elixxir/crypto/contact" - "gitlab.com/elixxir/crypto/cyclic" - "gitlab.com/elixxir/crypto/diffieHellman" - "gitlab.com/elixxir/primitives/fact" - "math/rand" -) - -func generatePrecanDHKeypair(precannedID uint, e2eGrp *cyclic.Group) *cyclic.Int { - // DH Keygen - prng := rand.New(rand.NewSource(int64(precannedID))) - prime := e2eGrp.GetPBytes() - keyLen := len(prime) - priv := diffieHellman.GeneratePrivateKey(keyLen, e2eGrp, prng) - return priv -} - -// Create an insecure e2e relationship with a precanned user -func (m *Client) MakePrecannedAuthenticatedChannel(precannedID uint) ( - contact.Contact, error) { - - precan := m.MakePrecannedContact(precannedID) - - myID := binary.BigEndian.Uint64(m.GetStorage().GetReceptionID()[:]) - // Pick a variant based on if their ID is bigger than mine. - myVariant := sidh.KeyVariantSidhA - theirVariant := sidh.KeyVariant(sidh.KeyVariantSidhB) - if myID > uint64(precannedID) { - myVariant = sidh.KeyVariantSidhB - theirVariant = sidh.KeyVariantSidhA - } - prng1 := rand.New(rand.NewSource(int64(precannedID))) - theirSIDHPrivKey := util.NewSIDHPrivateKey(theirVariant) - theirSIDHPubKey := util.NewSIDHPublicKey(theirVariant) - theirSIDHPrivKey.Generate(prng1) - theirSIDHPrivKey.GeneratePublicKey(theirSIDHPubKey) - - prng2 := rand.New(rand.NewSource(int64(myID))) - mySIDHPrivKey := util.NewSIDHPrivateKey(myVariant) - mySIDHPubKey := util.NewSIDHPublicKey(myVariant) - mySIDHPrivKey.Generate(prng2) - mySIDHPrivKey.GeneratePublicKey(mySIDHPubKey) - - // add the precanned user as a e2e contact - // FIXME: these params need to be threaded through... - sesParam := session.GetDefaultParams() - _, err := m.e2e.AddPartner(precan.ID, precan.DhPubKey, - m.e2e.GetHistoricalDHPrivkey(), theirSIDHPubKey, - mySIDHPrivKey, sesParam, sesParam) - - // check garbled messages in case any messages arrived before creating - // the channel - m.GetCmix().CheckInProgressMessages() - - return precan, err -} - -// Create an insecure e2e contact object for a precanned user -func (m *Client) MakePrecannedContact(precannedID uint) contact.Contact { - - e2eGrp := m.GetStorage().GetE2EGroup() - - rng := m.GetRng().GetStream() - precanned := api.CreatePrecannedUser(precannedID, rng) - rng.Close() - - precanned.E2eDhPrivateKey = generatePrecanDHKeypair(precannedID, - m.GetStorage().GetE2EGroup()) - - // compute their public e2e key - partnerPubKey := e2eGrp.ExpG(precanned.E2eDhPrivateKey, - e2eGrp.NewInt(1)) - - return contact.Contact{ - ID: precanned.ReceptionID, - DhPubKey: partnerPubKey, - OwnershipProof: nil, - Facts: make([]fact.Fact, 0), - } -} diff --git a/api/precan.go b/api/precan.go deleted file mode 100644 index 150d90fa9a806db81277fe9677a9a6ecc13e64dc..0000000000000000000000000000000000000000 --- a/api/precan.go +++ /dev/null @@ -1,85 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Copyright © 2020 xx network SEZC // -// // -// Use of this source code is governed by a license that can be found in the // -// LICENSE file // -/////////////////////////////////////////////////////////////////////////////// - -package api - -import ( - "encoding/binary" - - jww "github.com/spf13/jwalterweatherman" - "gitlab.com/elixxir/client/storage" - "gitlab.com/elixxir/client/storage/user" - "gitlab.com/elixxir/crypto/fastRNG" - "gitlab.com/xx_network/crypto/csprng" - "gitlab.com/xx_network/crypto/signature/rsa" - "gitlab.com/xx_network/primitives/id" -) - -// CreatePrecannedUser creates a precanned user -func CreatePrecannedUser(precannedID uint, rng csprng.Source) user.Info { - - // Salt, UID, etc gen - salt := make([]byte, SaltSize) - - userID := id.ID{} - binary.BigEndian.PutUint64(userID[:], uint64(precannedID)) - userID.SetType(id.User) - - // NOTE: not used... RSA Keygen (4096 bit defaults) - rsaKey, err := rsa.GenerateKey(rng, rsa.DefaultRSABitLen) - if err != nil { - jww.FATAL.Panicf(err.Error()) - } - - return user.Info{ - TransmissionID: &userID, - TransmissionSalt: salt, - ReceptionID: &userID, - ReceptionSalt: salt, - Precanned: true, - E2eDhPrivateKey: nil, - E2eDhPublicKey: nil, - TransmissionRSA: rsaKey, - ReceptionRSA: rsaKey, - } -} - -// NewPrecannedClient creates an insecure user with predetermined keys -// with nodes It creates client storage, generates keys, connects, and -// registers with the network. Note that this does not register a -// username/identity, but merely creates a new cryptographic identity -// for adding such information at a later date. -func NewPrecannedClient(precannedID uint, defJSON, storageDir string, - password []byte) error { - jww.INFO.Printf("NewPrecannedClient()") - rngStreamGen := fastRNG.NewStreamGenerator(12, 1024, - csprng.NewSystemRNG) - rngStream := rngStreamGen.GetStream() - - def, err := ParseNDF(defJSON) - if err != nil { - return err - } - cmixGrp, e2eGrp := DecodeGroups(def) - - protoUser := CreatePrecannedUser(precannedID, rngStream) - - store, err := CheckVersionAndSetupStorage(def, storageDir, password, - protoUser, cmixGrp, e2eGrp, "") - if err != nil { - return err - } - - // Mark the precanned user as finished with permissioning and registered - // with the network. - err = store.ForwardRegistrationStatus(storage.PermissioningComplete) - if err != nil { - return err - } - - return nil -} diff --git a/backup/backup.go b/backup/backup.go index 4ade205c708b329346ab72cb062ca4851a90eb36..7ee125ecfbd0b0689f59d78c2a712cdc3d3c9f81 100644 --- a/backup/backup.go +++ b/backup/backup.go @@ -11,8 +11,8 @@ import ( "sync" "time" - "gitlab.com/elixxir/client/api/e2eApi" "gitlab.com/elixxir/client/storage/versioned" + "gitlab.com/elixxir/client/xxdk/e2eApi" "gitlab.com/elixxir/crypto/cyclic" "gitlab.com/elixxir/primitives/fact" "gitlab.com/xx_network/primitives/id" @@ -45,7 +45,7 @@ type Backup struct { jsonParams string - // Client structures + // E2e structures e2e E2e session Session ud UserDiscovery diff --git a/backup/backup_test.go b/backup/backup_test.go index 5e353b627ee449233db9308ec3166d4f381b9a28..4dd347bc9353d9a319a31819579173016bfd6c6d 100644 --- a/backup/backup_test.go +++ b/backup/backup_test.go @@ -14,9 +14,9 @@ import ( "testing" "time" - "gitlab.com/elixxir/client/api/e2eApi" "gitlab.com/elixxir/client/storage" "gitlab.com/elixxir/client/storage/versioned" + "gitlab.com/elixxir/client/xxdk/e2eApi" "gitlab.com/elixxir/ekv" "gitlab.com/elixxir/crypto/backup" diff --git a/bindings/client.go b/bindings/client.go index 24f69dceef7ecd992c6ebdb3543aae8dad18f209..6b5ff86719361853a8ac0ec7f7e5e8db1b0ea9d6 100644 --- a/bindings/client.go +++ b/bindings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/pkg/errors" jww "github.com/spf13/jwalterweatherman" - "gitlab.com/elixxir/client/api" + "gitlab.com/elixxir/client/xxdk" ) // sets the log level @@ -20,10 +20,10 @@ var clientTrackerSingleton = &clientTracker{ count: 0, } -// Client BindingsClient wraps the api.Client, implementing additional functions +// Client BindingsClient wraps the xxdk.Cmix, implementing additional functions // to support the gomobile Client interface type Client struct { - api *api.Client + api *xxdk.Cmix id int } @@ -34,7 +34,7 @@ type Client struct { // // Users of this function should delete the storage directory on error. func NewClient(network, storageDir string, password []byte, regCode string) error { - if err := api.NewClient(network, storageDir, password, regCode); err != nil { + if err := xxdk.NewClient(network, storageDir, password, regCode); err != nil { return errors.New(fmt.Sprintf("Failed to create new client: %+v", err)) } @@ -51,7 +51,7 @@ func NewClient(network, storageDir string, password []byte, regCode string) erro // TODO: add in custom parameters instead of the default func Login(storageDir string, password []byte) (*Client, error) { - client, err := api.Login(storageDir, password, api.GetDefaultParams()) + client, err := xxdk.Login(storageDir, password, xxdk.GetDefaultParams()) if err != nil { return nil, errors.New(fmt.Sprintf("Failed to login: %+v", err)) } @@ -62,6 +62,3 @@ func Login(storageDir string, password []byte) (*Client, error) { func (c *Client) GetID() int { return c.id } - - - diff --git a/bindings/clientTracker.go b/bindings/clientTracker.go index a93bfc62a1e5b8fc35672ab2ff55701278012cc9..9cea32cb925cccb5b5678bf097842ef74cb419a4 100644 --- a/bindings/clientTracker.go +++ b/bindings/clientTracker.go @@ -2,7 +2,7 @@ package bindings import ( "github.com/pkg/errors" - "gitlab.com/elixxir/client/api" + "gitlab.com/elixxir/client/xxdk" "sync" ) @@ -16,7 +16,7 @@ type clientTracker struct { } // make makes a client from an API client, assigning it a unique ID -func (ct *clientTracker) make(c *api.Client) *Client { +func (ct *clientTracker) make(c *xxdk.Cmix) *Client { ct.mux.Lock() defer ct.mux.Unlock() diff --git a/bindings/contact.go b/bindings/contact.go index cf5647bd1b5a93ec31390d1b9cce2b28719cc907..8974044d569ff4ead4786eae15462e81a1bc8749 100644 --- a/bindings/contact.go +++ b/bindings/contact.go @@ -2,7 +2,7 @@ package bindings import ( "encoding/json" - "gitlab.com/elixxir/client/api" + "gitlab.com/elixxir/client/xxdk" "gitlab.com/elixxir/crypto/contact" "gitlab.com/elixxir/crypto/cyclic" "gitlab.com/elixxir/primitives/fact" @@ -31,7 +31,7 @@ type Identity struct { func (c *Client) MakeIdentity() ([]byte, error) { s := c.api.GetRng().GetStream() defer s.Close() - ident, err := api.MakeIdentity(s, c.api.GetStorage().GetE2EGroup()) + ident, err := xxdk.MakeIdentity(s, c.api.GetStorage().GetE2EGroup()) dhPrivJson, err := ident.DHKeyPrivate.MarshalJSON() if err != nil { diff --git a/bindings/ndf.go b/bindings/ndf.go index 05e7d40b364678a028b66001c5de907840d1f6a7..ed72aa1d6a98c33861d814d18f032c7396e1a099 100644 --- a/bindings/ndf.go +++ b/bindings/ndf.go @@ -1,11 +1,11 @@ package bindings -import "gitlab.com/elixxir/client/api" +import "gitlab.com/elixxir/client/xxdk" // DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. // The NDF is processed into a protobuf containing a signature which // is verified using the cert string passed in. The NDF is returned as marshaled // byte data which may be used to start a client. func DownloadAndVerifySignedNdfWithUrl(url, cert string) ([]byte, error) { - return api.DownloadAndVerifySignedNdfWithUrl(url, cert) + return xxdk.DownloadAndVerifySignedNdfWithUrl(url, cert) } diff --git a/bindings/version.go b/bindings/version.go index 7e84bbd2ed1a0de0825e47a24e5e62ffa2f9f78a..4d6a4b2dc2dd86b1881aa3c918062cd50052fd98 100644 --- a/bindings/version.go +++ b/bindings/version.go @@ -6,19 +6,19 @@ package bindings -import "gitlab.com/elixxir/client/api" +import "gitlab.com/elixxir/client/xxdk" // GetVersion returns the api SEMVER func GetVersion() string { - return api.SEMVER + return xxdk.SEMVER } // GetGitVersion rturns the api GITVERSION func GetGitVersion() string { - return api.GITVERSION + return xxdk.GITVERSION } // GetDependencies returns the api DEPENDENCIES func GetDependencies() string { - return api.DEPENDENCIES + return xxdk.DEPENDENCIES } diff --git a/broadcast/asymmetric_test.go b/broadcast/asymmetric_test.go index 2df1c2eb3d5c46de22c0c530b01f08ab97e6cd94..88aa2219d3495beb4659b97f5aa34ca4baf9c27f 100644 --- a/broadcast/asymmetric_test.go +++ b/broadcast/asymmetric_test.go @@ -66,7 +66,7 @@ func Test_asymmetricClient_Smoke(t *testing.T) { // Test that Get returns the expected channel if !reflect.DeepEqual(s.Get(), channel) { - t.Errorf("Client %d returned wrong channel."+ + t.Errorf("Cmix %d returned wrong channel."+ "\nexpected: %+v\nreceived: %+v", i, channel, s.Get()) } } @@ -86,12 +86,12 @@ func Test_asymmetricClient_Smoke(t *testing.T) { select { case r := <-cbChan: if !bytes.Equal(payload, r) { - t.Errorf("Client %d failed to receive expected "+ + t.Errorf("Cmix %d failed to receive expected "+ "payload from client %d."+ "\nexpected: %q\nreceived: %q", j, i, payload, r) } case <-time.After(time.Second): - t.Errorf("Client %d timed out waiting for broadcast "+ + t.Errorf("Cmix %d timed out waiting for broadcast "+ "payload from client %d.", j, i) } }(i, j, cbChans[j]) @@ -100,7 +100,7 @@ func Test_asymmetricClient_Smoke(t *testing.T) { // Broadcast payload _, _, err := clients[i].BroadcastAsymmetric(pk, payload, cmix.GetDefaultCMIXParams()) if err != nil { - t.Errorf("Client %d failed to send broadcast: %+v", i, err) + t.Errorf("Cmix %d failed to send broadcast: %+v", i, err) } // Wait for all clients to receive payload or time out @@ -123,7 +123,7 @@ func Test_asymmetricClient_Smoke(t *testing.T) { defer wg.Done() select { case r := <-cbChan: - t.Errorf("Client %d received message: %q", i, r) + t.Errorf("Cmix %d received message: %q", i, r) case <-time.After(25 * time.Millisecond): } }(i, cbChans[i]) @@ -132,7 +132,7 @@ func Test_asymmetricClient_Smoke(t *testing.T) { // Broadcast payload _, _, err = clients[0].BroadcastAsymmetric(pk, payload, cmix.GetDefaultCMIXParams()) if err != nil { - t.Errorf("Client 0 failed to send broadcast: %+v", err) + t.Errorf("Cmix 0 failed to send broadcast: %+v", err) } wg.Wait() diff --git a/broadcast/symmetric_test.go b/broadcast/symmetric_test.go index a35ea5ecdca77b9abb5d874b3a28c99be6f08a7a..de76da504ca02fa6b8b1aa558bbef20a865a7730 100644 --- a/broadcast/symmetric_test.go +++ b/broadcast/symmetric_test.go @@ -72,7 +72,7 @@ func Test_symmetricClient_Smoke(t *testing.T) { // Test that Get returns the expected channel if !reflect.DeepEqual(s.Get(), channel) { - t.Errorf("Client %d returned wrong channel."+ + t.Errorf("Cmix %d returned wrong channel."+ "\nexpected: %+v\nreceived: %+v", i, channel, s.Get()) } } @@ -92,12 +92,12 @@ func Test_symmetricClient_Smoke(t *testing.T) { select { case r := <-cbChan: if !bytes.Equal(payload, r) { - t.Errorf("Client %d failed to receive expected "+ + t.Errorf("Cmix %d failed to receive expected "+ "payload from client %d."+ "\nexpected: %q\nreceived: %q", j, i, payload, r) } case <-time.After(25 * time.Millisecond): - t.Errorf("Client %d timed out waiting for broadcast "+ + t.Errorf("Cmix %d timed out waiting for broadcast "+ "payload from client %d.", j, i) } }(i, j, cbChans[j]) @@ -106,7 +106,7 @@ func Test_symmetricClient_Smoke(t *testing.T) { // Broadcast payload _, _, err := clients[i].Broadcast(payload, cmix.GetDefaultCMIXParams()) if err != nil { - t.Errorf("Client %d failed to send broadcast: %+v", i, err) + t.Errorf("Cmix %d failed to send broadcast: %+v", i, err) } // Wait for all clients to receive payload or time out @@ -129,7 +129,7 @@ func Test_symmetricClient_Smoke(t *testing.T) { defer wg.Done() select { case r := <-cbChan: - t.Errorf("Client %d received message: %q", i, r) + t.Errorf("Cmix %d received message: %q", i, r) case <-time.After(25 * time.Millisecond): } }(i, cbChans[i]) @@ -138,7 +138,7 @@ func Test_symmetricClient_Smoke(t *testing.T) { // Broadcast payload _, _, err = clients[0].Broadcast(payload, cmix.GetDefaultCMIXParams()) if err != nil { - t.Errorf("Client 0 failed to send broadcast: %+v", err) + t.Errorf("Cmix 0 failed to send broadcast: %+v", err) } wg.Wait() diff --git a/broadcast/utils_test.go b/broadcast/utils_test.go index 944fd3c3993dce55cfe153b8b1c29cd828b66c5c..208e9893e716dc07f66bcdd3fc80ba5c6ed53435 100644 --- a/broadcast/utils_test.go +++ b/broadcast/utils_test.go @@ -34,7 +34,7 @@ func newRsaPubKey(seed int64, t *testing.T) *rsa.PublicKey { } //////////////////////////////////////////////////////////////////////////////// -// Mock cMix Client // +// Mock cMix Cmix // //////////////////////////////////////////////////////////////////////////////// type mockCmixHandler struct { diff --git a/cmd/callbacks.go b/cmd/callbacks.go index 3d2050e4161e5615a26be8e52f0a4c462c140447..3de83ee11690c72f819ff7bb7243da44b9f63d72 100644 --- a/cmd/callbacks.go +++ b/cmd/callbacks.go @@ -10,7 +10,7 @@ package cmd import ( "fmt" - "gitlab.com/elixxir/client/api/e2eApi" + "gitlab.com/elixxir/client/xxdk/e2eApi" jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/client/catalog" @@ -25,10 +25,10 @@ import ( type authCallbacks struct { autoConfirm bool confCh chan *id.ID - client *e2eApi.Client + client *e2eApi.E2e } -func makeAuthCallbacks(client *e2eApi.Client, autoConfirm bool) *authCallbacks { +func makeAuthCallbacks(client *e2eApi.E2e, autoConfirm bool) *authCallbacks { return &authCallbacks{ autoConfirm: autoConfirm, confCh: make(chan *id.ID, 10), @@ -71,7 +71,7 @@ func (a *authCallbacks) Reset(requestor contact.Contact, fmt.Printf(msg) } -func registerMessageListener(client *e2eApi.Client) chan receive.Message { +func registerMessageListener(client *e2eApi.E2e) chan receive.Message { recvCh := make(chan receive.Message, 10000) listenerID := client.GetE2E().RegisterChannel("DefaultCLIReceiver", receive.AnyUser(), catalog.NoType, recvCh) diff --git a/cmd/fileTransfer.go b/cmd/fileTransfer.go index ae7c3d84206678e89f2b9e3c92bdea7de076b901..cc89c7ab942caacd1458bbf5cd53469d771c4b45 100644 --- a/cmd/fileTransfer.go +++ b/cmd/fileTransfer.go @@ -9,7 +9,7 @@ package cmd import ( "fmt" - "gitlab.com/elixxir/client/api/e2eApi" + "gitlab.com/elixxir/client/xxdk/e2eApi" "io/ioutil" "time" @@ -132,7 +132,7 @@ type receivedFtResults struct { // initFileTransferManager creates a new file transfer manager with a new // reception callback. Returns the file transfer manager and the channel that // will be triggered when the callback is called. -func initFileTransferManager(client *e2eApi.Client, maxThroughput int) ( +func initFileTransferManager(client *e2eApi.E2e, maxThroughput int) ( *ftE2e.Wrapper, chan receivedFtResults) { // Create interfaces.ReceiveCallback that returns the results on a channel diff --git a/cmd/getndf.go b/cmd/getndf.go index 7b54755091ee841590d0b0fe1b5daf52c7d503b9..429f2238df30350497c1d0dd178fae7079847761 100644 --- a/cmd/getndf.go +++ b/cmd/getndf.go @@ -18,7 +18,7 @@ import ( // "gitlab.com/elixxir/client/switchboard" // "gitlab.com/elixxir/client/ud" // "gitlab.com/elixxir/primitives/fact" - "gitlab.com/elixxir/client/api" + "gitlab.com/elixxir/client/xxdk" "gitlab.com/elixxir/comms/client" "gitlab.com/xx_network/comms/connect" //"time" @@ -47,23 +47,23 @@ var getNDFCmd = &cobra.Command{ var err error switch viper.GetString("env") { case mainnet: - ndfJSON, err = api.DownloadAndVerifySignedNdfWithUrl(mainNetUrl, mainNetCert) + ndfJSON, err = xxdk.DownloadAndVerifySignedNdfWithUrl(mainNetUrl, mainNetCert) if err != nil { jww.FATAL.Panicf(err.Error()) } case release: - ndfJSON, err = api.DownloadAndVerifySignedNdfWithUrl(releaseUrl, releaseCert) + ndfJSON, err = xxdk.DownloadAndVerifySignedNdfWithUrl(releaseUrl, releaseCert) if err != nil { jww.FATAL.Panicf(err.Error()) } case dev: - ndfJSON, err = api.DownloadAndVerifySignedNdfWithUrl(devUrl, devCert) + ndfJSON, err = xxdk.DownloadAndVerifySignedNdfWithUrl(devUrl, devCert) if err != nil { jww.FATAL.Panicf(err.Error()) } case testnet: - ndfJSON, err = api.DownloadAndVerifySignedNdfWithUrl(testNetUrl, testNetCert) + ndfJSON, err = xxdk.DownloadAndVerifySignedNdfWithUrl(testNetUrl, testNetCert) if err != nil { jww.FATAL.Panicf(err.Error()) } @@ -113,7 +113,7 @@ var getNDFCmd = &cobra.Command{ }, LastUpdate: uint64(0), ReceptionID: dummyID[:], - ClientVersion: []byte(api.SEMVER), + ClientVersion: []byte(xxdk.SEMVER), } resp, err := comms.SendPoll(host, pollMsg) if err != nil { diff --git a/cmd/group.go b/cmd/group.go index 6eb63d5571545070d7fa3b73682687ddbdefddd9..d4e1f30f0f4cc4f59e53ec29485005934af83cf2 100644 --- a/cmd/group.go +++ b/cmd/group.go @@ -12,9 +12,9 @@ package cmd import ( "bufio" "fmt" - "gitlab.com/elixxir/client/api/e2eApi" "gitlab.com/elixxir/client/cmix/identity/receptionID" "gitlab.com/elixxir/client/cmix/rounds" + "gitlab.com/elixxir/client/xxdk/e2eApi" "gitlab.com/elixxir/primitives/format" "os" "time" @@ -115,7 +115,7 @@ var groupCmd = &cobra.Command{ // initGroupManager creates a new group chat manager and starts the process // service. -func initGroupManager(client *e2eApi.Client) (groupChat.GroupChat, +func initGroupManager(client *e2eApi.E2e) (groupChat.GroupChat, chan groupChat.MessageReceive, chan groupStore.Group) { recChan := make(chan groupChat.MessageReceive, 10) diff --git a/cmd/init.go b/cmd/init.go index 6be506aa662f6d79bdaf5dbaa75c7b09c338200a..b095c6173c0dc1fbf9b81fc612ab65a503a78e4c 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -14,7 +14,7 @@ import ( "github.com/spf13/cobra" jww "github.com/spf13/jwalterweatherman" "github.com/spf13/viper" - "gitlab.com/elixxir/client/api/e2eApi" + "gitlab.com/elixxir/client/xxdk/e2eApi" ) // initCmd creates a new user object with the given NDF diff --git a/cmd/precan.go b/cmd/precan.go index e7574b45853f15428f2ce619e5891cd8b2125849..7602d472d8e5a27e2a13e64e4a7aba05932d7c80 100644 --- a/cmd/precan.go +++ b/cmd/precan.go @@ -11,7 +11,7 @@ package cmd import ( "encoding/binary" - "gitlab.com/elixxir/client/api/e2eApi" + "gitlab.com/elixxir/client/xxdk/e2eApi" "strconv" jww "github.com/spf13/jwalterweatherman" @@ -67,7 +67,7 @@ func getPrecanID(recipientID *id.ID) uint { return uint(recipientID.Bytes()[7]) } -func addPrecanAuthenticatedChannel(client *e2eApi.Client, recipientID *id.ID, +func addPrecanAuthenticatedChannel(client *e2eApi.E2e, recipientID *id.ID, recipient contact.Contact) { jww.WARN.Printf("Precanned user id detected: %s", recipientID) preUsr, err := client.MakePrecannedAuthenticatedChannel( diff --git a/cmd/root.go b/cmd/root.go index c3eb8e13ac2df23665b4dd800178ff551d236597..3367a837a4cda5ada84479e01c7cdbcfbacda4eb 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -25,9 +25,9 @@ import ( "sync" "time" - "gitlab.com/elixxir/client/api/e2eApi" "gitlab.com/elixxir/client/backup" "gitlab.com/elixxir/client/e2e" + "gitlab.com/elixxir/client/xxdk/e2eApi" "gitlab.com/elixxir/client/catalog" "gitlab.com/elixxir/client/cmix" @@ -36,7 +36,7 @@ import ( "github.com/spf13/cobra" jww "github.com/spf13/jwalterweatherman" "github.com/spf13/viper" - "gitlab.com/elixxir/client/api" + "gitlab.com/elixxir/client/xxdk" backupCrypto "gitlab.com/elixxir/crypto/backup" "gitlab.com/elixxir/crypto/contact" "gitlab.com/elixxir/primitives/excludedRounds" @@ -507,7 +507,7 @@ var rootCmd = &cobra.Command{ }, } -func createClient() *api.Client { +func createClient() *xxdk.Cmix { logLevel := viper.GetUint("logLevel") initLog(logLevel, viper.GetString("log")) jww.INFO.Printf(Version()) @@ -530,17 +530,17 @@ func createClient() *api.Client { } if precannedID != 0 { - err = api.NewPrecannedClient(precannedID, + err = xxdk.NewPrecannedClient(precannedID, string(ndfJSON), storeDir, pass) } else if protoUserPath != "" { protoUserJson, err := utils.ReadFile(protoUserPath) if err != nil { jww.FATAL.Panicf("%v", err) } - err = api.NewProtoClient_Unsafe(string(ndfJSON), storeDir, + err = xxdk.NewProtoClient_Unsafe(string(ndfJSON), storeDir, pass, protoUserJson) } else if userIDprefix != "" { - err = api.NewVanityClient(string(ndfJSON), storeDir, + err = xxdk.NewVanityClient(string(ndfJSON), storeDir, pass, regCode, userIDprefix) } else if backupPath != "" { @@ -582,7 +582,7 @@ func createClient() *api.Client { } } else { - err = api.NewClient(string(ndfJSON), storeDir, + err = xxdk.NewClient(string(ndfJSON), storeDir, pass, regCode) } @@ -593,15 +593,15 @@ func createClient() *api.Client { params := initParams() - client, err := api.OpenClient(storeDir, pass, params) + client, err := xxdk.OpenClient(storeDir, pass, params) if err != nil { jww.FATAL.Panicf("%+v", err) } return client } -func initParams() api.Params { - p := api.GetDefaultParams() +func initParams() xxdk.Params { + p := xxdk.GetDefaultParams() p.Session.MinKeys = uint16(viper.GetUint("e2eMinKeys")) p.Session.MaxKeys = uint16(viper.GetUint("e2eMaxKeys")) p.Session.NumRekeys = uint16(viper.GetUint("e2eNumReKeys")) @@ -621,7 +621,7 @@ func initParams() api.Params { return p } -func initClient() *e2eApi.Client { +func initClient() *e2eApi.E2e { createClient() pass := parsePassword(viper.GetString("password")) @@ -631,7 +631,7 @@ func initClient() *e2eApi.Client { params := initParams() // load the client - baseclient, err := api.Login(storeDir, pass, params) + baseclient, err := xxdk.Login(storeDir, pass, params) if err != nil { jww.FATAL.Panicf("%+v", err) @@ -707,7 +707,7 @@ func initClient() *e2eApi.Client { return client } -func acceptChannel(client *e2eApi.Client, recipientID *id.ID) { +func acceptChannel(client *e2eApi.E2e, recipientID *id.ID) { recipientContact, err := client.GetAuth().GetReceivedRequest( recipientID) if err != nil { @@ -720,14 +720,14 @@ func acceptChannel(client *e2eApi.Client, recipientID *id.ID) { } } -func deleteChannel(client *e2eApi.Client, partnerId *id.ID) { +func deleteChannel(client *e2eApi.E2e, partnerId *id.ID) { err := client.DeleteContact(partnerId) if err != nil { jww.FATAL.Panicf("%+v", err) } } -func addAuthenticatedChannel(client *e2eApi.Client, recipientID *id.ID, +func addAuthenticatedChannel(client *e2eApi.E2e, recipientID *id.ID, recipient contact.Contact) { var allowed bool if viper.GetBool("unsafe-channel-creation") { @@ -764,7 +764,7 @@ func addAuthenticatedChannel(client *e2eApi.Client, recipientID *id.ID, } } -func resetAuthenticatedChannel(client *e2eApi.Client, recipientID *id.ID, +func resetAuthenticatedChannel(client *e2eApi.E2e, recipientID *id.ID, recipient contact.Contact) { var allowed bool if viper.GetBool("unsafe-channel-creation") { diff --git a/cmd/single.go b/cmd/single.go index 558ad39ebe3700900732d7e10379138acd04a4ab..2ce03e5c35162a909d3c502410ed35bede436c13 100644 --- a/cmd/single.go +++ b/cmd/single.go @@ -16,11 +16,11 @@ import ( "github.com/spf13/cobra" jww "github.com/spf13/jwalterweatherman" "github.com/spf13/viper" - "gitlab.com/elixxir/client/api" "gitlab.com/elixxir/client/cmix" "gitlab.com/elixxir/client/cmix/identity/receptionID" "gitlab.com/elixxir/client/cmix/rounds" "gitlab.com/elixxir/client/single" + "gitlab.com/elixxir/client/xxdk" "gitlab.com/elixxir/crypto/contact" "gitlab.com/xx_network/primitives/utils" ) @@ -92,7 +92,7 @@ var singleCmd = &cobra.Command{ partner := readSingleUseContact("contact") maxMessages := uint8(viper.GetUint("maxMessages")) - sendSingleUse(client.Client, partner, payload, + sendSingleUse(client.Cmix, partner, payload, maxMessages, timeout, tag) } @@ -152,7 +152,7 @@ func (r *Response) Callback(payload []byte, receptionID receptionID.EphemeralIde } // sendSingleUse sends a single use message. -func sendSingleUse(m *api.Client, partner contact.Contact, payload []byte, +func sendSingleUse(m *xxdk.Cmix, partner contact.Contact, payload []byte, maxMessages uint8, timeout time.Duration, tag string) { // Construct callback callback := &Response{ diff --git a/cmd/version.go b/cmd/version.go index f657df9a85100c56590cdbe93873a13f0da75678..41055fef35186085ee0747b89bc17332b13a95df 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -13,7 +13,7 @@ import ( "fmt" "github.com/spf13/cobra" - "gitlab.com/elixxir/client/api" + "gitlab.com/elixxir/client/xxdk" "gitlab.com/xx_network/primitives/utils" ) @@ -21,9 +21,9 @@ import ( const currentVersion = "4.2.0" func Version() string { - out := fmt.Sprintf("Elixxir Client v%s -- %s\n\n", api.SEMVER, - api.GITVERSION) - out += fmt.Sprintf("Dependencies:\n\n%s\n", api.DEPENDENCIES) + out := fmt.Sprintf("Elixxir Cmix v%s -- %s\n\n", xxdk.SEMVER, + xxdk.GITVERSION) + out += fmt.Sprintf("Dependencies:\n\n%s\n", xxdk.DEPENDENCIES) return out } diff --git a/cmix/client.go b/cmix/client.go index 15318e5f7cd4cdad302547f09bef96a3d09f8655..a675be8bfef3ceb8086e6a947faaa93c6108781e 100644 --- a/cmix/client.go +++ b/cmix/client.go @@ -140,7 +140,7 @@ func (c *client) Connect(ndf *ndf.NetworkDefinition) error { // Set up gateway.Sender poolParams := gateway.DefaultPoolParams() - // Client will not send KeepAlive packets + // Cmix will not send KeepAlive packets poolParams.HostParams.KaClientOpts.Time = time.Duration(math.MaxInt64) // Enable optimized HostPool initialization diff --git a/cmix/follow.go b/cmix/follow.go index 58c693d09d31642af19fd8a8115b35037bce96ae..608202814b93daa71c727a52aa350b2a010cec1c 100644 --- a/cmix/follow.go +++ b/cmix/follow.go @@ -224,7 +224,7 @@ func (c *client) follow(report ClientErrorReport, rng csprng.Source, marshaledTid := c.session.GetTransmissionID().Marshal() for _, clientErr := range update.ClientErrors { - // If this Client appears in the ClientError + // If this Cmix appears in the ClientError if bytes.Equal(clientErr.ClientId, marshaledTid) { // Obtain relevant NodeGateway information diff --git a/cmix/gateway/hostPool.go b/cmix/gateway/hostPool.go index 52b29d45f1661cb025799d993e401e2dd9108cc3..d5f3164505c31b4dc462c27e7310a13c7517c177 100644 --- a/cmix/gateway/hostPool.go +++ b/cmix/gateway/hostPool.go @@ -66,7 +66,7 @@ type HostManager interface { // accepted. type Filter func(map[id.ID]int, *ndf.NetworkDefinition) map[id.ID]int -// HostPool Handles providing hosts to the Client +// HostPool Handles providing hosts to the Cmix type HostPool struct { hostMap map[id.ID]uint32 // Map key to its index in the slice hostList []*connect.Host // Each index in the slice contains the value diff --git a/cmix/interface.go b/cmix/interface.go index c03dc1296249a8174916e87f7de2836bd1c7d39f..a7489b106a5e87c242e84af39a9b4df46f3bcbad 100644 --- a/cmix/interface.go +++ b/cmix/interface.go @@ -212,7 +212,7 @@ type Client interface { /* === Nodes ============================================================ */ /* Keys must be registered with nodes in order to send messages through them. This process is, in general, automatically handled by the Network - Client. */ + Cmix. */ // HasNode can be used to determine if a keying relationship exists with a // node. @@ -229,7 +229,7 @@ type Client interface { /* === Rounds =========================================================== */ /* A complete set of round info is not kept on the client, and sometimes the network will need to be queried to get round info. Historical rounds - is the system internal to the Network Client to do this. It can be used + is the system internal to the Network Cmix to do this. It can be used externally as well. */ // GetRoundResults adjudicates on the rounds requested. Checks if they are diff --git a/cmix/nodes/request.go b/cmix/nodes/request.go index f41b6b88e2cf476c59f8b00344cfff7101537673..4a99c358427314446ccd557afe9596f15ffd7440 100644 --- a/cmix/nodes/request.go +++ b/cmix/nodes/request.go @@ -218,6 +218,6 @@ func processRequestResponse(signedKeyResponse *pb.SignedKeyResponse, // Construct the transmission key from the client key transmissionKey := grp.NewIntFromBytes(clientKey) - // Use Client keypair to sign Server nonce + // Use Cmix keypair to sign Server nonce return transmissionKey, keyResponse.KeyID, keyResponse.ValidUntil, nil } diff --git a/cmix/nodes/utils_test.go b/cmix/nodes/utils_test.go index 5c97dadf3c77bd1309251a23850d3eb252389c93..a56c7e45b90f825265663fea8048f6d972e033bf 100644 --- a/cmix/nodes/utils_test.go +++ b/cmix/nodes/utils_test.go @@ -234,7 +234,7 @@ func (m *MockClientComms) SendRequestClientKeyMessage(_ *connect.Host, // Extract RSA pubkey clientRsaPub := clientTransmissionConfirmation.RSAPubKey - // Assemble Client public key into rsa.PublicKey + // Assemble Cmix public key into rsa.PublicKey userPublicKey, err := rsa.LoadPublicKeyFromPem([]byte(clientRsaPub)) if err != nil { m.t.Fatalf("Failed to load public key: %+v", err) diff --git a/connect/authenticated.go b/connect/authenticated.go index f12e4246016692d7b0aec8d0483f16d47314176b..01a76ee5cdc0b08ec338afb55af665396c75aa66 100644 --- a/connect/authenticated.go +++ b/connect/authenticated.go @@ -10,10 +10,10 @@ package connect import ( "github.com/pkg/errors" jww "github.com/spf13/jwalterweatherman" - "gitlab.com/elixxir/client/api/e2eApi" "gitlab.com/elixxir/client/catalog" "gitlab.com/elixxir/client/cmix" clientE2e "gitlab.com/elixxir/client/e2e" + "gitlab.com/elixxir/client/xxdk/e2eApi" "gitlab.com/elixxir/crypto/contact" "gitlab.com/elixxir/crypto/cyclic" "gitlab.com/elixxir/crypto/fastRNG" @@ -52,7 +52,7 @@ type AuthenticatedCallback func(connection AuthenticatedConnection) // ConnectWithAuthentication is called by the client, ie the one establishing // connection with the server. Once a connect.Connection has been established // with the server and then authenticate their identity to the server. -func ConnectWithAuthentication(recipient contact.Contact, e2eClient *e2eApi.Client, +func ConnectWithAuthentication(recipient contact.Contact, e2eClient *e2eApi.E2e, p Params) (AuthenticatedConnection, error) { // Track the time since we started to attempt to establish a connection diff --git a/connect/connect.go b/connect/connect.go index 10dc397137b53e060fc29077eab6d8f646283197..31e31ee15410a9340ad0fe304a705f50cd1a56f6 100644 --- a/connect/connect.go +++ b/connect/connect.go @@ -8,9 +8,9 @@ package connect import ( "encoding/json" - "gitlab.com/elixxir/client/api/e2eApi" "gitlab.com/elixxir/client/cmix" "gitlab.com/elixxir/client/storage/versioned" + "gitlab.com/elixxir/client/xxdk/e2eApi" "gitlab.com/elixxir/crypto/cyclic" "gitlab.com/elixxir/crypto/fastRNG" "gitlab.com/elixxir/ekv" @@ -119,7 +119,7 @@ func GetParameters(params string) (Params, error) { // and returns a Connection object for the newly-created partner.Manager // This function is to be used sender-side and will block until the // partner.Manager is confirmed. -func Connect(recipient contact.Contact, e2eClient *e2eApi.Client, +func Connect(recipient contact.Contact, e2eClient *e2eApi.E2e, p Params) (Connection, error) { // Build callback for E2E negotiation diff --git a/connect/utils_test.go b/connect/utils_test.go index 2d5bb68cfacf229904ce521590c175c035b0f538..5f6ac632101baabd6510a3ca14b9d46492f5f28c 100644 --- a/connect/utils_test.go +++ b/connect/utils_test.go @@ -187,7 +187,7 @@ func (m mockConnection) Unregister(listenerID receive.ListenerID) { } //////////////////////////////////////////////////////////////////////////////// -// Mock cMix Client // +// Mock cMix Cmix // //////////////////////////////////////////////////////////////////////////////// type mockCmix struct { diff --git a/dummy/manager.go b/dummy/manager.go index b7c94096101b293e5ee5f7b9ca42a4e9f89b4276..28ddd25e69c7e40bd2ee8a31a4b84d16ac9a7f5a 100644 --- a/dummy/manager.go +++ b/dummy/manager.go @@ -12,10 +12,10 @@ package dummy import ( "github.com/pkg/errors" - "gitlab.com/elixxir/client/api" "gitlab.com/elixxir/client/interfaces" "gitlab.com/elixxir/client/stoppable" "gitlab.com/elixxir/client/storage" + "gitlab.com/elixxir/client/xxdk" "gitlab.com/elixxir/crypto/fastRNG" "sync/atomic" "time" @@ -56,8 +56,8 @@ type Manager struct { // Pauses/Resumes the dummy send thread when triggered statusChan chan bool - // Client interfaces - client *api.Client + // Cmix interfaces + client *xxdk.Cmix store *storage.Session net interfaces.NetworkManager rng *fastRNG.StreamGenerator @@ -66,7 +66,7 @@ type Manager struct { // NewManager creates a new dummy Manager with the specified average send delta // and the range used for generating random durations. func NewManager(maxNumMessages int, avgSendDelta, randomRange time.Duration, - client *api.Client, manager interfaces.NetworkManager) *Manager { + client *xxdk.Cmix, manager interfaces.NetworkManager) *Manager { clientStorage := client.GetStorage() return newManager(maxNumMessages, avgSendDelta, randomRange, client, &clientStorage, manager, client.GetRng()) @@ -75,7 +75,7 @@ func NewManager(maxNumMessages int, avgSendDelta, randomRange time.Duration, // newManager builds a new dummy Manager from fields explicitly passed in. This // function is a helper function for NewManager to make it easier to test. func newManager(maxNumMessages int, avgSendDelta, randomRange time.Duration, - client *api.Client, store *storage.Session, net interfaces.NetworkManager, + client *xxdk.Cmix, store *storage.Session, net interfaces.NetworkManager, rng *fastRNG.StreamGenerator) *Manager { return &Manager{ maxNumMessages: maxNumMessages, @@ -91,7 +91,7 @@ func newManager(maxNumMessages int, avgSendDelta, randomRange time.Duration, } // StartDummyTraffic starts the process of sending dummy traffic. This function -// matches the api.Service type. +// matches the xxdk.Service type. func (m *Manager) StartDummyTraffic() (stoppable.Stoppable, error) { stop := stoppable.NewSingle(dummyTrafficStoppableName) go m.sendThread(stop) diff --git a/e2e/fpGenerator_test.go b/e2e/fpGenerator_test.go index ada64460a28221276304055f21056b3be92ae3dd..4aeb1a68e3c77063c358cab852f580583c16172f 100644 --- a/e2e/fpGenerator_test.go +++ b/e2e/fpGenerator_test.go @@ -98,7 +98,7 @@ func (m mockSessionCypher) Decrypt(format.Message) ([]byte, error) { return ni func (m mockSessionCypher) Use() {} //////////////////////////////////////////////////////////////////////////////// -// Mock cMix Client // +// Mock cMix Cmix // //////////////////////////////////////////////////////////////////////////////// type mockFpgCmix struct { diff --git a/e2e/utils_test.go b/e2e/utils_test.go index 0f84f037f132416f8ad0eb75d7faa9414cbde869..06eec9892c575029c1ba6333e878d64fb11a454e 100644 --- a/e2e/utils_test.go +++ b/e2e/utils_test.go @@ -121,7 +121,7 @@ func (m *mockServices) DeleteService( } //////////////////////////////////////////////////////////////////////////////// -// Mock cMix Client // +// Mock cMix Cmix // //////////////////////////////////////////////////////////////////////////////// type mockCmixHandler struct { diff --git a/fileTransfer/manager.go b/fileTransfer/manager.go index 246923be543a5404ac8b3249559ec370f6b75d73..03701de6adccc62944952c695a3126b7b26ef830 100644 --- a/fileTransfer/manager.go +++ b/fileTransfer/manager.go @@ -197,7 +197,7 @@ func NewManager(receiveCB ReceiveCallback, params Params, myID *id.ID, return m, nil } -// StartProcesses starts the sending threads. Adheres to the api.Service type. +// StartProcesses starts the sending threads. Adheres to the xxdk.Service type. func (m *manager) StartProcesses() (stoppable.Stoppable, error) { // Register listener to receive new file transfers m.e2e.RegisterListener( diff --git a/fileTransfer/send.go b/fileTransfer/send.go index ca66ae68118f6b11f6f433b5ee15658d9ce89432..f605f7ef03aa247384830b2cb57ed81ebe4d621d 100644 --- a/fileTransfer/send.go +++ b/fileTransfer/send.go @@ -85,7 +85,7 @@ func (m *manager) sendingThread(cMixParams cmix.CMIXParams, stop *stoppable.Sing } } -// sendCmix sends the parts in the packet via Client.SendMany. +// sendCmix sends the parts in the packet via Cmix.SendMany. func (m *manager) sendCmix(packet []store.Part, cMixParams cmix.CMIXParams) { // validParts will contain all parts in the original packet excluding those // that return an error from GetEncryptedPart diff --git a/fileTransfer/utils_test.go b/fileTransfer/utils_test.go index d54a1257f57b6c4625eaa2c819202bc8e35d49ff..3f6567ccaae086ac14c089c1f4d57618f2931c41 100644 --- a/fileTransfer/utils_test.go +++ b/fileTransfer/utils_test.go @@ -80,7 +80,7 @@ func RandStringBytes(n int, prng *rand.Rand) string { } //////////////////////////////////////////////////////////////////////////////// -// Mock cMix Client // +// Mock cMix Cmix // //////////////////////////////////////////////////////////////////////////////// type mockCmixHandler struct { diff --git a/fileTransfer2/connect/utils_test.go b/fileTransfer2/connect/utils_test.go index fc33ef813802b84eb8c779fb2a57a88e571c2692..2859e96c0c8052de2e8dd00f0a12229803348a56 100644 --- a/fileTransfer2/connect/utils_test.go +++ b/fileTransfer2/connect/utils_test.go @@ -26,7 +26,7 @@ import ( ) //////////////////////////////////////////////////////////////////////////////// -// Mock cMix Client // +// Mock cMix Cmix // //////////////////////////////////////////////////////////////////////////////// type mockCmixHandler struct { diff --git a/fileTransfer2/e2e/utils_test.go b/fileTransfer2/e2e/utils_test.go index ab49a4bc9acb43be14872786ec5841a14e5cfe72..59e0f9a5237f973b33a60bd79c14ba61159c5324 100644 --- a/fileTransfer2/e2e/utils_test.go +++ b/fileTransfer2/e2e/utils_test.go @@ -26,7 +26,7 @@ import ( ) //////////////////////////////////////////////////////////////////////////////// -// Mock cMix Client // +// Mock cMix Cmix // //////////////////////////////////////////////////////////////////////////////// type mockCmixHandler struct { diff --git a/fileTransfer2/groupChat/utils_test.go b/fileTransfer2/groupChat/utils_test.go index c5f1799afea975f6848d5bfe0da885f62a81ef25..05d3716335be1dce843cbe618eb8c041b938bfe9 100644 --- a/fileTransfer2/groupChat/utils_test.go +++ b/fileTransfer2/groupChat/utils_test.go @@ -23,7 +23,7 @@ import ( ) //////////////////////////////////////////////////////////////////////////////// -// Mock cMix Client // +// Mock cMix Cmix // //////////////////////////////////////////////////////////////////////////////// type mockCmixHandler struct { diff --git a/fileTransfer2/interface.go b/fileTransfer2/interface.go index b8e2f8ba08f66692b6bb45ae3f9afafcd5bca88f..b0fe8d5ac7137e08c72466865a68d1073f792c06 100644 --- a/fileTransfer2/interface.go +++ b/fileTransfer2/interface.go @@ -42,7 +42,7 @@ type SendNew func(transferInfo []byte) error type FileTransfer interface { // StartProcesses starts the sending threads that wait for file transfers to - // send. Adheres to the api.Service type. + // send. Adheres to the xxdk.Service type. StartProcesses() (stoppable.Stoppable, error) // MaxFileNameLen returns the max number of bytes allowed for a file name. diff --git a/fileTransfer2/manager.go b/fileTransfer2/manager.go index 9e3ab112ba5ffb1f2ed26606decd58851011f68b..4f517c1d13f6a65f053bbc5ea39c8798d340e88a 100644 --- a/fileTransfer2/manager.go +++ b/fileTransfer2/manager.go @@ -188,7 +188,7 @@ func NewManager(params Params, return m, nil } -// StartProcesses starts the sending threads. Adheres to the api.Service type. +// StartProcesses starts the sending threads. Adheres to the xxdk.Service type. func (m *manager) StartProcesses() (stoppable.Stoppable, error) { // Construct stoppables multiStop := stoppable.NewMulti(workerPoolStoppable) diff --git a/fileTransfer2/send.go b/fileTransfer2/send.go index 5c0d2074a66e56a6f64a63f5db4704ee2c5ea9d0..1d06dcc80ea2815f1434fbeef61f37dfa64f2938 100644 --- a/fileTransfer2/send.go +++ b/fileTransfer2/send.go @@ -89,7 +89,7 @@ func (m *manager) sendingThread(stop *stoppable.Single) { } } -// sendCmix sends the parts in the packet via Client.SendMany. +// sendCmix sends the parts in the packet via Cmix.SendMany. func (m *manager) sendCmix(packet []store.Part) { // validParts will contain all parts in the original packet excluding those // that return an error from GetEncryptedPart diff --git a/fileTransfer2/utils_test.go b/fileTransfer2/utils_test.go index cead9800a1ca549807ebf0e45fe92a60f277e921..4dd84c8ab707bdb0578535402e24326b06bc0b90 100644 --- a/fileTransfer2/utils_test.go +++ b/fileTransfer2/utils_test.go @@ -75,7 +75,7 @@ func RandStringBytes(n int, prng *rand.Rand) string { } //////////////////////////////////////////////////////////////////////////////// -// Mock cMix Client // +// Mock cMix Cmix // //////////////////////////////////////////////////////////////////////////////// type mockCmixHandler struct { diff --git a/groupChat/interface.go b/groupChat/interface.go index e9c71c51b0727167f97a63f05b8ab2a9f3d35d2a..9604b5d8b39726460f374d3531715be7697510f7 100644 --- a/groupChat/interface.go +++ b/groupChat/interface.go @@ -50,7 +50,7 @@ type GroupChat interface { // LeaveGroup removes a group from a list of groups the user is a part of. LeaveGroup(groupID *id.ID) error - // Send sends a message to all GroupChat members using Client.SendManyCMIX. + // Send sends a message to all GroupChat members using Cmix.SendManyCMIX. // The send fails if the message is too long. Returns the ID of the round // sent on and the timestamp of the message send. Send(groupID *id.ID, tag string, message []byte) ( diff --git a/groupChat/send.go b/groupChat/send.go index 9bed53b763ba45278ca9bd3abc37877fb155acd1..71624079ad5d42f1adce834249f8bdc9965edd4b 100644 --- a/groupChat/send.go +++ b/groupChat/send.go @@ -43,7 +43,7 @@ const ( saltReadLengthErr = "length of generated salt %d != %d required" ) -// Send sends a message to all group members using Client.SendMany. +// Send sends a message to all group members using Cmix.SendMany. // The send fails if the message is too long. func (m *manager) Send(groupID *id.ID, tag string, message []byte) ( id.Round, time.Time, group.MessageID, error) { diff --git a/registration/permissioning.go b/registration/permissioning.go index 917692eefc0e53c21220665c78494a0d0c7eb3b2..96e84aea7cda5acd6fba712a6e1a203cbc70aa69 100644 --- a/registration/permissioning.go +++ b/registration/permissioning.go @@ -33,7 +33,7 @@ func Init(comms *client.Comms, def *ndf.NetworkDefinition) (*Registration, error //add the registration host to comms hParam := connect.GetDefaultHostParams() hParam.AuthEnabled = false - // Client will not send KeepAlive packets + // Cmix will not send KeepAlive packets hParam.KaClientOpts.Time = time.Duration(math.MaxInt64) hParam.MaxRetries = 3 perm.host, err = comms.AddHost(&id.ClientRegistration, def.Registration.ClientRegistrationAddress, diff --git a/single/listener_test.go b/single/listener_test.go index f6f6bed68b4c5f1fe9f1a3e5849e73df2579e0ee..b5777cec7ec257ab14636099ce2bec51e50b9e44 100644 --- a/single/listener_test.go +++ b/single/listener_test.go @@ -222,7 +222,7 @@ func Test_listener_Stop(t *testing.T) { } //////////////////////////////////////////////////////////////////////////////// -// Mock cMix Client // +// Mock cMix Cmix // //////////////////////////////////////////////////////////////////////////////// type mockListenCmixHandler struct { diff --git a/single/receivedRequest_test.go b/single/receivedRequest_test.go index d5d8b15fb500270160f657ad82db712094a61e88..6c35b513b052d3f86b40446377669b734d5365c8 100644 --- a/single/receivedRequest_test.go +++ b/single/receivedRequest_test.go @@ -154,7 +154,7 @@ func Test_splitPayload(t *testing.T) { } //////////////////////////////////////////////////////////////////////////////// -// Mock cMix Client // +// Mock cMix Cmix // //////////////////////////////////////////////////////////////////////////////// type mockRequestCmix struct { diff --git a/single/utils_test.go b/single/utils_test.go index 473bb2dfa4025c02cee6bbca4d25e7e7506da3ef..bd2ff2ece8551b6370f226827b99c7bb990420cb 100644 --- a/single/utils_test.go +++ b/single/utils_test.go @@ -23,7 +23,7 @@ import ( ) //////////////////////////////////////////////////////////////////////////////// -// Mock cMix Client // +// Mock cMix Cmix // //////////////////////////////////////////////////////////////////////////////// // Tests that mockCmix adheres to the Cmix interface. diff --git a/ud/interfaces.go b/ud/interfaces.go index ba5bff8b7eb20cd55da1a1f9c7cf91d3478d8df1..db7f0b60333ddbc559520aa5ee9a12eb51594eea 100644 --- a/ud/interfaces.go +++ b/ud/interfaces.go @@ -1,9 +1,9 @@ package ud import ( - "gitlab.com/elixxir/client/api" "gitlab.com/elixxir/client/single" "gitlab.com/elixxir/client/storage/user" + "gitlab.com/elixxir/client/xxdk" "gitlab.com/elixxir/crypto/cyclic" "gitlab.com/xx_network/primitives/id" ) @@ -37,6 +37,6 @@ type UserInfo interface { GetReceptionRegistrationValidationSignature() []byte } -// NetworkStatus is an interface for the api.Client's +// NetworkStatus is an interface for the xxdk.Cmix's // NetworkFollowerStatus method. -type NetworkStatus func() api.Status +type NetworkStatus func() xxdk.Status diff --git a/ud/manager.go b/ud/manager.go index 3cd1b679a3586248c14f8608eb31cddb2e1f43e7..1ce22eac8d6c24812c381fdc60753e07ba5e5e66 100644 --- a/ud/manager.go +++ b/ud/manager.go @@ -7,10 +7,10 @@ import ( "github.com/pkg/errors" jww "github.com/spf13/jwalterweatherman" - "gitlab.com/elixxir/client/api" "gitlab.com/elixxir/client/event" "gitlab.com/elixxir/client/storage/versioned" store "gitlab.com/elixxir/client/ud/store" + "gitlab.com/elixxir/client/xxdk" "gitlab.com/elixxir/crypto/contact" "gitlab.com/elixxir/primitives/fact" "gitlab.com/xx_network/comms/connect" @@ -77,7 +77,7 @@ func NewManager(services CMix, e2e E2E, kv *versioned.KV) (*Manager, error) { jww.INFO.Println("ud.NewManager()") - if follower() != api.Running { + if follower() != xxdk.Running { return nil, errors.New( "cannot start UD Manager when network follower is not running.") } @@ -134,7 +134,7 @@ func NewManagerFromBackup(services CMix, events event.Reporter, comms Comms, userStore UserInfo, email, phone fact.Fact, kv *versioned.KV) (*Manager, error) { jww.INFO.Println("ud.NewManagerFromBackup()") - if follower() != api.Running { + if follower() != xxdk.Running { return nil, errors.New( "cannot start UD Manager when " + "network follower is not running.") diff --git a/api/e2eApi/backup.go b/xxdk/backup.go similarity index 80% rename from api/e2eApi/backup.go rename to xxdk/backup.go index c547307fcac9c2f65267a8e32062f3cdd8f5bfc6..6b02e9ad5635a3984c485487a6c714eacc003f62 100644 --- a/api/e2eApi/backup.go +++ b/xxdk/backup.go @@ -1,11 +1,10 @@ //////////////////////////////////////////////////////////////////////////////// -// Copyright © 2020 xx network SEZC // -// // -// Use of this source code is governed by a license that can be found in the // -// LICENSE file // +// Copyright © 2022 Privategrity Corporation / +// / +// All rights reserved. / //////////////////////////////////////////////////////////////////////////////// -package e2eApi +package xxdk import "sync" diff --git a/api/e2eApi/backupRestore.go b/xxdk/backupRestore.go similarity index 79% rename from api/e2eApi/backupRestore.go rename to xxdk/backupRestore.go index 809ae8d13abaae38c51214030a5cf52fcc4748bb..092b5a7fdf8d77757e0b5cd445b7c27fe09e6a01 100644 --- a/api/e2eApi/backupRestore.go +++ b/xxdk/backupRestore.go @@ -1,11 +1,16 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright © 2022 Privategrity Corporation / +// / +// All rights reserved. / +//////////////////////////////////////////////////////////////////////////////// + // FIXME: This is placeholder, there's got to be a better place to put // backup restoration than inside messenger. -package e2eApi +package xxdk import ( "github.com/pkg/errors" - "gitlab.com/elixxir/client/api" "gitlab.com/elixxir/client/e2e" "gitlab.com/elixxir/client/e2e/rekey" "gitlab.com/elixxir/client/storage" @@ -16,7 +21,7 @@ import ( "gitlab.com/xx_network/primitives/id" ) -// NewClientFromBackup constructs a new Client from an encrypted +// NewClientFromBackup constructs a new E2e from an encrypted // backup. The backup is decrypted using the backupPassphrase. On // success a successful client creation, the function will return a // JSON encoded list of the E2E partners contained in the backup and a @@ -34,15 +39,15 @@ func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword, usr := user.NewUserFromBackup(backUp) - def, err := api.ParseNDF(ndfJSON) + def, err := ParseNDF(ndfJSON) if err != nil { return nil, "", err } - cmixGrp, e2eGrp := api.DecodeGroups(def) + cmixGrp, e2eGrp := DecodeGroups(def) // Note we do not need registration here - storageSess, err := api.CheckVersionAndSetupStorage(def, storageDir, + storageSess, err := CheckVersionAndSetupStorage(def, storageDir, []byte(sessionPassword), usr, cmixGrp, e2eGrp, backUp.RegistrationCode) if err != nil { diff --git a/api/client.go b/xxdk/client.go similarity index 92% rename from api/client.go rename to xxdk/client.go index 002542157ea6a8e49924aa0d44e4419566d1d450..98e483c89ef19c34e82e1206e281dae35283255d 100644 --- a/api/client.go +++ b/xxdk/client.go @@ -5,7 +5,7 @@ // LICENSE file // /////////////////////////////////////////////////////////////////////////////// -package api +package xxdk import ( "encoding/json" @@ -39,7 +39,7 @@ import ( const followerStoppableName = "client" -type Client struct { +type Cmix struct { //generic RNG for client rng *fastRNG.StreamGenerator // the storage session securely stores data to disk and memoizes as is @@ -122,7 +122,7 @@ func NewVanityClient(ndfJSON, storageDir string, password []byte, // OpenClient session, but don't connect to the network or log in func OpenClient(storageDir string, password []byte, - parameters Params) (*Client, error) { + parameters Params) (*Cmix, error) { jww.INFO.Printf("OpenClient()") rngStreamGen := fastRNG.NewStreamGenerator(12, 1024, @@ -141,7 +141,7 @@ func OpenClient(storageDir string, password []byte, return nil, err } - c := &Client{ + c := &Cmix{ storage: storageSess, rng: rngStreamGen, comms: nil, @@ -211,7 +211,7 @@ func NewProtoClient_Unsafe(ndfJSON, storageDir string, password, } // Login initializes a client object from existing storage. -func Login(storageDir string, password []byte, parameters Params) (*Client, error) { +func Login(storageDir string, password []byte, parameters Params) (*Cmix, error) { jww.INFO.Printf("Login()") c, err := OpenClient(storageDir, password, parameters) @@ -219,7 +219,7 @@ func Login(storageDir string, password []byte, parameters Params) (*Client, erro return nil, err } - jww.INFO.Printf("Client Logged in: \n\tTransmissionID: %s "+ + jww.INFO.Printf("Cmix Logged in: \n\tTransmissionID: %s "+ "\n\tReceptionID: %s", c.storage.GetTransmissionID(), c.storage.GetReceptionID()) def := c.storage.GetNDF() @@ -232,13 +232,13 @@ func Login(storageDir string, password []byte, parameters Params) (*Client, erro } } else { jww.WARN.Printf("Registration with permissioning skipped due " + - "to blank permissioning address. Client will not be " + + "to blank permissioning address. Cmix will not be " + "able to register or track network.") } if def.Notification.Address != "" { hp := connect.GetDefaultHostParams() - // Client will not send KeepAlive packets + // Cmix will not send KeepAlive packets hp.KaClientOpts.Time = time.Duration(math.MaxInt64) hp.AuthEnabled = false hp.MaxRetries = 5 @@ -269,7 +269,7 @@ func Login(storageDir string, password []byte, parameters Params) (*Client, erro // procedures and is generally unsafe. func LoginWithNewBaseNDF_UNSAFE(storageDir string, password []byte, newBaseNdf string, authCallbacks auth.Callbacks, - params Params) (*Client, error) { + params Params) (*Cmix, error) { jww.INFO.Printf("LoginWithNewBaseNDF_UNSAFE()") def, err := ParseNDF(newBaseNdf) @@ -292,7 +292,7 @@ func LoginWithNewBaseNDF_UNSAFE(storageDir string, password []byte, } } else { jww.WARN.Printf("Registration with permissioning skipped due " + - "to blank permissionign address. Client will not be " + + "to blank permissionign address. Cmix will not be " + "able to register or track network.") } @@ -314,7 +314,7 @@ func LoginWithNewBaseNDF_UNSAFE(storageDir string, password []byte, // some specific deployment procedures and is generally unsafe. func LoginWithProtoClient(storageDir string, password []byte, protoClientJSON []byte, newBaseNdf string, - params Params) (*Client, error) { + params Params) (*Cmix, error) { jww.INFO.Printf("LoginWithProtoClient()") def, err := ParseNDF(newBaseNdf) @@ -359,7 +359,7 @@ func LoginWithProtoClient(storageDir string, password []byte, return c, nil } -func (c *Client) initComms() error { +func (c *Cmix) initComms() error { var err error //get the user from session @@ -376,7 +376,7 @@ func (c *Client) initComms() error { return nil } -func (c *Client) initPermissioning(def *ndf.NetworkDefinition) error { +func (c *Cmix) initPermissioning(def *ndf.NetworkDefinition) error { var err error //initialize registration c.permissioning, err = registration.Init(c.comms, def) @@ -387,15 +387,15 @@ func (c *Client) initPermissioning(def *ndf.NetworkDefinition) error { //register with registration if necessary if c.storage.GetRegistrationStatus() == storage.KeyGenComplete { - jww.INFO.Printf("Client has not registered yet, " + + jww.INFO.Printf("Cmix has not registered yet, " + "attempting registration") err = c.registerWithPermissioning() if err != nil { - jww.ERROR.Printf("Client has failed registration: %s", + jww.ERROR.Printf("Cmix has failed registration: %s", err) return errors.WithMessage(err, "failed to load client") } - jww.INFO.Printf("Client successfully registered " + + jww.INFO.Printf("Cmix successfully registered " + "with the network") } return nil @@ -404,7 +404,7 @@ func (c *Client) initPermissioning(def *ndf.NetworkDefinition) error { // registerFollower adds the follower processes to the client's // follower service list. // This should only ever be called once -func (c *Client) registerFollower() error { +func (c *Cmix) registerFollower() error { //build the error callback cer := func(source, message, trace string) { select { @@ -436,12 +436,12 @@ func (c *Client) registerFollower() error { return nil } -// ----- Client Functions ----- +// ----- Cmix Functions ----- // GetErrorsChannel returns a channel which passes errors from the // long-running threads controlled by StartNetworkFollower and // StopNetworkFollower -func (c *Client) GetErrorsChannel() <-chan interfaces.ClientError { +func (c *Cmix) GetErrorsChannel() <-chan interfaces.ClientError { return c.clientErrorChannel } @@ -479,7 +479,7 @@ func (c *Client) GetErrorsChannel() <-chan interfaces.ClientError { // Responds to confirmations of successful rekey operations // - Auth Callback (/auth/callback.go) // Handles both auth confirm and requests -func (c *Client) StartNetworkFollower(timeout time.Duration) error { +func (c *Cmix) StartNetworkFollower(timeout time.Duration) error { jww.INFO.Printf("StartNetworkFollower() \n\tTransmissionID: %s "+ "\n\tReceptionID: %s", c.storage.GetTransmissionID(), c.storage.GetReceptionID()) @@ -491,7 +491,7 @@ func (c *Client) StartNetworkFollower(timeout time.Duration) error { // fails to stop it. // if the network follower is running and this fails, the client object will // most likely be in an unrecoverable state and need to be trashed. -func (c *Client) StopNetworkFollower() error { +func (c *Cmix) StopNetworkFollower() error { jww.INFO.Printf("StopNetworkFollower()") return c.followerServices.stop() } @@ -501,62 +501,62 @@ func (c *Client) StopNetworkFollower() error { // Starting - 1000 // Running - 2000 // Stopping - 3000 -func (c *Client) NetworkFollowerStatus() Status { +func (c *Cmix) NetworkFollowerStatus() Status { jww.INFO.Printf("NetworkFollowerStatus()") return c.followerServices.status() } // HasRunningProcessies checks if any background threads are running // and returns true if one or more are -func (c *Client) HasRunningProcessies() bool { +func (c *Cmix) HasRunningProcessies() bool { return !c.followerServices.stoppable.IsStopped() } // RegisterRoundEventsCb registers a callback for round // events. -func (c *Client) GetRoundEvents() interfaces.RoundEvents { +func (c *Cmix) GetRoundEvents() interfaces.RoundEvents { jww.INFO.Printf("GetRoundEvents()") - jww.WARN.Printf("GetRoundEvents does not handle Client Errors " + + jww.WARN.Printf("GetRoundEvents does not handle Cmix Errors " + "edge case!") return c.network.GetInstance().GetRoundEvents() } // AddService adds a service ot be controlled by the client thread control, // these will be started and stopped with the network follower -func (c *Client) AddService(sp Service) error { +func (c *Cmix) AddService(sp Service) error { return c.followerServices.add(sp) } // GetUser returns the current user Identity for this client. This // can be serialized into a byte stream for out-of-band sharing. -func (c *Client) GetUser() user.Info { +func (c *Cmix) GetUser() user.Info { jww.INFO.Printf("GetUser()") cMixUser := c.storage.PortableUserInfo() return cMixUser } // GetComms returns the client comms object -func (c *Client) GetComms() *client.Comms { +func (c *Cmix) GetComms() *client.Comms { return c.comms } // GetRng returns the client rng object -func (c *Client) GetRng() *fastRNG.StreamGenerator { +func (c *Cmix) GetRng() *fastRNG.StreamGenerator { return c.rng } // GetStorage returns the client storage object -func (c *Client) GetStorage() storage.Session { +func (c *Cmix) GetStorage() storage.Session { return c.storage } // GetCmix returns the client Network Interface -func (c *Client) GetCmix() cmix.Client { +func (c *Cmix) GetCmix() cmix.Client { return c.network } // GetEventReporter returns the event reporter -func (c *Client) GetEventReporter() event.Reporter { +func (c *Cmix) GetEventReporter() event.Reporter { return c.events } @@ -564,7 +564,7 @@ func (c *Client) GetEventReporter() event.Reporter { // returns the total number of nodes in the NDF and the number of those which // are currently registers with. An error is returned if the network is not // healthy. -func (c *Client) GetNodeRegistrationStatus() (int, int, error) { +func (c *Cmix) GetNodeRegistrationStatus() (int, int, error) { // Return an error if the network is not healthy if !c.GetCmix().IsHealthy() { return 0, 0, errors.New("Cannot get number of nodes " + @@ -596,7 +596,7 @@ func (c *Client) GetNodeRegistrationStatus() (int, int, error) { // GetPreferredBins returns the geographic bin or bins that the provided two // character country code is a part of. -func (c *Client) GetPreferredBins(countryCode string) ([]string, error) { +func (c *Cmix) GetPreferredBins(countryCode string) ([]string, error) { // get the bin that the country is in bin, exists := region.GetCountryBin(countryCode) if !exists { diff --git a/api/e2eApi/compress_test.go b/xxdk/compress_test.go similarity index 99% rename from api/e2eApi/compress_test.go rename to xxdk/compress_test.go index 052e3bb3d8abd88c1fa6e2c3a7f76c7eb9d9f171..75d020eebdd4efb15be25326c248e4f6b17834da 100644 --- a/api/e2eApi/compress_test.go +++ b/xxdk/compress_test.go @@ -1,11 +1,10 @@ -/////////////////////////////////////////////////////////////////////////////// -// Copyright © 2020 xx network SEZC // -// // -// Use of this source code is governed by a license that can be found in the // -// LICENSE file // -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// Copyright © 2022 Privategrity Corporation / +// / +// All rights reserved. / +//////////////////////////////////////////////////////////////////////////////// -package e2eApi +package xxdk import ( "bytes" diff --git a/api/e2eApi/e2eApi.go b/xxdk/e2e.go similarity index 78% rename from api/e2eApi/e2eApi.go rename to xxdk/e2e.go index 1b3f5d376edbe739b0ad145ed91be23dab89e2ac..5e33d6258f5f13dfda1c258cf4ec4ec79c0e6e89 100644 --- a/api/e2eApi/e2eApi.go +++ b/xxdk/e2e.go @@ -1,4 +1,10 @@ -package e2eApi +//////////////////////////////////////////////////////////////////////////////// +// Copyright © 2022 Privategrity Corporation / +// / +// All rights reserved. / +//////////////////////////////////////////////////////////////////////////////// + +package xxdk import ( "encoding/binary" @@ -9,7 +15,6 @@ import ( "github.com/pkg/errors" jww "github.com/spf13/jwalterweatherman" - "gitlab.com/elixxir/client/api" "gitlab.com/elixxir/client/auth" "gitlab.com/elixxir/client/e2e" "gitlab.com/elixxir/client/e2e/rekey" @@ -19,35 +24,35 @@ import ( "gitlab.com/xx_network/primitives/id" ) -type Client struct { - *api.Client +type E2e struct { + *Cmix auth auth.State e2e e2e.Handler backup *Container e2eIdentity TransmissionIdentity } -// Login creates a new e2eApi.Client backed by the api.Client persistent versioned.KV +// Login creates a new e2eApi.E2e backed by the xxdk.Cmix persistent versioned.KV // If identity == nil, a new TransmissionIdentity will be generated automagically -func Login(client *api.Client, callbacks auth.Callbacks, - identity *TransmissionIdentity) (m *Client, err error) { +func Login(client *Cmix, callbacks auth.Callbacks, + identity *TransmissionIdentity) (m *E2e, err error) { return login(client, callbacks, identity, client.GetStorage().GetKV()) } -// LoginEphemeral creates a new e2eApi.Client backed by a totally ephemeral versioned.KV +// LoginEphemeral creates a new e2eApi.E2e backed by a totally ephemeral versioned.KV // If identity == nil, a new TransmissionIdentity will be generated automagically -func LoginEphemeral(client *api.Client, callbacks auth.Callbacks, - identity *TransmissionIdentity) (m *Client, err error) { +func LoginEphemeral(client *Cmix, callbacks auth.Callbacks, + identity *TransmissionIdentity) (m *E2e, err error) { return login(client, callbacks, identity, versioned.NewKV(ekv.MakeMemstore())) } -// LoginLegacy creates a new e2eApi.Client backed by the api.Client persistent versioned.KV -// Uses the pre-generated transmission ID used by api.Client +// LoginLegacy creates a new e2eApi.E2e backed by the xxdk.Cmix persistent versioned.KV +// Uses the pre-generated transmission ID used by xxdk.Cmix // This function is designed to maintain backwards compatibility with previous xx messenger designs // and should not be used for other purposes -func LoginLegacy(client *api.Client, callbacks auth.Callbacks) (m *Client, err error) { - m = &Client{ - Client: client, +func LoginLegacy(client *Cmix, callbacks auth.Callbacks) (m *E2e, err error) { + m = &E2e{ + Cmix: client, backup: &Container{}, } @@ -63,7 +68,7 @@ func LoginLegacy(client *api.Client, callbacks auth.Callbacks) (m *Client, err e return nil, err } - u := m.Client.GetUser() + u := m.Cmix.GetUser() m.e2eIdentity = TransmissionIdentity{ ID: u.TransmissionID, RSAPrivatePem: u.TransmissionRSA, @@ -74,9 +79,9 @@ func LoginLegacy(client *api.Client, callbacks auth.Callbacks) (m *Client, err e return m, err } -// login creates a new e2eApi.Client backed by the given versioned.KV -func login(client *api.Client, callbacks auth.Callbacks, - identity *TransmissionIdentity, kv *versioned.KV) (m *Client, err error) { +// login creates a new e2eApi.E2e backed by the given versioned.KV +func login(client *Cmix, callbacks auth.Callbacks, + identity *TransmissionIdentity, kv *versioned.KV) (m *E2e, err error) { e2eGrp := client.GetStorage().GetE2EGroup() // Create new identity automatically if one isn't specified @@ -91,8 +96,8 @@ func login(client *api.Client, callbacks auth.Callbacks, client.GetCmix().AddIdentity(identity.ID, time.Time{}, !kv.IsMemStore()) } - m = &Client{ - Client: client, + m = &E2e{ + Cmix: client, backup: &Container{}, e2eIdentity: *identity, } @@ -126,7 +131,7 @@ func login(client *api.Client, callbacks auth.Callbacks, // LoadOrInitE2e loads the e2e handler or makes a new one, generating a new // e2e private key. It attempts to load via a legacy construction, then tries // to load the modern one, creating a new modern ID if neither can be found -func LoadOrInitE2e(client *api.Client) (e2e.Handler, error) { +func LoadOrInitE2e(client *Cmix) (e2e.Handler, error) { usr := client.GetUser() e2eGrp := client.GetStorage().GetE2EGroup() kv := client.GetStorage().GetKV() @@ -194,23 +199,23 @@ func LoadOrInitE2e(client *api.Client) (e2e.Handler, error) { return e2eHandler, nil } -// GetUser replaces api.Client's GetUser with one which includes the e2e dh +// GetUser replaces xxdk.Cmix's GetUser with one which includes the e2e dh // private keys -func (m *Client) GetUser() user.Info { - u := m.Client.GetUser() +func (m *E2e) GetUser() user.Info { + u := m.Cmix.GetUser() u.E2eDhPrivateKey = m.e2e.GetHistoricalDHPrivkey() u.E2eDhPublicKey = m.e2e.GetHistoricalDHPubkey() return u } -// GetTransmissionIdentity returns a safe copy of the Client TransmissionIdentity -func (m *Client) GetTransmissionIdentity() TransmissionIdentity { +// GetTransmissionIdentity returns a safe copy of the E2e TransmissionIdentity +func (m *E2e) GetTransmissionIdentity() TransmissionIdentity { return m.e2eIdentity.DeepCopy() } // ConstructProtoUserFile is a helper function which is used for proto // client testing. This is used for development testing. -func (m *Client) ConstructProtoUserFile() ([]byte, error) { +func (m *E2e) ConstructProtoUserFile() ([]byte, error) { //load the registration code regCode, err := m.GetStorage().GetRegCode() @@ -244,20 +249,20 @@ func (m *Client) ConstructProtoUserFile() ([]byte, error) { return jsonBytes, nil } -func (m *Client) GetAuth() auth.State { +func (m *E2e) GetAuth() auth.State { return m.auth } -func (m *Client) GetE2E() e2e.Handler { +func (m *E2e) GetE2E() e2e.Handler { return m.e2e } -func (m *Client) GetBackupContainer() *Container { +func (m *E2e) GetBackupContainer() *Container { return m.backup } -// DeleteContact is a function which removes a partner from Client's storage -func (m *Client) DeleteContact(partnerId *id.ID) error { +// DeleteContact is a function which removes a partner from E2e's storage +func (m *E2e) DeleteContact(partnerId *id.ID) error { jww.DEBUG.Printf("Deleting contact with ID %s", partnerId) _, err := m.e2e.GetPartner(partnerId) diff --git a/api/event.go b/xxdk/event.go similarity index 76% rename from api/event.go rename to xxdk/event.go index 52fa3c1708dce3a5cd074d1a4030859219be7760..cd1897454b70731c4371de68804d5de154aff40d 100644 --- a/api/event.go +++ b/xxdk/event.go @@ -1,4 +1,4 @@ -package api +package xxdk import ( "gitlab.com/elixxir/client/event" @@ -6,20 +6,20 @@ import ( // ReportEvent reports an event from the client to api users, providing a // priority, category, eventType, and details -func (c *Client) ReportEvent(priority int, category, evtType, details string) { +func (c *Cmix) ReportEvent(priority int, category, evtType, details string) { c.events.Report(priority, category, evtType, details) } // RegisterEventCallback records the given function to receive // ReportableEvent objects. It returns the internal index // of the callback so that it can be deleted later. -func (c *Client) RegisterEventCallback(name string, +func (c *Cmix) RegisterEventCallback(name string, myFunc event.Callback) error { return c.events.RegisterEventCallback(name, myFunc) } // UnregisterEventCallback deletes the callback identified by the // index. It returns an error if it fails. -func (c *Client) UnregisterEventCallback(name string) { +func (c *Cmix) UnregisterEventCallback(name string) { c.events.UnregisterEventCallback(name) } diff --git a/api/e2eApi/identity.go b/xxdk/identity.go similarity index 99% rename from api/e2eApi/identity.go rename to xxdk/identity.go index dc9874ed6ce12e9e32c16697f8a63599ec1258a8..daef4c673bbf1668ae1a11dc294adfeaaa945e1c 100644 --- a/api/e2eApi/identity.go +++ b/xxdk/identity.go @@ -4,7 +4,7 @@ // All rights reserved. / //////////////////////////////////////////////////////////////////////////////// -package e2eApi +package xxdk import ( "gitlab.com/elixxir/crypto/cyclic" diff --git a/api/mnemonic.go b/xxdk/mnemonic.go similarity index 99% rename from api/mnemonic.go rename to xxdk/mnemonic.go index 9b262da82c81bebcc01fd185adbc5d60a196cb6b..3a2e2051b9485d225704c2896caa6da6319b5dc0 100644 --- a/api/mnemonic.go +++ b/xxdk/mnemonic.go @@ -5,7 +5,7 @@ // LICENSE file // /////////////////////////////////////////////////////////////////////////////// -package api +package xxdk import ( "github.com/pkg/errors" diff --git a/api/mnemonic_test.go b/xxdk/mnemonic_test.go similarity index 99% rename from api/mnemonic_test.go rename to xxdk/mnemonic_test.go index a56a73b1f524018f686af392478f89b7dc2d1dc9..326e16dc22f36ee6b6d9e91ba189fba19cb5e5cd 100644 --- a/api/mnemonic_test.go +++ b/xxdk/mnemonic_test.go @@ -5,7 +5,7 @@ // LICENSE file // /////////////////////////////////////////////////////////////////////////////// -package api +package xxdk import ( "bytes" diff --git a/api/ndf.go b/xxdk/ndf.go similarity index 99% rename from api/ndf.go rename to xxdk/ndf.go index efe7e86ae0c6b0f38c3be734c7623e99a6e92823..d67edc0d93ec8a0e1928e5cf07fb851d4f4942f7 100644 --- a/api/ndf.go +++ b/xxdk/ndf.go @@ -5,7 +5,7 @@ // LICENSE file // /////////////////////////////////////////////////////////////////////////////// -package api +package xxdk import ( "encoding/base64" diff --git a/api/e2eApi/notifications.go b/xxdk/notifications.go similarity index 88% rename from api/e2eApi/notifications.go rename to xxdk/notifications.go index 5a737563951c3d28ba40df7742be430eee731214..32fe156d9318985d964b95717126b701ece0865d 100644 --- a/api/e2eApi/notifications.go +++ b/xxdk/notifications.go @@ -1,11 +1,10 @@ -/////////////////////////////////////////////////////////////////////////////// -// Copyright © 2020 xx network SEZC // -// // -// Use of this source code is governed by a license that can be found in the // -// LICENSE file // -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// Copyright © 2022 Privategrity Corporation / +// / +// All rights reserved. / +//////////////////////////////////////////////////////////////////////////////// -package e2eApi +package xxdk import ( "github.com/pkg/errors" @@ -23,7 +22,7 @@ import ( // especially as these rely on third parties (i.e., Firebase *cough* // *cough* google's palantir *cough*) that may represent a security // risk to the user. -func (m *Client) RegisterForNotifications(token string) error { +func (m *E2e) RegisterForNotifications(token string) error { jww.INFO.Printf("RegisterForNotifications(%s)", token) // Pull the host from the manage notificationBotHost, ok := m.GetComms().GetHost(&id.NotificationBot) @@ -61,7 +60,7 @@ func (m *Client) RegisterForNotifications(token string) error { } // UnregisterForNotifications turns of notifications for this client -func (m *Client) UnregisterForNotifications() error { +func (m *E2e) UnregisterForNotifications() error { jww.INFO.Printf("UnregisterForNotifications()") // Pull the host from the manage notificationBotHost, ok := m.GetComms().GetHost(&id.NotificationBot) @@ -86,7 +85,7 @@ func (m *Client) UnregisterForNotifications() error { return nil } -func (m *Client) getIidAndSig() ([]byte, []byte, error) { +func (m *E2e) getIidAndSig() ([]byte, []byte, error) { intermediaryReceptionID, err := ephemeral.GetIntermediaryId(m.GetStorage().GetReceptionID()) if err != nil { return nil, nil, errors.WithMessage(err, "RegisterForNotifications: Failed to form intermediary ID") diff --git a/api/params.go b/xxdk/params.go similarity index 98% rename from api/params.go rename to xxdk/params.go index 39f9d8db3768ac00c454bf89d2ba8b5326c9fb4e..c5768a2a0512560367f9e0cb5ad3d7f9221ab3c9 100644 --- a/api/params.go +++ b/xxdk/params.go @@ -5,7 +5,7 @@ // LICENSE file // /////////////////////////////////////////////////////////////////////////////// -package api +package xxdk import ( "encoding/json" diff --git a/api/params_test.go b/xxdk/params_test.go similarity index 99% rename from api/params_test.go rename to xxdk/params_test.go index 35bf61d8f10e5b494a8459f64d239d1569df36b4..13868e1fb03e192a9a94cc916960d4121a871b08 100644 --- a/api/params_test.go +++ b/xxdk/params_test.go @@ -5,7 +5,7 @@ // LICENSE file // /////////////////////////////////////////////////////////////////////////////// -package api +package xxdk import ( "bytes" diff --git a/api/permissioning.go b/xxdk/permissioning.go similarity index 96% rename from api/permissioning.go rename to xxdk/permissioning.go index ee25a57e0ccf6adcf5820d432f49519a1493c4a5..2e1d735e1236c410bfb473e7d02bad87b6f73536 100644 --- a/api/permissioning.go +++ b/xxdk/permissioning.go @@ -5,7 +5,7 @@ // LICENSE file // /////////////////////////////////////////////////////////////////////////////// -package api +package xxdk import ( "encoding/json" @@ -15,7 +15,7 @@ import ( ) // Returns an error if registration fails. -func (c *Client) registerWithPermissioning() error { +func (c *Cmix) registerWithPermissioning() error { //get the users public key transmissionPubKey := c.storage.GetTransmissionRSA().GetPublic() receptionPubKey := c.storage.GetReceptionRSA().GetPublic() @@ -54,7 +54,7 @@ func (c *Client) registerWithPermissioning() error { // ConstructProtoUserFile is a helper function which is used for proto // client testing. This is used for development testing. -func (c *Client) ConstructProtoUserFile() ([]byte, error) { +func (c *Cmix) ConstructProtoUserFile() ([]byte, error) { //load the registration code regCode, err := c.storage.GetRegCode() diff --git a/xxdk/precan.go b/xxdk/precan.go new file mode 100644 index 0000000000000000000000000000000000000000..b710954cc27f6901d5f4b0226a3b5aa920bb8f4a --- /dev/null +++ b/xxdk/precan.go @@ -0,0 +1,166 @@ +/////////////////////////////////////////////////////////////////////////////// +// Copyright © 2020 xx network SEZC // +// // +// Use of this source code is governed by a license that can be found in the // +// LICENSE file // +/////////////////////////////////////////////////////////////////////////////// + +package xxdk + +import ( + "encoding/binary" + "github.com/cloudflare/circl/dh/sidh" + "gitlab.com/elixxir/client/e2e/ratchet/partner/session" + util "gitlab.com/elixxir/client/storage/utility" + "gitlab.com/elixxir/crypto/contact" + "gitlab.com/elixxir/crypto/cyclic" + "gitlab.com/elixxir/crypto/diffieHellman" + "gitlab.com/elixxir/primitives/fact" + "math/rand" + + jww "github.com/spf13/jwalterweatherman" + "gitlab.com/elixxir/client/storage" + "gitlab.com/elixxir/client/storage/user" + "gitlab.com/elixxir/crypto/fastRNG" + "gitlab.com/xx_network/crypto/csprng" + "gitlab.com/xx_network/crypto/signature/rsa" + "gitlab.com/xx_network/primitives/id" +) + +// CreatePrecannedUser creates a precanned user +func CreatePrecannedUser(precannedID uint, rng csprng.Source) user.Info { + + // Salt, UID, etc gen + salt := make([]byte, SaltSize) + + userID := id.ID{} + binary.BigEndian.PutUint64(userID[:], uint64(precannedID)) + userID.SetType(id.User) + + // NOTE: not used... RSA Keygen (4096 bit defaults) + rsaKey, err := rsa.GenerateKey(rng, rsa.DefaultRSABitLen) + if err != nil { + jww.FATAL.Panicf(err.Error()) + } + + return user.Info{ + TransmissionID: &userID, + TransmissionSalt: salt, + ReceptionID: &userID, + ReceptionSalt: salt, + Precanned: true, + E2eDhPrivateKey: nil, + E2eDhPublicKey: nil, + TransmissionRSA: rsaKey, + ReceptionRSA: rsaKey, + } +} + +// NewPrecannedClient creates an insecure user with predetermined keys +// with nodes It creates client storage, generates keys, connects, and +// registers with the network. Note that this does not register a +// username/identity, but merely creates a new cryptographic identity +// for adding such information at a later date. +func NewPrecannedClient(precannedID uint, defJSON, storageDir string, + password []byte) error { + jww.INFO.Printf("NewPrecannedClient()") + rngStreamGen := fastRNG.NewStreamGenerator(12, 1024, + csprng.NewSystemRNG) + rngStream := rngStreamGen.GetStream() + + def, err := ParseNDF(defJSON) + if err != nil { + return err + } + cmixGrp, e2eGrp := DecodeGroups(def) + + protoUser := CreatePrecannedUser(precannedID, rngStream) + + store, err := CheckVersionAndSetupStorage(def, storageDir, password, + protoUser, cmixGrp, e2eGrp, "") + if err != nil { + return err + } + + // Mark the precanned user as finished with permissioning and registered + // with the network. + err = store.ForwardRegistrationStatus(storage.PermissioningComplete) + if err != nil { + return err + } + + return nil +} + +func generatePrecanDHKeypair(precannedID uint, e2eGrp *cyclic.Group) *cyclic.Int { + // DH Keygen + prng := rand.New(rand.NewSource(int64(precannedID))) + prime := e2eGrp.GetPBytes() + keyLen := len(prime) + priv := diffieHellman.GeneratePrivateKey(keyLen, e2eGrp, prng) + return priv +} + +// Create an insecure e2e relationship with a precanned user +func (m *E2e) MakePrecannedAuthenticatedChannel(precannedID uint) ( + contact.Contact, error) { + + precan := m.MakePrecannedContact(precannedID) + + myID := binary.BigEndian.Uint64(m.GetStorage().GetReceptionID()[:]) + // Pick a variant based on if their ID is bigger than mine. + myVariant := sidh.KeyVariantSidhA + theirVariant := sidh.KeyVariant(sidh.KeyVariantSidhB) + if myID > uint64(precannedID) { + myVariant = sidh.KeyVariantSidhB + theirVariant = sidh.KeyVariantSidhA + } + prng1 := rand.New(rand.NewSource(int64(precannedID))) + theirSIDHPrivKey := util.NewSIDHPrivateKey(theirVariant) + theirSIDHPubKey := util.NewSIDHPublicKey(theirVariant) + theirSIDHPrivKey.Generate(prng1) + theirSIDHPrivKey.GeneratePublicKey(theirSIDHPubKey) + + prng2 := rand.New(rand.NewSource(int64(myID))) + mySIDHPrivKey := util.NewSIDHPrivateKey(myVariant) + mySIDHPubKey := util.NewSIDHPublicKey(myVariant) + mySIDHPrivKey.Generate(prng2) + mySIDHPrivKey.GeneratePublicKey(mySIDHPubKey) + + // add the precanned user as a e2e contact + // FIXME: these params need to be threaded through... + sesParam := session.GetDefaultParams() + _, err := m.e2e.AddPartner(precan.ID, precan.DhPubKey, + m.e2e.GetHistoricalDHPrivkey(), theirSIDHPubKey, + mySIDHPrivKey, sesParam, sesParam) + + // check garbled messages in case any messages arrived before creating + // the channel + m.GetCmix().CheckInProgressMessages() + + return precan, err +} + +// Create an insecure e2e contact object for a precanned user +func (m *E2e) MakePrecannedContact(precannedID uint) contact.Contact { + + e2eGrp := m.GetStorage().GetE2EGroup() + + rng := m.GetRng().GetStream() + precanned := CreatePrecannedUser(precannedID, rng) + rng.Close() + + precanned.E2eDhPrivateKey = generatePrecanDHKeypair(precannedID, + m.GetStorage().GetE2EGroup()) + + // compute their public e2e key + partnerPubKey := e2eGrp.ExpG(precanned.E2eDhPrivateKey, + e2eGrp.NewInt(1)) + + return contact.Contact{ + ID: precanned.ReceptionID, + DhPubKey: partnerPubKey, + OwnershipProof: nil, + Facts: make([]fact.Fact, 0), + } +} diff --git a/api/services.go b/xxdk/services.go similarity index 99% rename from api/services.go rename to xxdk/services.go index 3acfddbfe32bc8cfb08ad3431b4932e9f3438922..b44149ec16fdf8ff5b01bd4dbc5f3c5bb5cd78c2 100644 --- a/api/services.go +++ b/xxdk/services.go @@ -1,4 +1,4 @@ -package api +package xxdk import ( "github.com/pkg/errors" diff --git a/api/services_test.go b/xxdk/services_test.go similarity index 99% rename from api/services_test.go rename to xxdk/services_test.go index be65c1a5faeec4964eeac8a8568b60aacda7a2d1..c87f3bcecb79775214992747eaad06cf826b159b 100644 --- a/api/services_test.go +++ b/xxdk/services_test.go @@ -5,7 +5,7 @@ // LICENSE file // /////////////////////////////////////////////////////////////////////////////// -package api +package xxdk import ( "errors" diff --git a/api/status.go b/xxdk/status.go similarity index 98% rename from api/status.go rename to xxdk/status.go index 33e567725a16b457e936270a3f43acaf7c671129..f613f87d454032d05f2114999d95728b4e2670a9 100644 --- a/api/status.go +++ b/xxdk/status.go @@ -5,7 +5,7 @@ // LICENSE file // /////////////////////////////////////////////////////////////////////////////// -package api +package xxdk import ( "fmt" diff --git a/api/user.go b/xxdk/user.go similarity index 99% rename from api/user.go rename to xxdk/user.go index cbe2b92a38041877a368291122016c9907ff9f12..4eb421050ed68c242dff2b1f509d01b41c05cdc8 100644 --- a/api/user.go +++ b/xxdk/user.go @@ -5,7 +5,7 @@ // LICENSE file // /////////////////////////////////////////////////////////////////////////////// -package api +package xxdk import ( "regexp" diff --git a/api/e2eApi/utils.go b/xxdk/utils.go similarity index 98% rename from api/e2eApi/utils.go rename to xxdk/utils.go index 8ec3be34d0d26701287dd7b356c2ca8a23a9ff76..d4ade6ce9f6d87f423da4b95e91a3aa5cfeb1019 100644 --- a/api/e2eApi/utils.go +++ b/xxdk/utils.go @@ -1,12 +1,12 @@ //////////////////////////////////////////////////////////////////////////////// -// Copyright © 2021 Privategrity Corporation / +// Copyright © 2022 Privategrity Corporation / // / // All rights reserved. / //////////////////////////////////////////////////////////////////////////////// // Provides various utility functions for access over the bindings -package e2eApi +package xxdk import ( "bytes" diff --git a/api/utilsInterfaces_test.go b/xxdk/utilsInterfaces_test.go similarity index 99% rename from api/utilsInterfaces_test.go rename to xxdk/utilsInterfaces_test.go index 72e141698805b029a799d19ccd4ca7e5f4a82e3e..107fb06778868bdf829e537c51d3cd1ae6cb9571 100644 --- a/api/utilsInterfaces_test.go +++ b/xxdk/utilsInterfaces_test.go @@ -4,7 +4,7 @@ // Use of this source code is governed by a license that can be found in the // // LICENSE file // /////////////////////////////////////////////////////////////////////////////// -package api +package xxdk import ( "gitlab.com/xx_network/primitives/ndf" diff --git a/api/utils_test.go b/xxdk/utils_test.go similarity index 98% rename from api/utils_test.go rename to xxdk/utils_test.go index b2f59f90739fa8bff71292d35d5bac9f09cdcbae..ca9f5d35d38f2edfe7814aa445764b4ad89604d7 100644 --- a/api/utils_test.go +++ b/xxdk/utils_test.go @@ -5,7 +5,7 @@ // LICENSE file // /////////////////////////////////////////////////////////////////////////////// -package api +package xxdk import ( "testing" @@ -26,7 +26,7 @@ import ( "gitlab.com/xx_network/primitives/utils" ) -func newTestingClient(face interface{}) (*Client, error) { +func newTestingClient(face interface{}) (*Cmix, error) { switch face.(type) { case *testing.T, *testing.M, *testing.B, *testing.PB: break diff --git a/api/version_vars.go b/xxdk/version_vars.go similarity index 99% rename from api/version_vars.go rename to xxdk/version_vars.go index dd52d6cf364f5fc60d6c08891c72b556e773498b..c64639f86fe965db67d50f3d6983660f506e1640 100644 --- a/api/version_vars.go +++ b/xxdk/version_vars.go @@ -1,7 +1,7 @@ // Code generated by go generate; DO NOT EDIT. // This file was generated by robots at // 2022-06-06 16:30:34.245821 -0500 CDT m=+0.030165276 -package api +package xxdk const GITVERSION = `48285297 Merge branch 'restructure' into 'release'` const SEMVER = "4.2.0" diff --git a/xxmutils/restoreContacts.go b/xxmutils/restoreContacts.go index f17789206e3eb58fff0305db12f09ef9c1c9cd8e..42950a0e5b265116da7ec7a357818d83a8a78599 100644 --- a/xxmutils/restoreContacts.go +++ b/xxmutils/restoreContacts.go @@ -11,8 +11,8 @@ import ( "encoding/json" "errors" "fmt" - "gitlab.com/elixxir/client/api/e2eApi" "gitlab.com/elixxir/client/single" + "gitlab.com/elixxir/client/xxdk/e2eApi" "gitlab.com/xx_network/primitives/netTime" "math" "strings" @@ -37,7 +37,7 @@ import ( // xxDK users should not use this function. This function is used by // the mobile phone apps and are not intended to be part of the xxDK. It // should be treated as internal functions specific to the phone apps. -func RestoreContactsFromBackup(backupPartnerIDs []byte, client *e2eApi.Client, +func RestoreContactsFromBackup(backupPartnerIDs []byte, client *e2eApi.E2e, udManager *ud.Manager, updatesCb interfaces.RestoreContactsUpdater) ([]*id.ID, []*id.ID, []error, error) { @@ -178,7 +178,7 @@ func RestoreContactsFromBackup(backupPartnerIDs []byte, client *e2eApi.Client, // the mobile phone apps and are not intended to be part of the xxDK. It // should be treated as internal functions specific to the phone apps. func LookupContacts(in chan *id.ID, out chan *contact.Contact, - failCh chan failure, client *e2eApi.Client, udContact contact.Contact, + failCh chan failure, client *e2eApi.E2e, udContact contact.Contact, wg *sync.WaitGroup) { defer wg.Done() // Start looking up contacts with user discovery and feed this @@ -205,7 +205,7 @@ func LookupContacts(in chan *id.ID, out chan *contact.Contact, // the mobile phone apps and are not intended to be part of the xxDK. It // should be treated as internal functions specific to the phone apps. func ResetSessions(in, out chan *contact.Contact, failCh chan failure, - client *e2eApi.Client, wg *sync.WaitGroup) { + client *e2eApi.E2e, wg *sync.WaitGroup) { defer wg.Done() for c := range in { _, err := client.GetAuth().Reset(*c) @@ -224,7 +224,7 @@ func ResetSessions(in, out chan *contact.Contact, failCh chan failure, // xxDK users should not use this function. This function is used by // the mobile phone apps and are not intended to be part of the xxDK. It // should be treated as internal functions specific to the phone apps. -func LookupContact(userID *id.ID, client *e2eApi.Client, udContact contact.Contact) ( +func LookupContact(userID *id.ID, client *e2eApi.E2e, udContact contact.Contact) ( *contact.Contact, error) { // This is a little wonky, but wait until we get called then // set the result to the contact objects details if there is