diff --git a/client.go b/client.go index 2e68234a7fe132bde7f109cf11e2e68289f516b6..c5b94ccc8864a81ece270f38f0dfe19a34d600ce 100644 --- a/client.go +++ b/client.go @@ -2,7 +2,9 @@ package main import ( "gitlab.com/elixxir/client/api" + "gitlab.com/elixxir/client/interfaces/contact" "gitlab.com/elixxir/client/interfaces/params" + "gitlab.com/xx_network/primitives/utils" "io/ioutil" "gitlab.com/elixxir/client/single" "os" @@ -100,4 +102,22 @@ func waitUntilConnected(connected chan bool) { } } }() +} + +func readBotContact() contact.Contact { + + // Read from file + data, err := utils.ReadFile(botContactPath) + jww.INFO.Printf("Contact file size read in: %d bytes", len(data)) + if err != nil { + jww.FATAL.Panicf("Failed to read contact file: %+v", err) + } + + // Unmarshal contact + c, err := contact.Unmarshal(data) + if err != nil { + jww.FATAL.Panicf("Failed to unmarshal contact: %+v", err) + } + + return c } \ No newline at end of file diff --git a/main.go b/main.go index 856f9af6d9cc99162165dbc8df75f873e809e327..b8ba89b24c302d9ce5d818b40171d77b8c594b64 100644 --- a/main.go +++ b/main.go @@ -8,17 +8,21 @@ import ( "time" ) -var password string -var session string -var ndfPath string -var singleMngr *single.Manager +var password = "password" +var session = ".session" +var ndfPath = "ndf.json" +var botContactPath = "botContact.bin" var botContact contact.Contact +var singleMngr *single.Manager + var body *gowd.Element func main() { - //_, singleMngr = initClient() + botContact = readBotContact() + + _, singleMngr = initClient() // creates a new bootstrap fluid container body = bootstrap.NewContainer(false)