diff --git a/api/client.go b/api/client.go index 04ef12f039dce295c98ffc6a19b8bbd6ccc39007..6560fe67353d905c77fe072ff371b9e3fa4b4f37 100644 --- a/api/client.go +++ b/api/client.go @@ -171,11 +171,11 @@ func NewVanityClient(ndfJSON, storageDir string, password []byte, // 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. -func NewClientFromBackup(ndfJSON, storageDir, sessionPassword, - backupPassphrase string, backupFileContents []byte) ([]*id.ID, error) { +func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword, + backupPassphrase []byte, backupFileContents []byte) ([]*id.ID, error) { backUp := &backup.Backup{} - err := backUp.Decrypt(backupPassphrase, backupFileContents) + err := backUp.Decrypt(string(backupPassphrase), backupFileContents) if err != nil { return nil, errors.WithMessage(err, "Failed to unmarshal decrypted client contents.") } diff --git a/bindings/client.go b/bindings/client.go index aad17428019d614cd4380ef360f58a625299d090..4cdfa338f802dd28c3d0b387cc6e8e7e21c19825 100644 --- a/bindings/client.go +++ b/bindings/client.go @@ -87,8 +87,8 @@ func NewPrecannedClient(precannedID int, network, storageDir string, password [] // 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. -func NewClientFromBackup(ndfJSON, storageDir, sessionPassword, - backupPassphrase string, backupFileContents []byte) ([]byte, error) { +func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword, + backupPassphrase, backupFileContents []byte) ([]byte, error) { backupPartnerIds, err := api.NewClientFromBackup(ndfJSON, storageDir, sessionPassword, backupPassphrase, backupFileContents) if err != nil { diff --git a/cmd/root.go b/cmd/root.go index 08b4927142772d0ed5dc08f54e28422d6924f384..28e3a988faa5a7613644d6f18c82a76205ac80b7 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -532,7 +532,7 @@ func createClient() *api.Client { userIDprefix := viper.GetString("userid-prefix") protoUserPath := viper.GetString("protoUserPath") backupPath := viper.GetString("backupIn") - backupPass := viper.GetString("backupPass") + backupPass := []byte(viper.GetString("backupPass")) // create a new client if none exist if _, err := os.Stat(storeDir); os.IsNotExist(err) { @@ -557,7 +557,7 @@ func createClient() *api.Client { []byte(pass), regCode, userIDprefix) } else if backupPath != "" { - b, backupFile := loadBackup(backupPath, backupPass) + b, backupFile := loadBackup(backupPath, string(backupPass)) // Marshal the backup object in JSON backupJson, err := json.Marshal(b) @@ -573,7 +573,7 @@ func createClient() *api.Client { // Construct client from backup data backupIdList, err := api.NewClientFromBackup(string(ndfJSON), storeDir, - pass, backupPass, backupFile) + []byte(pass), backupPass, backupFile) backupIdListPath := viper.GetString("backupIdList") if backupIdListPath != "" {