Skip to content
Snippets Groups Projects
Commit 7d58e534 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Update auth to use passed in E2E parameters

parent 6c727529
No related branches found
No related tags found
2 merge requests!510Release,!253General Cleanup
......@@ -15,7 +15,6 @@ import (
"gitlab.com/elixxir/client/auth/store"
"gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/cmix/message"
"gitlab.com/elixxir/client/e2e/ratchet/partner/session"
"gitlab.com/elixxir/client/event"
util "gitlab.com/elixxir/client/storage/utility"
"gitlab.com/elixxir/crypto/contact"
......@@ -110,7 +109,7 @@ func (s *state) confirm(partner contact.Contact, serviceTag string) (
// into critical messages does not occur
// create local relationship
p := session.GetDefaultParams()
p := s.sessionParams
_, err := s.e2e.AddPartner(partner.ID, partner.DhPubKey, dhPriv,
rr.GetTheirSidHPubKeyA(), sidhPriv, p, p)
if err != nil {
......
......@@ -9,7 +9,6 @@ import (
"gitlab.com/elixxir/client/cmix/identity/receptionID"
"gitlab.com/elixxir/client/cmix/message"
"gitlab.com/elixxir/client/cmix/rounds"
"gitlab.com/elixxir/client/e2e/ratchet/partner/session"
"gitlab.com/elixxir/crypto/contact"
cAuth "gitlab.com/elixxir/crypto/e2e/auth"
"gitlab.com/elixxir/primitives/fact"
......@@ -90,7 +89,7 @@ func (rcs *receivedConfirmService) Process(msg format.Message,
}
// add the partner
p := session.GetDefaultParams()
p := authState.sessionParams
_, err = authState.e2e.AddPartner(rcs.GetPartner(), partnerPubKey,
rcs.GetMyPrivKey(), partnerSIDHPubKey, rcs.GetMySIDHPrivKey(), p, p)
if err != nil {
......
......@@ -9,12 +9,14 @@ package auth
import (
"encoding/base64"
"github.com/pkg/errors"
"gitlab.com/elixxir/client/auth/store"
"gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/cmix/identity/receptionID"
"gitlab.com/elixxir/client/cmix/message"
"gitlab.com/elixxir/client/e2e"
"gitlab.com/elixxir/client/e2e/ratchet/partner/session"
"gitlab.com/elixxir/client/event"
"gitlab.com/elixxir/client/storage/versioned"
"gitlab.com/elixxir/crypto/fastRNG"
......@@ -37,6 +39,10 @@ type state struct {
params Params
// These are the parameters used when creating/adding session
// partners
sessionParams session.Params
backupTrigger func(reason string)
}
......@@ -56,11 +62,12 @@ type state struct {
// with a memory only versioned.KV) as well as a memory only versioned.KV for
// NewState and use GetDefaultTemporaryParams() for the parameters
func NewState(kv *versioned.KV, net cmix.Client, e2e e2e.Handler,
rng *fastRNG.StreamGenerator, event event.Reporter, params Params,
callbacks Callbacks, backupTrigger func(reason string)) (State, error) {
rng *fastRNG.StreamGenerator, event event.Reporter, authParams Params,
sessParams session.Params, callbacks Callbacks,
backupTrigger func(reason string)) (State, error) {
kv = kv.Prefix(makeStorePrefix(e2e.GetReceptionID()))
return NewStateLegacy(
kv, net, e2e, rng, event, params, callbacks, backupTrigger)
return NewStateLegacy(kv, net, e2e, rng, event, authParams, sessParams,
callbacks, backupTrigger)
}
// NewStateLegacy loads the auth state or creates new auth state if one cannot
......@@ -68,8 +75,9 @@ func NewState(kv *versioned.KV, net cmix.Client, e2e e2e.Handler,
// Does not modify the kv prefix for backwards compatibility.
// Otherwise, acts the same as NewState
func NewStateLegacy(kv *versioned.KV, net cmix.Client, e2e e2e.Handler,
rng *fastRNG.StreamGenerator, event event.Reporter, params Params,
callbacks Callbacks, backupTrigger func(reason string)) (State, error) {
rng *fastRNG.StreamGenerator, event event.Reporter, authParams Params,
sessParams session.Params, callbacks Callbacks,
backupTrigger func(reason string)) (State, error) {
s := &state{
callbacks: callbacks,
......@@ -78,7 +86,8 @@ func NewStateLegacy(kv *versioned.KV, net cmix.Client, e2e e2e.Handler,
e2e: e2e,
rng: rng,
event: event,
params: params,
params: authParams,
sessionParams: sessParams,
backupTrigger: backupTrigger,
}
......@@ -90,13 +99,13 @@ func NewStateLegacy(kv *versioned.KV, net cmix.Client, e2e e2e.Handler,
// register services
net.AddService(e2e.GetReceptionID(), message.Service{
Identifier: e2e.GetReceptionID()[:],
Tag: params.RequestTag,
Tag: authParams.RequestTag,
Metadata: nil,
}, &receivedRequestService{s: s, reset: false})
net.AddService(e2e.GetReceptionID(), message.Service{
Identifier: e2e.GetReceptionID()[:],
Tag: params.ResetRequestTag,
Tag: authParams.ResetRequestTag,
Metadata: nil,
}, &receivedRequestService{s: s, reset: true})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment