Skip to content
Snippets Groups Projects
Commit d5b7b326 authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

refactored to remove the context, added version handling, moved permissioning...

refactored to remove the context, added version handling, moved permissioning to its own package, refactored new and load clients
parent 1d0be139
No related branches found
No related tags found
No related merge requests found
...@@ -16,9 +16,11 @@ import ( ...@@ -16,9 +16,11 @@ import (
"gitlab.com/elixxir/client/context" "gitlab.com/elixxir/client/context"
"gitlab.com/elixxir/client/context/params" "gitlab.com/elixxir/client/context/params"
"gitlab.com/elixxir/client/context/stoppable" "gitlab.com/elixxir/client/context/stoppable"
"gitlab.com/elixxir/client/context/switchboard"
"gitlab.com/elixxir/client/network" "gitlab.com/elixxir/client/network"
"gitlab.com/elixxir/client/permissioning"
"gitlab.com/elixxir/client/storage" "gitlab.com/elixxir/client/storage"
"gitlab.com/elixxir/client/switchboard"
"gitlab.com/elixxir/comms/client"
pb "gitlab.com/elixxir/comms/mixmessages" pb "gitlab.com/elixxir/comms/mixmessages"
"gitlab.com/elixxir/crypto/csprng" "gitlab.com/elixxir/crypto/csprng"
"gitlab.com/elixxir/crypto/cyclic" "gitlab.com/elixxir/crypto/cyclic"
...@@ -32,17 +34,29 @@ import ( ...@@ -32,17 +34,29 @@ import (
) )
type Client struct { type Client struct {
//generic RNG for client
rng *fastRNG.StreamGenerator
// the storage session securely stores data to disk and memoizes as is
// appropriate
storage *storage.Session storage *storage.Session
ctx *context.Context //the switchboard is used for inter-process signaling about received messages
switchboard *switchboard.Switchboard switchboard *switchboard.Switchboard
//object used for communications
comms *client.Comms
// note that the manager has a pointer to the context in many cases, but
// this interface allows it to be mocked for easy testing without the
// loop
network context.NetworkManager network context.NetworkManager
//object used to register and communicate with permissioning
permissioning *permissioning.Permissioning
} }
// NewClient creates client storage, generates keys, connects, and registers // NewClient creates client storage, generates keys, connects, and registers
// with the network. Note that this does not register a username/identity, but // with the network. Note that this does not register a username/identity, but
// merely creates a new cryptographic identity for adding such information // merely creates a new cryptographic identity for adding such information
// at a later date. // at a later date.
func NewClient(netJSON, storageDir string, password []byte) (*Client, error) { func NewClient(defJSON, storageDir string, password []byte) (*Client, error) {
if clientStorageExists(storageDir) { if clientStorageExists(storageDir) {
return nil, errors.Errorf("client already exists at %s", return nil, errors.Errorf("client already exists at %s",
storageDir) storageDir)
...@@ -53,58 +67,28 @@ func NewClient(netJSON, storageDir string, password []byte) (*Client, error) { ...@@ -53,58 +67,28 @@ func NewClient(netJSON, storageDir string, password []byte) (*Client, error) {
rngStream := rngStreamGen.GetStream() rngStream := rngStreamGen.GetStream()
// Parse the NDF // Parse the NDF
ndf, err := parseNDF(netJSON) def, err := parseNDF(defJSON)
if err != nil { if err != nil {
return nil, err return nil, err
} }
cmixGrp, e2eGrp := decodeGroups(ndf) cmixGrp, e2eGrp := decodeGroups(def)
user := createNewUser(rngStream, cmixGrp, e2eGrp) protoUser := createNewUser(rngStream, cmixGrp, e2eGrp)
// Create Storage // Create Storage
passwordStr := string(password) passwordStr := string(password)
storageSess, err := storage.New(storageDir, passwordStr, storageSess, err := storage.New(storageDir, passwordStr,
user.UID, user.Salt, user.RSAKey, user.IsPrecanned, protoUser.UID, protoUser.Salt, protoUser.RSAKey, protoUser.IsPrecanned,
user.CMixKey, user.E2EKey, cmixGrp, e2eGrp, rngStreamGen) protoUser.CMixKey, protoUser.E2EKey, cmixGrp, e2eGrp, rngStreamGen)
if err != nil { if err != nil {
return nil, err return nil, err
} }
// Save NDF to be used in the future // Save NDF to be used in the future
err = storageSess.SetNDF(netJSON) storageSess.SetBaseNDF(def)
if err != nil {
return nil, err
}
// Set up a new context
ctx := &context.Context{
Session: storageSess,
Switchboard: switchboard.New(),
Rng: rngStreamGen,
Manager: nil,
}
// Initialize network and link it to context
netman, err := network.NewManager(ctx, params.GetDefaultNetwork(), ndf)
if err != nil {
return nil, err
}
ctx.Manager = netman
client := &Client{
storage: storageSess,
ctx: ctx,
switchboard: ctx.Switchboard,
network: netman,
}
// Now register with network, note that regCode is no longer required
err = client.RegisterWithPermissioning("")
if err != nil {
return nil, err
}
return client, nil //execute the rest of the loading as normal
return loadClient(storageSess, rngStreamGen)
} }
// LoadClient initalizes a client object from existing storage. // LoadClient initalizes a client object from existing storage.
...@@ -124,39 +108,67 @@ func LoadClient(storageDir string, password []byte) (*Client, error) { ...@@ -124,39 +108,67 @@ func LoadClient(storageDir string, password []byte) (*Client, error) {
return nil, err return nil, err
} }
netJSON, err := storageSess.GetNDF() //execute the rest of the loading as normal
return loadClient(storageSess, rngStreamGen)
}
// LoadClient initalizes a client object from existing storage.
func loadClient(session *storage.Session, rngStreamGen *fastRNG.StreamGenerator) (c *Client, err error) {
// Set up a new context
c = &Client{
storage: session,
switchboard: switchboard.New(),
rng: rngStreamGen,
comms: nil,
network: nil,
}
//get the user from session
user := c.storage.User()
cryptoUser := user.GetCryptographicIdentity()
//start comms
c.comms, err = client.NewClientComms(cryptoUser.GetUserID(),
rsa.CreatePublicKeyPem(cryptoUser.GetRSA().GetPublic()),
rsa.CreatePrivateKeyPem(cryptoUser.GetRSA()),
cryptoUser.GetSalt())
if err != nil { if err != nil {
return nil, err return nil, errors.WithMessage(err, "failed to load client")
} }
ndf, err := parseNDF(string(netJSON))
//get the NDF to pass into permissioning and the network manager
def := session.GetBaseNDF()
//initialize permissioning
c.permissioning, err = permissioning.Init(c.comms, def)
// check the client version is up to date to the network
err = c.checkVersion()
if err != nil { if err != nil {
return nil, err return nil, errors.WithMessage(err, "failed to load client")
} }
// Set up a new context //register with permissioning if necessary
ctx := &context.Context{ if c.storage.GetRegistrationStatus() == storage.KeyGenComplete {
Session: storageSess, err = c.registerWithPermissioning()
Switchboard: switchboard.New(), if err != nil {
Rng: rngStreamGen, return nil, errors.WithMessage(err, "failed to load client")
Manager: nil, }
} }
// Initialize network and link it to context // Initialize network and link it to context
netman, err := network.NewManager(ctx, params.GetDefaultNetwork(), ndf) c.network, err = network.NewManager(c.storage, c.switchboard, c.rng, c.comms,
params.GetDefaultNetwork(), def)
if err != nil { if err != nil {
return nil, err return nil, err
} }
ctx.Manager = netman
client := &Client{ return c, nil
storage: storageSess,
ctx: ctx,
switchboard: ctx.Switchboard,
network: netman,
} }
return client, nil
}
// ----- Client Functions ----- // ----- Client Functions -----
...@@ -283,7 +295,7 @@ func (c *Client) RegisterPhone(phone string) ([]byte, error) { ...@@ -283,7 +295,7 @@ func (c *Client) RegisterPhone(phone string) ([]byte, error) {
} }
// ConfirmRegistration sends the user discovery agent a confirmation // ConfirmRegistration sends the user discovery agent a confirmation
// token (from Register Email/Phone) and code (string sent via Email // token (from register Email/Phone) and code (string sent via Email
// or SMS to confirm ownership) to confirm ownership. // or SMS to confirm ownership) to confirm ownership.
func (c *Client) ConfirmRegistration(token, code []byte) error { func (c *Client) ConfirmRegistration(token, code []byte) error {
jww.INFO.Printf("ConfirmRegistration(%s, %s)", token, code) jww.INFO.Printf("ConfirmRegistration(%s, %s)", token, code)
......
...@@ -8,38 +8,37 @@ package api ...@@ -8,38 +8,37 @@ package api
import ( import (
"github.com/pkg/errors" "github.com/pkg/errors"
"gitlab.com/elixxir/client/globals"
"gitlab.com/elixxir/client/storage" "gitlab.com/elixxir/client/storage"
) )
// Returns an error if registration fails. // Returns an error if registration fails.
func (c *Client) RegisterWithPermissioning(registrationCode string) error { func (c *Client) registerWithPermissioning() error {
ctx := c.ctx userData := c.storage.User()
netman := ctx.Manager //get the users public key
pubKey := userData.GetCryptographicIdentity().GetRSA().GetPublic()
//Check the regState is in proper state for registration //load the registration code
regState := c.storage.GetRegistrationStatus() regCode, err := c.storage.GetRegCode()
if regState != storage.KeyGenComplete { if err != nil {
return errors.Errorf("Attempting to register before key generation!") return errors.WithMessage(err, "failed to register with "+
"permissioning")
} }
userData := ctx.Session.User() //register with permissioning
regValidationSignature, err := c.permissioning.Register(pubKey, regCode)
// Register with the permissioning server and generate user information
regValidationSignature, err := netman.RegisterWithPermissioning(
registrationCode)
if err != nil { if err != nil {
globals.Log.INFO.Printf(err.Error()) return errors.WithMessage(err, "failed to register with "+
return err "permissioning")
} }
// update the session with the registration response //store the signature
userData.SetRegistrationValidationSignature(regValidationSignature) userData.SetRegistrationValidationSignature(regValidationSignature)
err = ctx.Session.ForwardRegistrationStatus(storage.PermissioningComplete) //update the registration status
err = c.storage.ForwardRegistrationStatus(storage.PermissioningComplete)
if err != nil { if err != nil {
return err return errors.WithMessage(err, "failed to update local state "+
"after registration with permissioning")
} }
return nil return nil
} }
package api
import (
"github.com/pkg/errors"
jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/primitives/version"
)
func (c *Client) Version() version.Version {
v, err := version.ParseVersion(SEMVER)
if err != nil {
jww.FATAL.Panicf("Failed to parse the client version: %s", err)
}
return v
}
func (c *Client) checkVersion() error {
clientVersion := c.Version()
jww.INFO.Printf("Client Version: %s", clientVersion)
has, netVersion, err := c.permissioning.GetNetworkVersion()
if err != nil {
return errors.WithMessage(err, "failed to get check "+
"version compatibility")
}
if has {
jww.INFO.Printf("Minimum Network Version: %v", netVersion)
if !version.IsCompatible(netVersion, clientVersion) {
return errors.Errorf("Client and Minimum Network Version are "+
"incompatible\n"+
"\tMinimum Network: %s\n"+
"\tClient: %s", netVersion, clientVersion)
}
} else {
jww.WARN.Printf("Network requires no minnimim version")
}
return nil
}
// Code generated by go generate; DO NOT EDIT.
// This file was generated by robots at
// 2020-08-10 10:46:23.193662 -0700 PDT m=+0.042594188
package api
const GITVERSION = `4ddf4b3 Merge branch 'XX-2471/XXPrimitives' into 'release'`
const SEMVER = "1.4.0"
const DEPENDENCIES = `module gitlab.com/elixxir/client
go 1.13
require (
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
github.com/golang/protobuf v1.4.2
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect
github.com/pelletier/go-toml v1.6.0 // indirect
github.com/pkg/errors v0.9.1
github.com/smartystreets/assertions v1.0.1 // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/cobra v1.0.0
github.com/spf13/jwalterweatherman v1.1.0
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.6.2
gitlab.com/elixxir/comms v0.0.0-20200810165153-3039323b5656
gitlab.com/elixxir/crypto v0.0.0-20200806211835-b8ce4472f399
gitlab.com/elixxir/ekv v0.0.0-20200729182028-159355ea5842
gitlab.com/elixxir/primitives v0.0.0-20200805174810-86b366d1dd2d
gitlab.com/xx_network/comms v0.0.0-20200806235452-3a82720833ba
gitlab.com/xx_network/crypto v0.0.0-20200806235322-ede3c15881ce
gitlab.com/xx_network/primitives v0.0.0-20200804183002-f99f7a7284da
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
gopkg.in/ini.v1 v1.52.0 // indirect
)
replace google.golang.org/grpc => github.com/grpc/grpc-go v1.27.1
`
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
package cmd package cmd
import ( import (
jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/api" "gitlab.com/elixxir/client/api"
"gitlab.com/elixxir/client/globals"
"gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id"
"strings" "strings"
//"time" //"time"
...@@ -18,15 +18,15 @@ type callbackSearch struct{} ...@@ -18,15 +18,15 @@ type callbackSearch struct{}
func (cs callbackSearch) Callback(userID, pubKey []byte, err error) { func (cs callbackSearch) Callback(userID, pubKey []byte, err error) {
if err != nil { if err != nil {
globals.Log.INFO.Printf("UDB search failed: %v\n", err.Error()) jww.INFO.Printf("UDB search failed: %v\n", err.Error())
} else if len(pubKey) == 0 { } else if len(pubKey) == 0 {
globals.Log.INFO.Printf("Public Key returned is empty\n") jww.INFO.Printf("Public Key returned is empty\n")
} else { } else {
userID, err := id.Unmarshal(userID) userID, err := id.Unmarshal(userID)
if err != nil { if err != nil {
globals.Log.ERROR.Printf("Malformed user ID from successful UDB search: %v", err) jww.ERROR.Printf("Malformed user ID from successful UDB search: %v", err)
} }
globals.Log.INFO.Printf("UDB search successful. Returned user %v\n", jww.INFO.Printf("UDB search successful. Returned user %v\n",
userID) userID)
} }
} }
...@@ -38,7 +38,7 @@ func parseUdbMessage(msg string, client *api.Client) { ...@@ -38,7 +38,7 @@ func parseUdbMessage(msg string, client *api.Client) {
// Split the message on spaces // Split the message on spaces
args := strings.Fields(msg) args := strings.Fields(msg)
if len(args) < 3 { if len(args) < 3 {
globals.Log.ERROR.Printf("UDB command must have at least three arguments!") jww.ERROR.Printf("UDB command must have at least three arguments!")
} }
// The first arg is the command // The first arg is the command
// the second is the valueType // the second is the valueType
...@@ -48,8 +48,8 @@ func parseUdbMessage(msg string, client *api.Client) { ...@@ -48,8 +48,8 @@ func parseUdbMessage(msg string, client *api.Client) {
if strings.EqualFold(keyword, "SEARCH") { if strings.EqualFold(keyword, "SEARCH") {
//client.SearchForUser(args[2], searchCallback, 2*time.Minute) //client.SearchForUser(args[2], searchCallback, 2*time.Minute)
} else if strings.EqualFold(keyword, "REGISTER") { } else if strings.EqualFold(keyword, "REGISTER") {
globals.Log.ERROR.Printf("UDB REGISTER not allowed, it is already done during user registration") jww.ERROR.Printf("UDB REGISTER not allowed, it is already done during user registration")
} else { } else {
globals.Log.ERROR.Printf("UDB command not recognized!") jww.ERROR.Printf("UDB command not recognized!")
} }
} }
...@@ -11,7 +11,7 @@ package cmd ...@@ -11,7 +11,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"gitlab.com/elixxir/client/globals" "gitlab.com/elixxir/client/api"
"gitlab.com/elixxir/primitives/utils" "gitlab.com/elixxir/primitives/utils"
) )
...@@ -19,8 +19,8 @@ import ( ...@@ -19,8 +19,8 @@ import (
const currentVersion = "1.4.0" const currentVersion = "1.4.0"
func printVersion() { func printVersion() {
fmt.Printf("Elixxir Client v%s -- %s\n\n", globals.SEMVER, globals.GITVERSION) fmt.Printf("Elixxir Client v%s -- %s\n\n", api.SEMVER, api.GITVERSION)
fmt.Printf("Dependencies:\n\n%s\n", globals.DEPENDENCIES) fmt.Printf("Dependencies:\n\n%s\n", api.DEPENDENCIES)
} }
func init() { func init() {
......
package context
import (
"gitlab.com/elixxir/client/storage"
"gitlab.com/elixxir/client/switchboard"
"gitlab.com/elixxir/crypto/fastRNG"
)
type Context struct {
Session *storage.Session
Switchboard *switchboard.Switchboard
// note that the manager has a pointer to the context in many cases, but
// this interface allows it to be mocked for easy testing without the
// loop
Manager NetworkManager
//generic RNG for client
Rng *fastRNG.StreamGenerator
}
...@@ -15,8 +15,6 @@ type NetworkManager interface { ...@@ -15,8 +15,6 @@ type NetworkManager interface {
SendCMIX(message format.Message, p params.CMIX) (id.Round, error) SendCMIX(message format.Message, p params.CMIX) (id.Round, error)
GetInstance() *network.Instance GetInstance() *network.Instance
GetHealthTracker() HealthTracker GetHealthTracker() HealthTracker
RegisterWithPermissioning(string) ([]byte, error)
GetRemoteVersion() (string, error)
GetStoppable() stoppable.Stoppable GetStoppable() stoppable.Stoppable
} }
......
...@@ -19,15 +19,12 @@ import ( ...@@ -19,15 +19,12 @@ import (
"gitlab.com/elixxir/client/network/keyExchange" "gitlab.com/elixxir/client/network/keyExchange"
"gitlab.com/elixxir/client/network/message" "gitlab.com/elixxir/client/network/message"
"gitlab.com/elixxir/client/network/node" "gitlab.com/elixxir/client/network/node"
"gitlab.com/elixxir/client/network/permissioning"
"gitlab.com/elixxir/client/network/rounds" "gitlab.com/elixxir/client/network/rounds"
"gitlab.com/elixxir/client/storage" "gitlab.com/elixxir/client/storage"
"gitlab.com/elixxir/client/switchboard" "gitlab.com/elixxir/client/switchboard"
"gitlab.com/elixxir/comms/client" "gitlab.com/elixxir/comms/client"
"gitlab.com/elixxir/comms/network" "gitlab.com/elixxir/comms/network"
"gitlab.com/elixxir/crypto/fastRNG" "gitlab.com/elixxir/crypto/fastRNG"
"gitlab.com/xx_network/crypto/signature/rsa"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/ndf" "gitlab.com/xx_network/primitives/ndf"
"time" "time"
...@@ -87,22 +84,6 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard, ...@@ -87,22 +84,6 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard,
return &m, nil return &m, nil
} }
// GetRemoteVersion contacts the permissioning server and returns the current
// supported client version.
func (m *manager) GetRemoteVersion() (string, error) {
permissioningHost, ok := m.Comms.GetHost(&id.Permissioning)
if !ok {
return "", errors.Errorf("no permissioning host with id %s",
id.Permissioning)
}
registrationVersion, err := m.Comms.SendGetCurrentClientVersionMessage(
permissioningHost)
if err != nil {
return "", err
}
return registrationVersion.Version, nil
}
// StartRunners kicks off all network reception goroutines ("threads"). // StartRunners kicks off all network reception goroutines ("threads").
func (m *manager) StartRunners() error { func (m *manager) StartRunners() error {
if m.runners.IsRunning() { if m.runners.IsRunning() {
...@@ -114,7 +95,7 @@ func (m *manager) StartRunners() error { ...@@ -114,7 +95,7 @@ func (m *manager) StartRunners() error {
m.runners.Add(m.Health) m.runners.Add(m.Health)
// Node Updates // Node Updates
m.runners.Add(node.StartRegistration(m.Context, m.Comms, m.NodeRegistration)) // Adding/Keys m.runners.Add(node.StartRegistration(m.Instance, m.Session, m.Rng, m.Comms, m.NodeRegistration)) // Adding/Keys
//TODO-remover //TODO-remover
//m.runners.Add(StartNodeRemover(m.Context)) // Removing //m.runners.Add(StartNodeRemover(m.Context)) // Removing
...@@ -130,16 +111,11 @@ func (m *manager) StartRunners() error { ...@@ -130,16 +111,11 @@ func (m *manager) StartRunners() error {
m.runners.Add(m.round.StartProcessors()) m.runners.Add(m.round.StartProcessors())
// Key exchange // Key exchange
m.runners.Add(keyExchange.Start(m.Context, m.message.GetTriggerGarbledCheckChannel())) m.runners.Add(keyExchange.Start(m.Switchboard, m.Session, m, m.message.GetTriggerGarbledCheckChannel()))
return nil return nil
} }
func (m *manager) RegisterWithPermissioning(registrationCode string) ([]byte, error) {
pubKey := m.Session.User().GetCryptographicIdentity().GetRSA().GetPublic()
return permissioning.Register(m.Comms, pubKey, registrationCode)
}
// StopRunners stops all the reception goroutines // StopRunners stops all the reception goroutines
func (m *manager) GetStoppable() stoppable.Stoppable { func (m *manager) GetStoppable() stoppable.Stoppable {
return m.runners return m.runners
......
...@@ -31,7 +31,7 @@ func (m *Manager) SendUnsafe(msg message.Send, param params.Unsafe) ([]id.Round, ...@@ -31,7 +31,7 @@ func (m *Manager) SendUnsafe(msg message.Send, param params.Unsafe) ([]id.Round,
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
for i, p := range partitions { for i, p := range partitions {
msgCmix := format.NewMessage(m.Context.Session.Cmix().GetGroup().GetP().ByteLen()) msgCmix := format.NewMessage(m.Session.Cmix().GetGroup().GetP().ByteLen())
msgCmix.SetContents(p) msgCmix.SetContents(p)
e2e.SetUnencrypted(msgCmix, msg.Recipient) e2e.SetUnencrypted(msgCmix, msg.Recipient)
wg.Add(1) wg.Add(1)
......
package permissioning
import (
"github.com/pkg/errors"
"gitlab.com/elixxir/comms/client"
"gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/ndf"
)
type Permissioning struct {
host *connect.Host
comms *client.Comms
}
func Init(comms *client.Comms, def *ndf.NetworkDefinition) (*Permissioning, error) {
perm := Permissioning{
host: nil,
comms: comms,
}
var err error
//add the permissioning host to comms
perm.host, err = comms.AddHost(&id.Permissioning, def.Registration.Address,
[]byte(def.Registration.TlsCertificate), false,
false)
if err != nil {
return nil, errors.WithMessage(err, "failed to create permissioning")
}
return &perm, nil
}
...@@ -5,23 +5,21 @@ import ( ...@@ -5,23 +5,21 @@ import (
pb "gitlab.com/elixxir/comms/mixmessages" pb "gitlab.com/elixxir/comms/mixmessages"
"gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/crypto/signature/rsa" "gitlab.com/xx_network/crypto/signature/rsa"
"gitlab.com/xx_network/primitives/id"
) )
func (perm *Permissioning) Register(publicKey *rsa.PublicKey, registrationCode string) ([]byte, error) {
return register(perm.comms, perm.host, publicKey, registrationCode)
}
// client.Comms should implement this interface // client.Comms should implement this interface
type RegistrationMessageSender interface { type registrationMessageSender interface {
SendRegistrationMessage(host *connect.Host, message *pb.UserRegistration) (*pb.UserRegistrationConfirmation, error) SendRegistrationMessage(host *connect.Host, message *pb.UserRegistration) (*pb.UserRegistrationConfirmation, error)
GetHost(*id.ID) (*connect.Host, bool)
} }
//Register registers the user with optional registration code //register registers the user with optional registration code
// Returns an error if registration fails. // Returns an error if registration fails.
func Register(comms RegistrationMessageSender, publicKey *rsa.PublicKey, registrationCode string) ([]byte, error) { func register(comms registrationMessageSender, host *connect.Host,
// Send registration code and public key to RegistrationServer publicKey *rsa.PublicKey, registrationCode string) ([]byte, error) {
host, ok := comms.GetHost(&id.Permissioning)
if !ok {
return nil, errors.New("Failed to find permissioning host")
}
response, err := comms. response, err := comms.
SendRegistrationMessage(host, SendRegistrationMessage(host,
......
...@@ -56,7 +56,7 @@ func TestRegisterWithPermissioning(t *testing.T) { ...@@ -56,7 +56,7 @@ func TestRegisterWithPermissioning(t *testing.T) {
} }
regCode := "flooble doodle" regCode := "flooble doodle"
sig, err := Register(&sender, key.GetPublic(), regCode) sig, err := register(&sender, sender.getHost, key.GetPublic(), regCode)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
...@@ -79,19 +79,8 @@ func TestRegisterWithPermissioning(t *testing.T) { ...@@ -79,19 +79,8 @@ func TestRegisterWithPermissioning(t *testing.T) {
} }
} }
// Shows that returning an error from GetHost results in an error from
// Register
func TestRegisterWithPermissioning_GetHostErr(t *testing.T) {
var sender MockRegistrationSender
sender.succeedGetHost = false
_, err := Register(&sender, nil, "")
if err == nil {
t.Error("no error if getHost fails")
}
}
// Shows that returning an error from the permissioning server results in an // Shows that returning an error from the permissioning server results in an
// error from Register // error from register
func TestRegisterWithPermissioning_ResponseErr(t *testing.T) { func TestRegisterWithPermissioning_ResponseErr(t *testing.T) {
rng := csprng.NewSystemRNG() rng := csprng.NewSystemRNG()
key, err := rsa.GenerateKey(rng, 256) key, err := rsa.GenerateKey(rng, 256)
...@@ -101,14 +90,14 @@ func TestRegisterWithPermissioning_ResponseErr(t *testing.T) { ...@@ -101,14 +90,14 @@ func TestRegisterWithPermissioning_ResponseErr(t *testing.T) {
var sender MockRegistrationSender var sender MockRegistrationSender
sender.succeedGetHost = true sender.succeedGetHost = true
sender.errInReply = "failure occurred on permissioning" sender.errInReply = "failure occurred on permissioning"
_, err = Register(&sender, key.GetPublic(), "") _, err = register(&sender, nil, key.GetPublic(), "")
if err == nil { if err == nil {
t.Error("no error if registration fails on permissioning") t.Error("no error if registration fails on permissioning")
} }
} }
// Shows that returning an error from the RPC (e.g. context deadline exceeded) // Shows that returning an error from the RPC (e.g. context deadline exceeded)
// results in an error from Register // results in an error from register
func TestRegisterWithPermissioning_ConnectionErr(t *testing.T) { func TestRegisterWithPermissioning_ConnectionErr(t *testing.T) {
rng := csprng.NewSystemRNG() rng := csprng.NewSystemRNG()
key, err := rsa.GenerateKey(rng, 256) key, err := rsa.GenerateKey(rng, 256)
...@@ -118,7 +107,7 @@ func TestRegisterWithPermissioning_ConnectionErr(t *testing.T) { ...@@ -118,7 +107,7 @@ func TestRegisterWithPermissioning_ConnectionErr(t *testing.T) {
var sender MockRegistrationSender var sender MockRegistrationSender
sender.succeedGetHost = true sender.succeedGetHost = true
sender.errSendRegistration = errors.New("connection problem") sender.errSendRegistration = errors.New("connection problem")
_, err = Register(&sender, key.GetPublic(), "") _, err = register(&sender, nil, key.GetPublic(), "")
if err == nil { if err == nil {
t.Error("no error if e.g. context deadline exceeded") t.Error("no error if e.g. context deadline exceeded")
} }
......
package permissioning
import (
"github.com/pkg/errors"
"gitlab.com/elixxir/primitives/version"
pb "gitlab.com/elixxir/comms/mixmessages"
"gitlab.com/xx_network/comms/connect"
)
// GetNetworkVersion contacts the permissioning server and returns the current
// supported client version.
// returns a bool which designates if the network is enforcing versioning
// (not enforcing versioning is mostly a debugging)
// returns the version and an error if problems arise
func (perm *Permissioning) GetNetworkVersion() (bool, version.Version, error) {
return getRemoteVersion(perm.host, perm.comms)
}
type getRemoteClientVersionComms interface {
SendGetCurrentClientVersionMessage(host *connect.Host) (*pb.ClientVersion, error)
}
// getRemoteVersion contacts the permissioning server and returns the current
// supported client version.
func getRemoteVersion(permissioningHost *connect.Host, comms getRemoteClientVersionComms) (bool, version.Version, error) {
//gets the remove version
response, err := comms.SendGetCurrentClientVersionMessage(
permissioningHost)
if err != nil {
return false, version.Version{}, errors.WithMessage(err,
"Failed to get minimum client version from network")
}
if response.Version == "" {
return false, version.Version{}, nil
}
netVersion, err := version.ParseVersion(response.Version)
if err != nil {
return false, version.Version{}, errors.WithMessagef(err,
"Failed to parse minimum client version %s from network",
response.Version)
}
return true, netVersion, nil
}
package storage
import (
"gitlab.com/elixxir/client/storage/versioned"
"gitlab.com/elixxir/client/vendor/github.com/pkg/errors"
"time"
)
const regCodeKey = "regCode"
const regCodeVersion = 0
// SetNDF stores a network definition json file
func (s *Session) SetRegCode(regCode string) error {
return s.Set(regCodeKey,
&versioned.Object{
Version: regCodeVersion,
Data: []byte(regCode),
Timestamp: time.Now(),
})
}
// Returns the stored network definition json file
func (s *Session) GetRegCode() (string, error) {
regCode, err := s.Get(regCodeKey)
if err != nil {
return "", errors.WithMessage(err, "Failed to load the regcode")
}
return string(regCode.Data), nil
}
...@@ -10,7 +10,7 @@ package storage ...@@ -10,7 +10,7 @@ package storage
import ( import (
"github.com/pkg/errors" "github.com/pkg/errors"
"gitlab.com/elixxir/client/globals" jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/storage/cmix" "gitlab.com/elixxir/client/storage/cmix"
"gitlab.com/elixxir/client/storage/conversation" "gitlab.com/elixxir/client/storage/conversation"
"gitlab.com/elixxir/client/storage/e2e" "gitlab.com/elixxir/client/storage/e2e"
...@@ -27,7 +27,6 @@ import ( ...@@ -27,7 +27,6 @@ import (
"gitlab.com/xx_network/primitives/ndf" "gitlab.com/xx_network/primitives/ndf"
"sync" "sync"
"testing" "testing"
"time"
) )
// Number of rounds to store in the CheckedRound buffer // Number of rounds to store in the CheckedRound buffer
...@@ -217,25 +216,6 @@ func (s *Session) Partition() *partition.Store { ...@@ -217,25 +216,6 @@ func (s *Session) Partition() *partition.Store {
return s.partition return s.partition
} }
// SetNDF stores a network definition json file
func (s *Session) SetNDF(ndfJSON string) error {
return s.Set("NetworkDefinition",
&versioned.Object{
Version: uint64(1),
Data: []byte(ndfJSON),
Timestamp: time.Now(),
})
}
// Returns the stored network definition json file
func (s *Session) GetNDF() (string, error) {
ndf, err := s.Get("NetworkDefinition")
if err != nil {
return "", err
}
return string(ndf.Data), nil
}
// Get an object from the session // Get an object from the session
func (s *Session) Get(key string) (*versioned.Object, error) { func (s *Session) Get(key string) (*versioned.Object, error) {
return s.kv.Get(key) return s.kv.Get(key)
...@@ -262,7 +242,7 @@ func InitTestingSession(i interface{}) *Session { ...@@ -262,7 +242,7 @@ func InitTestingSession(i interface{}) *Session {
case *testing.B: case *testing.B:
break break
default: default:
globals.Log.FATAL.Panicf("InitTestingSession is restricted to testing only. Got %T", i) jww.FATAL.Panicf("InitTestingSession is restricted to testing only. Got %T", i)
} }
privKey, _ := rsa.LoadPrivateKeyFromPem([]byte("-----BEGIN PRIVATE KEY-----\nMIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQC7Dkb6VXFn4cdp\nU0xh6ji0nTDQUyT9DSNW9I3jVwBrWfqMc4ymJuonMZbuqK+cY2l+suS2eugevWZr\ntzujFPBRFp9O14Jl3fFLfvtjZvkrKbUMHDHFehascwzrp3tXNryiRMmCNQV55TfI\nTVCv8CLE0t1ibiyOGM9ZWYB2OjXt59j76lPARYww5qwC46vS6+3Cn2Yt9zkcrGes\nkWEFa2VttHqF910TP+DZk2R5C7koAh6wZYK6NQ4S83YQurdHAT51LKGrbGehFKXq\n6/OAXCU1JLi3kW2PovTb6MZuvxEiRmVAONsOcXKu7zWCmFjuZZwfRt2RhnpcSgzf\nrarmsG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FUf/oOjmSorSG75WT3sA\n0ZiR0SH5mhFR2Nf1TJ4JHmFaQDMQqo+EG6lEbAECggEAA7kGnuQ0lSCiI3RQV9Wy\nAa9uAFtyE8/XzJWPaWlnoFk04jtoldIKyzHOsVU0GOYOiyKeTWmMFtTGANre8l51\nizYiTuVBmK+JD/2Z8/fgl8dcoyiqzvwy56kX3QUEO5dcKO48cMohneIiNbB7PnrM\nTpA3OfkwnJQGrX0/66GWrLYP8qmBDv1AIgYMilAa40VdSyZbNTpIdDgfP6bU9Ily\nG7gnyF47HHPt5Cx4ouArbMvV1rof7ytCrfCEhP21Lc46Ryxy81W5ZyzoQfSxfdKb\nGyDR+jkryVRyG69QJf5nCXfNewWbFR4ohVtZ78DNVkjvvLYvr4qxYYLK8PI3YMwL\nsQKCAQB9lo7JadzKVio+C18EfNikOzoriQOaIYowNaaGDw3/9KwIhRsKgoTs+K5O\ngt/gUoPRGd3M2z4hn5j4wgeuFi7HC1MdMWwvgat93h7R1YxiyaOoCTxH1klbB/3K\n4fskdQRxuM8McUebebrp0qT5E0xs2l+ABmt30Dtd3iRrQ5BBjnRc4V//sQiwS1aC\nYi5eNYCQ96BSAEo1dxJh5RI/QxF2HEPUuoPM8iXrIJhyg9TEEpbrEJcxeagWk02y\nOMEoUbWbX07OzFVvu+aJaN/GlgiogMQhb6IiNTyMlryFUleF+9OBA8xGHqGWA6nR\nOaRA5ZbdE7g7vxKRV36jT3wvD7W+\n-----END PRIVATE KEY-----\n"))
...@@ -271,7 +251,7 @@ func InitTestingSession(i interface{}) *Session { ...@@ -271,7 +251,7 @@ func InitTestingSession(i interface{}) *Session {
s := &Session{kv: kv} s := &Session{kv: kv}
u, err := user.NewUser(kv, id.NewIdFromString("zezima", id.User, i), []byte("salt"), privKey, false) u, err := user.NewUser(kv, id.NewIdFromString("zezima", id.User, i), []byte("salt"), privKey, false)
if err != nil { if err != nil {
globals.Log.FATAL.Panicf("InitTestingSession failed to create dummy user: %+v", err) jww.FATAL.Panicf("InitTestingSession failed to create dummy user: %+v", err)
} }
u.SetRegistrationValidationSignature([]byte("sig")) u.SetRegistrationValidationSignature([]byte("sig"))
s.user = u s.user = u
...@@ -294,7 +274,7 @@ func InitTestingSession(i interface{}) *Session { ...@@ -294,7 +274,7 @@ func InitTestingSession(i interface{}) *Session {
"DC4473F996BDCE6EED1CABED8B6F116F7AD9CF505DF0F998E34AB27514B0FFE7", 16)) "DC4473F996BDCE6EED1CABED8B6F116F7AD9CF505DF0F998E34AB27514B0FFE7", 16))
cmix, err := cmix.NewStore(cmixGrp, kv, cmixGrp.NewInt(2)) cmix, err := cmix.NewStore(cmixGrp, kv, cmixGrp.NewInt(2))
if err != nil { if err != nil {
globals.Log.FATAL.Panicf("InitTestingSession failed to create dummy cmix session: %+v", err) jww.FATAL.Panicf("InitTestingSession failed to create dummy cmix session: %+v", err)
} }
s.cmix = cmix s.cmix = cmix
return s return s
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment