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

fixes to connect.go

parent 8900e521
No related branches found
No related tags found
2 merge requests!510Release,!207WIP: Client Restructure
...@@ -17,6 +17,7 @@ import ( ...@@ -17,6 +17,7 @@ import (
clientE2e "gitlab.com/elixxir/client/e2e" clientE2e "gitlab.com/elixxir/client/e2e"
"gitlab.com/elixxir/client/e2e/ratchet/partner" "gitlab.com/elixxir/client/e2e/ratchet/partner"
"gitlab.com/elixxir/client/e2e/receive" "gitlab.com/elixxir/client/e2e/receive"
"gitlab.com/elixxir/client/e2e/rekey"
"gitlab.com/elixxir/client/event" "gitlab.com/elixxir/client/event"
"gitlab.com/elixxir/client/storage/versioned" "gitlab.com/elixxir/client/storage/versioned"
"gitlab.com/elixxir/crypto/contact" "gitlab.com/elixxir/crypto/contact"
...@@ -65,6 +66,7 @@ type handler struct { ...@@ -65,6 +66,7 @@ type handler struct {
// Params for managing Connection objects // Params for managing Connection objects
type Params struct { type Params struct {
auth auth.Param auth auth.Param
rekey rekey.Params
event event.Reporter event event.Reporter
} }
...@@ -72,6 +74,7 @@ type Params struct { ...@@ -72,6 +74,7 @@ type Params struct {
func GetDefaultParams() Params { func GetDefaultParams() Params {
return Params{ return Params{
auth: auth.GetDefaultParams(), auth: auth.GetDefaultParams(),
rekey: rekey.GetDefaultParams(),
event: nil, event: nil,
} }
} }
...@@ -79,13 +82,17 @@ func GetDefaultParams() Params { ...@@ -79,13 +82,17 @@ func GetDefaultParams() Params {
// Connect performs auth key negotiation with the given recipient, // Connect performs auth key negotiation with the given recipient,
// and returns a Connection object for the newly-created partner.Manager // and returns a Connection object for the newly-created partner.Manager
// This function is to be used sender-side and will block until the partner.Manager is confirmed // This function is to be used sender-side and will block until the partner.Manager is confirmed
func Connect(recipient contact.Contact, myId *id.ID, rng *fastRNG.StreamGenerator, func Connect(recipient contact.Contact, myId *id.ID, privKey *cyclic.Int, rng *fastRNG.StreamGenerator,
grp *cyclic.Group, net cmix.Client, p Params) (Connection, error) { grp *cyclic.Group, net cmix.Client, p Params) (Connection, error) {
// Build an ephemeral KV // Build an ephemeral KV
kv := versioned.NewKV(ekv.MakeMemstore()) kv := versioned.NewKV(ekv.MakeMemstore())
// Build E2e handler // Build E2e handler
err := clientE2e.Init(kv, myId, privKey, grp, p.rekey)
if err != nil {
return nil, err
}
e2eHandler, err := clientE2e.Load(kv, net, myId, grp, rng, p.event) e2eHandler, err := clientE2e.Load(kv, net, myId, grp, rng, p.event)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -127,13 +134,17 @@ func Connect(recipient contact.Contact, myId *id.ID, rng *fastRNG.StreamGenerato ...@@ -127,13 +134,17 @@ func Connect(recipient contact.Contact, myId *id.ID, rng *fastRNG.StreamGenerato
// RegisterConnectionCallback assembles a Connection object on the reception-side // RegisterConnectionCallback assembles a Connection object on the reception-side
// and feeds it into the given Callback whenever an incoming request // and feeds it into the given Callback whenever an incoming request
// for an E2E partnership with a partner.Manager is confirmed. // for an E2E partnership with a partner.Manager is confirmed.
func RegisterConnectionCallback(cb Callback, myId *id.ID, rng *fastRNG.StreamGenerator, func RegisterConnectionCallback(cb Callback, myId *id.ID, privKey *cyclic.Int, rng *fastRNG.StreamGenerator,
grp *cyclic.Group, net cmix.Client, p Params) error { grp *cyclic.Group, net cmix.Client, p Params) error {
// Build an ephemeral KV // Build an ephemeral KV
kv := versioned.NewKV(ekv.MakeMemstore()) kv := versioned.NewKV(ekv.MakeMemstore())
// Build E2e handler // Build E2e handler
err := clientE2e.Init(kv, myId, privKey, grp, p.rekey)
if err != nil {
return err
}
e2eHandler, err := clientE2e.Load(kv, net, myId, grp, rng, p.event) e2eHandler, err := clientE2e.Load(kv, net, myId, grp, rng, p.event)
if err != nil { if err != nil {
return err return err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment