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

Refactor various NewClient functions to NewCmix

parent c0f8296b
No related branches found
No related tags found
2 merge requests!510Release,!291Refactor xxdk.E2e references to user
......@@ -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) {
......
......@@ -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)
......
......@@ -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)
}
......
......@@ -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)
......
......@@ -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) {
......
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment