From 4e5555807c8d26750443d410c1f5ee05a1273f78 Mon Sep 17 00:00:00 2001
From: Benjamin Wenger <ben@elixxir.ioo>
Date: Wed, 21 Oct 2020 13:21:54 -0700
Subject: [PATCH] initial version of contact

---
 bindings/contact.go       | 75 +++++++++++++++++++++++++++++++++++++++
 interfaces/params/CMIX.go |  2 +-
 2 files changed, 76 insertions(+), 1 deletion(-)
 create mode 100644 bindings/contact.go

diff --git a/bindings/contact.go b/bindings/contact.go
new file mode 100644
index 000000000..0c96fc416
--- /dev/null
+++ b/bindings/contact.go
@@ -0,0 +1,75 @@
+package bindings
+
+import (
+	"encoding/json"
+	"errors"
+	"gitlab.com/elixxir/client/interfaces/contact"
+)
+
+/* fact object*/
+type Fact struct {
+	f *contact.Fact
+}
+
+func (f *Fact) Get() string {
+	return f.f.Fact
+}
+
+func (f *Fact) Type() int {
+	return int(f.f.T)
+}
+
+/* contact object*/
+type Contact struct {
+	c *contact.Contact
+}
+
+// GetID returns the user ID for this user.
+func (c *Contact) GetID() []byte {
+	return c.c.ID.Bytes()
+}
+
+// GetDHPublicKey returns the public key associated with the Contact.
+func (c *Contact) GetDHPublicKey() []byte {
+	return c.c.DhPubKey.Bytes()
+}
+
+// GetDHPublicKey returns hash of a DH proof of key ownership.
+func (c *Contact) GetOwnershipProof() []byte {
+	return c.c.OwnershipProof
+}
+
+// Returns a fact list for adding and getting facts to and from the contact
+func (c *Contact) GetFactList() *FactList {
+	return &FactList{c: c.c}
+}
+
+type FactList struct {
+	c *contact.Contact
+}
+
+func (fl *FactList) Num() int {
+	return len(fl.c.Facts)
+}
+
+func (fl *FactList) Get(i int) Fact {
+	return Fact{f: &(fl.c.Facts)[i]}
+}
+
+func (fl *FactList) Add(fact string, factType int) error {
+	ft := contact.FactType(factType)
+	if !ft.IsValid() {
+		return errors.New("Invalid fact type")
+	}
+	fl.c.Facts = append(fl.c.Facts, contact.Fact{
+		Fact: fact,
+		T:    ft,
+	})
+	return nil
+}
+
+func (fl *FactList) Marshal() ([]byte, error) {
+	return json.Marshal(&fl.c.Facts)
+}
+
+func unmarshalFactList
diff --git a/interfaces/params/CMIX.go b/interfaces/params/CMIX.go
index a77c10fa9..0413b418d 100644
--- a/interfaces/params/CMIX.go
+++ b/interfaces/params/CMIX.go
@@ -12,7 +12,7 @@ type CMIX struct {
 func GetDefaultCMIX() CMIX {
 	return CMIX{
 		RoundTries: 3,
-		Timeout:    10 * time.Second,
+		Timeout:    25 * time.Second,
 		RetryDelay: 2 * time.Second,
 	}
 }
-- 
GitLab