Skip to content
Snippets Groups Projects
Commit 5b095fc0 authored by Jake Taylor's avatar Jake Taylor
Browse files

general cleanup

parent ed09e127
No related branches found
No related tags found
1 merge request!510Release
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
// All rights reserved. / // All rights reserved. /
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// FIXME: This is placeholder, there's got to be a better place to put
// backup restoration than inside messenger.
package backup package backup
import ( import (
...@@ -22,9 +19,9 @@ import ( ...@@ -22,9 +19,9 @@ import (
"gitlab.com/xx_network/primitives/id" "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 // 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 list of the E2E partners contained in the backup and a
// json-encoded string containing parameters stored in the backup // json-encoded string containing parameters stored in the backup
func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword, func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword,
...@@ -38,7 +35,7 @@ func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword, ...@@ -38,7 +35,7 @@ func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword,
"Failed to unmarshal decrypted client contents.") "Failed to unmarshal decrypted client contents.")
} }
usr := user.NewUserFromBackup(backUp) userInfo := user.NewUserFromBackup(backUp)
def, err := xxdk.ParseNDF(ndfJSON) def, err := xxdk.ParseNDF(ndfJSON)
if err != nil { if err != nil {
...@@ -49,7 +46,7 @@ func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword, ...@@ -49,7 +46,7 @@ func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword,
// Note we do not need registration here // Note we do not need registration here
storageSess, err := xxdk.CheckVersionAndSetupStorage(def, storageDir, storageSess, err := xxdk.CheckVersionAndSetupStorage(def, storageDir,
sessionPassword, usr, cmixGrp, e2eGrp, sessionPassword, userInfo, cmixGrp, e2eGrp,
backUp.RegistrationCode) backUp.RegistrationCode)
if err != nil { if err != nil {
return nil, "", err return nil, "", err
...@@ -69,10 +66,10 @@ func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword, ...@@ -69,10 +66,10 @@ func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword,
return nil, "", err return nil, "", err
} }
privkey := usr.E2eDhPrivateKey privKey := userInfo.E2eDhPrivateKey
//initialize the e2e storage //initialize the e2e storage
err = e2e.Init(storageSess.GetKV(), usr.ReceptionID, privkey, e2eGrp, err = e2e.Init(storageSess.GetKV(), userInfo.ReceptionID, privKey, e2eGrp,
rekey.GetDefaultParams()) rekey.GetDefaultParams())
if err != nil { if err != nil {
return nil, "", err return nil, "", err
......
...@@ -9,7 +9,6 @@ package backup ...@@ -9,7 +9,6 @@ package backup
import ( import (
"bytes" "bytes"
"github.com/pkg/errors" "github.com/pkg/errors"
"gitlab.com/elixxir/client/storage/versioned" "gitlab.com/elixxir/client/storage/versioned"
"gitlab.com/elixxir/crypto/backup" "gitlab.com/elixxir/crypto/backup"
......
...@@ -643,9 +643,7 @@ func initCmix() (*xxdk.Cmix, xxdk.ReceptionIdentity) { ...@@ -643,9 +643,7 @@ func initCmix() (*xxdk.Cmix, xxdk.ReceptionIdentity) {
} }
} }
cmixParams, _ := initParams() client, err := xxdk.OpenCmix(storeDir, pass)
client, err := xxdk.OpenCmix(storeDir, pass, cmixParams)
if err != nil { if err != nil {
jww.FATAL.Panicf("%+v", err) jww.FATAL.Panicf("%+v", err)
} }
......
...@@ -106,11 +106,11 @@ func NewVanityClient(ndfJSON, storageDir string, password []byte, ...@@ -106,11 +106,11 @@ func NewVanityClient(ndfJSON, storageDir string, password []byte,
} }
cmixGrp, e2eGrp := DecodeGroups(def) cmixGrp, e2eGrp := DecodeGroups(def)
protoUser := createNewVanityUser(rngStream, cmixGrp, e2eGrp, userInfo := createNewVanityUser(rngStream, cmixGrp, e2eGrp,
userIdPrefix) userIdPrefix)
_, err = CheckVersionAndSetupStorage(def, storageDir, password, _, err = CheckVersionAndSetupStorage(def, storageDir, password,
protoUser, cmixGrp, e2eGrp, registrationCode) userInfo, cmixGrp, e2eGrp, registrationCode)
if err != nil { if err != nil {
return err return err
} }
...@@ -121,8 +121,7 @@ func NewVanityClient(ndfJSON, storageDir string, password []byte, ...@@ -121,8 +121,7 @@ func NewVanityClient(ndfJSON, storageDir string, password []byte,
// OpenCmix session, but don't connect to the network or log in // 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 // 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. // Consider using LoadCmix instead, which calls this function for you.
func OpenCmix(storageDir string, password []byte, func OpenCmix(storageDir string, password []byte) (*Cmix, error) {
parameters CMIXParams) (*Cmix, error) {
jww.INFO.Printf("OpenCmix()") jww.INFO.Printf("OpenCmix()")
rngStreamGen := fastRNG.NewStreamGenerator(12, 1024, rngStreamGen := fastRNG.NewStreamGenerator(12, 1024,
...@@ -208,7 +207,7 @@ func NewProtoClient_Unsafe(ndfJSON, storageDir string, password []byte, ...@@ -208,7 +207,7 @@ func NewProtoClient_Unsafe(ndfJSON, storageDir string, password []byte,
func LoadCmix(storageDir string, password []byte, parameters CMIXParams) (*Cmix, error) { func LoadCmix(storageDir string, password []byte, parameters CMIXParams) (*Cmix, error) {
jww.INFO.Printf("LoadCmix()") jww.INFO.Printf("LoadCmix()")
c, err := OpenCmix(storageDir, password, parameters) c, err := OpenCmix(storageDir, password)
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -45,7 +45,7 @@ func newTestingClient(face interface{}) (*Cmix, error) { ...@@ -45,7 +45,7 @@ func newTestingClient(face interface{}) (*Cmix, error) {
"Could not construct a mock client: %v", err) "Could not construct a mock client: %v", err)
} }
c, err := OpenCmix(storageDir, password, GetDefaultCMixParams()) c, err := OpenCmix(storageDir, password)
if err != nil { if err != nil {
return nil, errors.Errorf("Could not open a mock client: %v", return nil, errors.Errorf("Could not open a mock client: %v",
err) err)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment