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

Reintegrate old unsafe Login

parent cf0da188
No related branches found
No related tags found
2 merge requests!67Release,!47Modify Login_Unsafe for pregenerated user JSON
...@@ -306,7 +306,66 @@ func Login(storageDir string, password []byte, parameters params.Network) (*Clie ...@@ -306,7 +306,66 @@ func Login(storageDir string, password []byte, parameters params.Network) (*Clie
// LoginWithNewBaseNDF_UNSAFE initializes a client object from existing storage // LoginWithNewBaseNDF_UNSAFE initializes a client object from existing storage
// while replacing the base NDF. This is designed for some specific deployment // while replacing the base NDF. This is designed for some specific deployment
// procedures and is generally unsafe. // procedures and is generally unsafe.
func LoginWithNewBaseNDF_UNSAFE(storageDir string, password []byte, protoClientJSON []byte, func LoginWithNewBaseNDF_UNSAFE(storageDir string, password []byte,
newBaseNdf string, parameters params.Network) (*Client, error) {
jww.INFO.Printf("LoginWithNewBaseNDF_UNSAFE()")
// Parse the NDF
def, err := parseNDF(newBaseNdf)
if err != nil {
return nil, err
}
//Open the client
c, err := OpenClient(storageDir, password, parameters)
if err != nil {
return nil, err
}
//initialize comms
err = c.initComms()
if err != nil {
return nil, err
}
//store the updated base NDF
c.storage.SetNDF(def)
//initialize registration
if def.Registration.Address != "" {
err = c.initPermissioning(def)
if err != nil {
return nil, err
}
} else {
jww.WARN.Printf("Registration with permissioning skipped due to " +
"blank permissionign address. Client will not be able to register " +
"or track network.")
}
// Initialize network and link it to context
c.network, err = network.NewManager(c.storage, c.switchboard, c.rng,
c.events, c.comms, parameters, def)
if err != nil {
return nil, err
}
// initialize the auth tracker
c.auth = auth.NewManager(c.switchboard, c.storage, c.network)
err = c.registerFollower()
if err != nil {
return nil, err
}
return c, nil
}
// LoginWithProtoClient creates a client object with a protoclient JSON containing the
// cryptographic primitives. This is designed for some specific deployment
//// procedures and is generally unsafe.
func LoginWithProtoClient(storageDir string, password []byte, protoClientJSON []byte,
newBaseNdf string, parameters params.Network) (*Client, error) { newBaseNdf string, parameters params.Network) (*Client, error) {
jww.INFO.Printf("LoginWithNewBaseNDF_UNSAFE()") jww.INFO.Printf("LoginWithNewBaseNDF_UNSAFE()")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment