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

fixes to connect.go

parent 8900e521
Branches
Tags
2 merge requests!510Release,!207WIP: Client Restructure
......@@ -17,6 +17,7 @@ import (
clientE2e "gitlab.com/elixxir/client/e2e"
"gitlab.com/elixxir/client/e2e/ratchet/partner"
"gitlab.com/elixxir/client/e2e/receive"
"gitlab.com/elixxir/client/e2e/rekey"
"gitlab.com/elixxir/client/event"
"gitlab.com/elixxir/client/storage/versioned"
"gitlab.com/elixxir/crypto/contact"
......@@ -65,6 +66,7 @@ type handler struct {
// Params for managing Connection objects
type Params struct {
auth auth.Param
rekey rekey.Params
event event.Reporter
}
......@@ -72,6 +74,7 @@ type Params struct {
func GetDefaultParams() Params {
return Params{
auth: auth.GetDefaultParams(),
rekey: rekey.GetDefaultParams(),
event: nil,
}
}
......@@ -79,13 +82,17 @@ func GetDefaultParams() Params {
// Connect performs auth key negotiation with the given recipient,
// 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
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) {
// Build an ephemeral KV
kv := versioned.NewKV(ekv.MakeMemstore())
// 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)
if err != nil {
return nil, err
......@@ -127,13 +134,17 @@ func Connect(recipient contact.Contact, myId *id.ID, rng *fastRNG.StreamGenerato
// RegisterConnectionCallback assembles a Connection object on the reception-side
// and feeds it into the given Callback whenever an incoming request
// 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 {
// Build an ephemeral KV
kv := versioned.NewKV(ekv.MakeMemstore())
// 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)
if err != nil {
return err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment