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 8dea0efac4bea0d7941abb5da00744b4004113c4..b58cbe5d9b83f8531e3c27fdef1832cb1c049c84 100644 --- a/main.go +++ b/main.go @@ -11,16 +11,20 @@ import ( "github.com/dtylman/gowd/bootstrap" ) -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() { + botContact = readBotContact() + _, singleMngr = initClient() //creates a new bootstrap fluid container