Skip to content
Snippets Groups Projects
Commit ae1e6f43 authored by Jake Taylor's avatar Jake Taylor :lips:
Browse files

Some final cleanup and log messages for registration

parent 5625d169
No related branches found
No related tags found
No related merge requests found
...@@ -19,10 +19,11 @@ import ( ...@@ -19,10 +19,11 @@ import (
"gitlab.com/elixxir/client/cmixproto" "gitlab.com/elixxir/client/cmixproto"
"gitlab.com/elixxir/client/globals" "gitlab.com/elixxir/client/globals"
"gitlab.com/elixxir/client/parse" "gitlab.com/elixxir/client/parse"
"gitlab.com/elixxir/primitives/switchboard"
"gitlab.com/elixxir/client/user" "gitlab.com/elixxir/client/user"
"gitlab.com/elixxir/comms/connect" "gitlab.com/elixxir/comms/connect"
"gitlab.com/elixxir/primitives/format"
"gitlab.com/elixxir/primitives/id" "gitlab.com/elixxir/primitives/id"
"gitlab.com/elixxir/primitives/switchboard"
"io/ioutil" "io/ioutil"
"log" "log"
"math/big" "math/big"
...@@ -30,7 +31,6 @@ import ( ...@@ -30,7 +31,6 @@ import (
"strings" "strings"
"sync/atomic" "sync/atomic"
"time" "time"
"gitlab.com/elixxir/primitives/format"
) )
var verbose bool var verbose bool
...@@ -116,26 +116,30 @@ func sessionInitialization() { ...@@ -116,26 +116,30 @@ func sessionInitialization() {
} }
} }
// Holds the User ID
var uid []byte
// Register a new user if requested // Register a new user if requested
if register { if register {
// FIXME Use a different encoding for the user ID command line argument, regCode := "AAAA" // FIXME: Need to pass in registration code
// to allow testing with IDs that are long enough to exercise more than fmt.Printf("Attempting to register with code %s...\n", regCode)
// 64 bits uid, err = bindings.Register(regCode, registrationAddr,
regCode := new(id.User).SetUints(&[4]uint64{0, 0, 0, userId}).RegistrationCode()
_, err := bindings.Register(regCode, registrationAddr,
strings.Join(gwAddresses, ","), mint) strings.Join(gwAddresses, ","), mint)
if err != nil { if err != nil {
fmt.Printf("Could Not Register User: %s\n", err.Error()) fmt.Printf("Could Not Register User: %s\n", err.Error())
return return
} }
fmt.Printf("Successfully registered user %v!\n", uid)
} }
// Log the user in, for now using the first gateway specified // Log the user in, for now using the first gateway specified
uid := id.NewUserFromUint(userId, nil) if !register {
uid = id.NewUserFromUint(userId, nil).Bytes()
}
_, err = bindings.Login(uid[:], gwAddresses[0], "") _, err = bindings.Login(uid[:], gwAddresses[0], "")
if err != nil { if err != nil {
fmt.Printf("Could Not Log In\n") fmt.Printf("Could Not Log In: %s\n", err)
return return
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment