diff --git a/backup/backupRestore.go b/backup/backupRestore.go index 93ba6778ea16e2a7982ee5a1c7e487b7d08bf406..91950ce8ad8912a50cadbf0d3aa60051e17a4c1a 100644 --- a/backup/backupRestore.go +++ b/backup/backupRestore.go @@ -4,9 +4,6 @@ // All rights reserved. / //////////////////////////////////////////////////////////////////////////////// -// FIXME: This is placeholder, there's got to be a better place to put -// backup restoration than inside messenger. - package backup import ( @@ -22,9 +19,9 @@ import ( "gitlab.com/xx_network/primitives/id" ) -// NewClientFromBackup constructs a new E2e from an encrypted +// NewClientFromBackup initializes a new e2e storage from an encrypted // backup. The backup is decrypted using the backupPassphrase. On -// success a successful client creation, the function will return a +// a successful client creation, the function will return a // JSON encoded list of the E2E partners contained in the backup and a // json-encoded string containing parameters stored in the backup func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword, @@ -38,7 +35,7 @@ func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword, "Failed to unmarshal decrypted client contents.") } - usr := user.NewUserFromBackup(backUp) + userInfo := user.NewUserFromBackup(backUp) def, err := xxdk.ParseNDF(ndfJSON) if err != nil { @@ -49,7 +46,7 @@ func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword, // Note we do not need registration here storageSess, err := xxdk.CheckVersionAndSetupStorage(def, storageDir, - sessionPassword, usr, cmixGrp, e2eGrp, + sessionPassword, userInfo, cmixGrp, e2eGrp, backUp.RegistrationCode) if err != nil { return nil, "", err @@ -69,10 +66,10 @@ func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword, return nil, "", err } - privkey := usr.E2eDhPrivateKey + privKey := userInfo.E2eDhPrivateKey //initialize the e2e storage - err = e2e.Init(storageSess.GetKV(), usr.ReceptionID, privkey, e2eGrp, + err = e2e.Init(storageSess.GetKV(), userInfo.ReceptionID, privKey, e2eGrp, rekey.GetDefaultParams()) if err != nil { return nil, "", err diff --git a/backup/keyStorage.go b/backup/keyStorage.go index f0e11469e850f17363bee97f6c5cc9d47d377b97..27437998775dc4a63cf4e3c996dd82f3aa68e56c 100644 --- a/backup/keyStorage.go +++ b/backup/keyStorage.go @@ -9,7 +9,6 @@ package backup import ( "bytes" - "github.com/pkg/errors" "gitlab.com/elixxir/client/storage/versioned" "gitlab.com/elixxir/crypto/backup" diff --git a/cmd/root.go b/cmd/root.go index 587949a527da44f07b0a65f8869cd2633259b87f..22d48e8392d3ce8735ef549898d38c855ab00901 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -643,9 +643,7 @@ func initCmix() (*xxdk.Cmix, xxdk.ReceptionIdentity) { } } - cmixParams, _ := initParams() - - client, err := xxdk.OpenCmix(storeDir, pass, cmixParams) + client, err := xxdk.OpenCmix(storeDir, pass) if err != nil { jww.FATAL.Panicf("%+v", err) } diff --git a/xxdk/cmix.go b/xxdk/cmix.go index 3e31d28593c4664ece6121c39b2bac746f229904..f2904335b283f5fd5327c7e69bc0bd34120d7502 100644 --- a/xxdk/cmix.go +++ b/xxdk/cmix.go @@ -106,11 +106,11 @@ func NewVanityClient(ndfJSON, storageDir string, password []byte, } cmixGrp, e2eGrp := DecodeGroups(def) - protoUser := createNewVanityUser(rngStream, cmixGrp, e2eGrp, + userInfo := createNewVanityUser(rngStream, cmixGrp, e2eGrp, userIdPrefix) _, err = CheckVersionAndSetupStorage(def, storageDir, password, - protoUser, cmixGrp, e2eGrp, registrationCode) + userInfo, cmixGrp, e2eGrp, registrationCode) if err != nil { return err } @@ -121,8 +121,7 @@ func NewVanityClient(ndfJSON, storageDir string, password []byte, // OpenCmix session, but don't connect to the network or log in // NOTE: This is a helper function that, in most applications, should not be used on its own // Consider using LoadCmix instead, which calls this function for you. -func OpenCmix(storageDir string, password []byte, - parameters CMIXParams) (*Cmix, error) { +func OpenCmix(storageDir string, password []byte) (*Cmix, error) { jww.INFO.Printf("OpenCmix()") rngStreamGen := fastRNG.NewStreamGenerator(12, 1024, @@ -208,7 +207,7 @@ func NewProtoClient_Unsafe(ndfJSON, storageDir string, password []byte, func LoadCmix(storageDir string, password []byte, parameters CMIXParams) (*Cmix, error) { jww.INFO.Printf("LoadCmix()") - c, err := OpenCmix(storageDir, password, parameters) + c, err := OpenCmix(storageDir, password) if err != nil { return nil, err } diff --git a/xxdk/utils_test.go b/xxdk/utils_test.go index cb88fc20c36269b469fc533625b1a6ce2120372a..b98f99ece011153233321fbd6c219f1f2e335e90 100644 --- a/xxdk/utils_test.go +++ b/xxdk/utils_test.go @@ -45,7 +45,7 @@ func newTestingClient(face interface{}) (*Cmix, error) { "Could not construct a mock client: %v", err) } - c, err := OpenCmix(storageDir, password, GetDefaultCMixParams()) + c, err := OpenCmix(storageDir, password) if err != nil { return nil, errors.Errorf("Could not open a mock client: %v", err)