Skip to content
Snippets Groups Projects
Commit be881be5 authored by Josh Brooks's avatar Josh Brooks
Browse files

Update BackupReport to use IdList

parent ff80a1f8
No related branches found
No related tags found
2 merge requests!510Release,!302Restore BackupReport to original glory
...@@ -10,7 +10,6 @@ package bindings ...@@ -10,7 +10,6 @@ package bindings
import ( import (
"encoding/json" "encoding/json"
"gitlab.com/elixxir/client/backup" "gitlab.com/elixxir/client/backup"
"gitlab.com/xx_network/primitives/id"
) )
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
...@@ -27,10 +26,10 @@ type Backup struct { ...@@ -27,10 +26,10 @@ type Backup struct {
// NewCmixFromBackup. // NewCmixFromBackup.
// //
// Example BackupReport: // Example BackupReport:
//{"RestoredContacts":["oTEWTJaa0gcNt3BHeogEnZ/b8CO984Cp9PNLjHNJfWMD"],"Params":""} //{"RestoredContacts":["0AeVYBe87SV45A2UI4AtIe6H4AIyZSLPBPrT6eTBLycD"],"Params":""}
type BackupReport struct { type BackupReport struct {
// The list of restored E2E partner IDs // The list of restored E2E partner IDs
RestoredContacts []*id.ID RestoredContacts IdList
// The backup parameters found within the backup file // The backup parameters found within the backup file
Params string Params string
...@@ -69,13 +68,19 @@ func NewCmixFromBackup(ndfJSON, storageDir, backupPassphrase string, ...@@ -69,13 +68,19 @@ func NewCmixFromBackup(ndfJSON, storageDir, backupPassphrase string,
return nil, err return nil, err
} }
// Serialize list of IDs into bytes
serializedIdList := make([][]byte, len(backupIdList))
for i, partnerId := range backupIdList {
serializedIdList[i] = partnerId.Marshal()
}
// Construct report // Construct report
report := BackupReport{ report := BackupReport{
RestoredContacts: backupIdList, RestoredContacts: IdList{Ids: serializedIdList},
Params: backupParams, Params: backupParams,
} }
// Marshal report // JSON marshal report
return json.Marshal(report) return json.Marshal(report)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment