diff --git a/backup/backupRestore.go b/backup/backupRestore.go index 94e1180ae0d5a993d4d13ca63854e6b690885e1c..be59b29f7cca22ce5d968afa2b41a28896129dd3 100644 --- a/backup/backupRestore.go +++ b/backup/backupRestore.go @@ -20,12 +20,12 @@ import ( "gitlab.com/xx_network/primitives/id" ) -// NewClientFromBackup initializes a new e2e storage from an encrypted +// NewCmixFromBackup initializes a new e2e storage from an encrypted // backup. The backup is decrypted using the backupPassphrase. On // 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, +func NewCmixFromBackup(ndfJSON, storageDir string, sessionPassword, backupPassphrase []byte, backupFileContents []byte) ([]*id.ID, string, error) { diff --git a/cmd/backup.go b/cmd/backup.go index e6df9a991d2d36f6cfdf484fab4781dd13c4151c..2499dacbff4e6a73b779da6ffd139baa4f1d5011 100644 --- a/cmd/backup.go +++ b/cmd/backup.go @@ -50,7 +50,7 @@ func loadOrInitBackup(backupPath string, backupPass string, password []byte, sto } // Construct cMix from backup data - backupIdList, _, err := backup.NewClientFromBackup(string(ndfJson), storeDir, + backupIdList, _, err := backup.NewCmixFromBackup(string(ndfJson), storeDir, password, []byte(backupPass), backupFile) if err != nil { jww.FATAL.Panicf("%+v", err) diff --git a/cmd/precan.go b/cmd/precan.go index c7155d19e04be21cc248649f290191fe873ad297..4f607c6b110321da890c6d23851f23b235cb452c 100644 --- a/cmd/precan.go +++ b/cmd/precan.go @@ -35,7 +35,7 @@ func loadOrInitPrecan(precanId uint, password []byte, storeDir string, jww.FATAL.Panicf("%+v", err) } - err = xxdk.NewPrecannedClient(precanId, string(ndfJson), storeDir, password) + err = xxdk.NewPrecannedCmix(precanId, string(ndfJson), storeDir, password) if err != nil { jww.FATAL.Panicf("%+v", err) } diff --git a/cmd/proto.go b/cmd/proto.go index e42abd37a2ffab8a425ce8413475ff2e063f65af..129ff1b0884eed4b4eacad6454f80c515eb2d53c 100644 --- a/cmd/proto.go +++ b/cmd/proto.go @@ -44,7 +44,7 @@ func loadOrInitProto(protoUserPath string, password []byte, storeDir string, jww.FATAL.Panicf("%v", err) } - err = xxdk.NewProtoClient_Unsafe(string(ndfJson), storeDir, + err = xxdk.NewProtoCmix_Unsafe(string(ndfJson), storeDir, password, protoUser) if err != nil { jww.FATAL.Panicf("%+v", err) diff --git a/xxdk/cmix.go b/xxdk/cmix.go index a3a7980550abf698d2952114ea13187d52b05d99..6dfe2e5409880840d5f8ee170a1729fabb5f9dfb 100644 --- a/xxdk/cmix.go +++ b/xxdk/cmix.go @@ -154,12 +154,12 @@ func OpenCmix(storageDir string, password []byte) (*Cmix, error) { return c, nil } -// NewProtoClient_Unsafe initializes a client object from a JSON containing +// NewProtoCmix_Unsafe initializes a client object from a JSON containing // predefined cryptographic that defines a user. This is designed for some // specific deployment procedures and is generally unsafe. -func NewProtoClient_Unsafe(ndfJSON, storageDir string, password []byte, +func NewProtoCmix_Unsafe(ndfJSON, storageDir string, password []byte, protoUser *user.Proto) error { - jww.INFO.Printf("NewProtoClient_Unsafe") + jww.INFO.Printf("NewProtoCmix_Unsafe") usr := user.NewUserFromProto(protoUser) @@ -556,7 +556,7 @@ func DecodeGroups(ndf *ndf.NetworkDefinition) (cmixGrp, e2eGrp *cyclic.Group) { // CheckVersionAndSetupStorage checks the client version and creates a new // storage for user data. This function is common code shared by NewCmix, -//// NewPrecannedClient and NewVanityCmix. +//// NewPrecannedCmix and NewVanityCmix. func CheckVersionAndSetupStorage(def *ndf.NetworkDefinition, storageDir string, password []byte, userInfo user.Info, cmixGrp, e2eGrp *cyclic.Group, registrationCode string) (storage.Session, error) { diff --git a/xxdk/precan.go b/xxdk/precan.go index 98437456b51f63b18757311ab64d62fe37262ebe..12e7bee315825fa524ffb1079182395a4870348c 100644 --- a/xxdk/precan.go +++ b/xxdk/precan.go @@ -22,14 +22,14 @@ import ( "gitlab.com/xx_network/crypto/csprng" ) -// NewPrecannedClient creates an insecure user with predetermined keys with +// NewPrecannedCmix 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, +func NewPrecannedCmix(precannedID uint, defJSON, storageDir string, password []byte) error { - jww.INFO.Printf("NewPrecannedClient()") + jww.INFO.Printf("NewPrecannedCmix()") rngStreamGen := fastRNG.NewStreamGenerator(12, 1024, csprng.NewSystemRNG) rngStream := rngStreamGen.GetStream()