diff --git a/api/connect.go b/api/connect.go index 578ee3e05f6250bf69fc5d40ad8085317eb7131a..928e47f63b522974a51d4fd6b9f1744482b8fb81 100644 --- a/api/connect.go +++ b/api/connect.go @@ -59,7 +59,6 @@ func (cl *Client) InitNetwork() error { if err != nil { return err } - err = addNotificationBotHost(cl.receptionManager, cl.ndf) if err != nil { return errors.Errorf("Failed to connect to notification bot at %+v", cl.ndf) diff --git a/api/mockserver.go b/api/mockserver.go index ca0d86e8e580d6c0890331111940f2e68bfea0df..0e487eefab28de3cc65da1e82d430c3b2102764e 100644 --- a/api/mockserver.go +++ b/api/mockserver.go @@ -294,9 +294,11 @@ func (m *GatewayHandler) CheckMessages(userId *id.ID, // PutMessage adds a message to the outgoing queue and // calls SendBatch when it's size is the batch size -func (m *GatewayHandler) PutMessage(msg *pb.Slot, ipaddr string) error { - m.LastReceivedMessage = *msg - return nil +func (m *GatewayHandler) PutMessage(msg *pb.GatewaySlot, ipaddr string) (*pb.GatewaySlotResponse, error) { + m.LastReceivedMessage = *msg.Message + return &pb.GatewaySlotResponse{ + Accepted:true, + }, nil } func (m *GatewayHandler) ConfirmNonce(message *pb.RequestRegistrationConfirmation, ipaddr string) (*pb.RegistrationConfirmation, error) { @@ -350,12 +352,13 @@ func (m *GatewayHandlerMultipleMessages) CheckMessages(userId *id.ID, // PutMessage adds a message to the outgoing queue and // calls SendBatch when it's size is the batch size -func (m *GatewayHandlerMultipleMessages) PutMessage(msg *pb.Slot, ipaddr string) error { +func (m *GatewayHandlerMultipleMessages) PutMessage(msg *pb.GatewaySlot, ipaddr string) (*pb.GatewaySlotResponse, error) { + fmt.Printf("multiMessages\n\n\n") for i := 0; i < BatchSize; i++ { - msg.Index = uint32(i) - m.LastReceivedMessage = append(m.LastReceivedMessage, *msg) + msg.Message.Index = uint32(i) + m.LastReceivedMessage = append(m.LastReceivedMessage, *msg.Message) } - return nil + return &pb.GatewaySlotResponse{}, nil } func (m *GatewayHandlerMultipleMessages) ConfirmNonce(message *pb.RequestRegistrationConfirmation, ipaddr string) (*pb.RegistrationConfirmation, error) { diff --git a/api/mockserver_test.go b/api/mockserver_test.go index 86a26bf01b7db1641ea79003bdfbb33e6782a86f..093f29e5e3ecf977ed401f2d00c2fe861c1ac14f 100644 --- a/api/mockserver_test.go +++ b/api/mockserver_test.go @@ -18,6 +18,7 @@ import ( "gitlab.com/elixxir/comms/registration" "gitlab.com/elixxir/primitives/id" "gitlab.com/elixxir/primitives/ndf" + "gitlab.com/xx_network/comms/connect" "os" "strings" "testing" @@ -326,6 +327,14 @@ func TestSend(t *testing.T) { t.Errorf("Could not start message reception: %+v", err) } + var nodeIds [][]byte + for _, nodes := range client.ndf.Nodes { + nodeIds = append(nodeIds, nodes.ID) + } + + idlist, _ := id.NewIDListFromBytes(nodeIds) + + client.topology = connect.NewCircuit(idlist) // Test send with invalid sender ID err = client.Send( APIMessage{ @@ -458,7 +467,8 @@ func testMainWrapper(m *testing.M) int { def.Nodes = append(def.Nodes, n) ErrorDef.Nodes = append(ErrorDef.Nodes, n) } - startServers() + + startServers(m) defer testWrapperShutdown() return m.Run() } @@ -514,7 +524,7 @@ func getNDF() *ndf.NetworkDefinition { } } -func startServers() { +func startServers(m *testing.M) { regId := new(id.ID) copy(regId[:], "testServer") regId.SetType(id.Generic) diff --git a/bindings/client_test.go b/bindings/client_test.go index f59ee64034c0b680752c0133cd9adf84eb00eca0..c3f2e70df79c9c6717edabd718b1fa46a3e48598 100644 --- a/bindings/client_test.go +++ b/bindings/client_test.go @@ -20,10 +20,13 @@ import ( "gitlab.com/elixxir/comms/gateway" pb "gitlab.com/elixxir/comms/mixmessages" "gitlab.com/elixxir/comms/registration" + "gitlab.com/elixxir/crypto/cyclic" + "gitlab.com/elixxir/crypto/large" "gitlab.com/elixxir/crypto/signature/rsa" "gitlab.com/elixxir/primitives/id" "gitlab.com/elixxir/primitives/ndf" "gitlab.com/xx_network/comms/connect" + "gitlab.com/xx_network/comms/messages" "math/rand" "os" "reflect" @@ -636,7 +639,7 @@ func testMainWrapper(m *testing.M) int { def.Gateways = append(def.Gateways, gw) GWComms[i] = gateway.StartGateway(gwId, gw.Address, - gateway.NewImplementation(), nil, nil) + &GatewayHandler{}, nil, nil) } // Start mock registration server and defer its shutdown @@ -812,3 +815,80 @@ func disconnectServers() { } RegComms.DisconnectAll() } + +// ------------------------------------ MOCK GATEWAYS ---------------------------------------------------------------- + +// Blank struct implementing ServerHandler interface for testing purposes (Passing to StartServer) +type GatewayHandler struct { + LastReceivedMessage pb.Slot +} + +func (m *GatewayHandler) PollForNotifications(auth *connect.Auth) ([]*id.ID, error) { + + return nil, nil +} + +func (m *GatewayHandler) Poll(*pb.GatewayPoll) (*pb.GatewayPollResponse, error) { + return nil, nil +} + +// Returns message contents for MessageID, or a null/randomized message +// if that ID does not exist of the same size as a regular message +func (m *GatewayHandler) GetMessage(userId *id.ID, + msgId, ipaddr string) (*pb.Slot, error) { + return &pb.Slot{}, nil +} + +// Return any MessageIDs in the globals for this User +func (m *GatewayHandler) CheckMessages(userId *id.ID, + messageID, ipAddress string) ([]string, error) { + return make([]string, 0), nil +} + +// PutMessage adds a message to the outgoing queue and +// calls SendBatch when it's size is the batch size +func (m *GatewayHandler) PutMessage(msg *pb.GatewaySlot, ipaddr string) (*pb.GatewaySlotResponse, error) { + m.LastReceivedMessage = *msg.Message + return &pb.GatewaySlotResponse{ + Accepted:true, + }, nil +} + +func (m *GatewayHandler) ConfirmNonce(message *pb.RequestRegistrationConfirmation, ipaddr string) (*pb.RegistrationConfirmation, error) { + regConfirmation := &pb.RegistrationConfirmation{ + ClientSignedByServer: &messages.RSASignature{}, + } + + return regConfirmation, nil +} + +// Pass-through for Registration Nonce Communication +func (m *GatewayHandler) RequestNonce(message *pb.NonceRequest, ipaddr string) (*pb.Nonce, error) { + dh := getDHPubKey().Bytes() + return &pb.Nonce{ + DHPubKey: dh, + }, nil +} + +func getDHPubKey() *cyclic.Int { + cmixGrp := cyclic.NewGroup( + large.NewIntFromString("9DB6FB5951B66BB6FE1E140F1D2CE5502374161FD6538DF1648218642F0B5C48"+ + "C8F7A41AADFA187324B87674FA1822B00F1ECF8136943D7C55757264E5A1A44F"+ + "FE012E9936E00C1D3E9310B01C7D179805D3058B2A9F4BB6F9716BFE6117C6B5"+ + "B3CC4D9BE341104AD4A80AD6C94E005F4B993E14F091EB51743BF33050C38DE2"+ + "35567E1B34C3D6A5C0CEAA1A0F368213C3D19843D0B4B09DCB9FC72D39C8DE41"+ + "F1BF14D4BB4563CA28371621CAD3324B6A2D392145BEBFAC748805236F5CA2FE"+ + "92B871CD8F9C36D3292B5509CA8CAA77A2ADFC7BFD77DDA6F71125A7456FEA15"+ + "3E433256A2261C6A06ED3693797E7995FAD5AABBCFBE3EDA2741E375404AE25B", 16), + large.NewIntFromString("5C7FF6B06F8F143FE8288433493E4769C4D988ACE5BE25A0E24809670716C613"+ + "D7B0CEE6932F8FAA7C44D2CB24523DA53FBE4F6EC3595892D1AA58C4328A06C4"+ + "6A15662E7EAA703A1DECF8BBB2D05DBE2EB956C142A338661D10461C0D135472"+ + "085057F3494309FFA73C611F78B32ADBB5740C361C9F35BE90997DB2014E2EF5"+ + "AA61782F52ABEB8BD6432C4DD097BC5423B285DAFB60DC364E8161F4A2A35ACA"+ + "3A10B1C4D203CC76A470A33AFDCBDD92959859ABD8B56E1725252D78EAC66E71"+ + "BA9AE3F1DD2487199874393CD4D832186800654760E1E34C09E4D155179F9EC0"+ + "DC4473F996BDCE6EED1CABED8B6F116F7AD9CF505DF0F998E34AB27514B0FFE7", 16)) + + dh := cmixGrp.RandomCoprime(cmixGrp.NewMaxInt()) + return cmixGrp.ExpG(dh, cmixGrp.NewMaxInt()) +} diff --git a/cmd/root.go b/cmd/root.go index c61e825a24dcb4eae57cae5fd6c61eca64955142..825cb3218ef90899680dff436a6f9d2f6478a3d5 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -745,4 +745,3 @@ func buildPrecannedIDList() []*id.ID { return idList } - diff --git a/globals/version_vars.go b/globals/version_vars.go index adb16b83a9a4d441e85e282929bd7d9d59a0409e..c3523d28d87ae11b502bf1636e5a5d9ee461bb8f 100644 --- a/globals/version_vars.go +++ b/globals/version_vars.go @@ -1,9 +1,9 @@ // Code generated by go generate; DO NOT EDIT. // This file was generated by robots at -// 2020-07-30 15:27:18.7064291 -0700 PDT m=+0.065083001 +// 2020-08-03 10:45:37.897014448 -0700 PDT m=+0.010920997 package globals -const GITVERSION = `4ef845a Merge branch 'hotfix/integrateekv' into 'release'` +const GITVERSION = `eacc031 Merge branch 'release' of gitlab.com:elixxir/client into XX-2431/ClientAuth` const SEMVER = "1.4.0" const DEPENDENCIES = `module gitlab.com/elixxir/client @@ -22,12 +22,17 @@ require ( 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-20200730220537-60dbe58afe94 - gitlab.com/elixxir/crypto v0.0.0-20200707005343-97f868cbd930 + gitlab.com/elixxir/comms v0.0.0-20200731222525-4309a98f7b4d + gitlab.com/elixxir/crypto v0.0.0-20200721213839-b026955c55c0 gitlab.com/elixxir/ekv v0.0.0-20200729182028-159355ea5842 - gitlab.com/elixxir/primitives v0.0.0-20200706165052-9fe7a4fb99a3 - gitlab.com/xx_network/comms v0.0.0-20200730220144-eea32e8b696d + gitlab.com/elixxir/primitives v0.0.0-20200731184040-494269b53b4d + gitlab.com/xx_network/comms v0.0.0-20200731231107-9e020daf0013 golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 gopkg.in/ini.v1 v1.52.0 // indirect ) + +replace ( + gitlab.com/xx_network/collections/ring => gitlab.com/xx_network/collections/ring.git v0.0.1 + google.golang.org/grpc => github.com/grpc/grpc-go v1.27.1 +) ` diff --git a/go.mod b/go.mod index f483175c4086c6414c15f9cd2f863fc10c680e0e..14162fb373aa7a704990e640ea6db883f51d0be2 100644 --- a/go.mod +++ b/go.mod @@ -15,11 +15,16 @@ require ( 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-20200730220537-60dbe58afe94 - gitlab.com/elixxir/crypto v0.0.0-20200707005343-97f868cbd930 + gitlab.com/elixxir/comms v0.0.0-20200731222525-4309a98f7b4d + gitlab.com/elixxir/crypto v0.0.0-20200721213839-b026955c55c0 gitlab.com/elixxir/ekv v0.0.0-20200729182028-159355ea5842 - gitlab.com/elixxir/primitives v0.0.0-20200706165052-9fe7a4fb99a3 - gitlab.com/xx_network/comms v0.0.0-20200730220144-eea32e8b696d + gitlab.com/elixxir/primitives v0.0.0-20200731184040-494269b53b4d + gitlab.com/xx_network/comms v0.0.0-20200731231107-9e020daf0013 golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 gopkg.in/ini.v1 v1.52.0 // indirect ) + +replace ( + gitlab.com/xx_network/collections/ring => gitlab.com/xx_network/collections/ring.git v0.0.1 + google.golang.org/grpc => github.com/grpc/grpc-go v1.27.1 +) diff --git a/go.sum b/go.sum index 0222d5381d5434a6707b9200622d02e3c7197de4..aac5d375356af78a845041eef41667b11aec9cf9 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,3 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -9,8 +8,6 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -23,9 +20,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -40,13 +35,13 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 h1:zN2lZNZRflqFyxVaTIU61KNKQ9C0055u9CAfpmqUvo4= github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3/go.mod h1:nPpo7qLxd6XL3hWJG/O60sR8ZKfMCiIoNap5GvD12KU= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -72,6 +67,8 @@ github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoA github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc/grpc-go v1.27.1 h1:EluyjU5nlbuNJSEktNl600PIpzbO2OcvZWfWV1jFvKM= +github.com/grpc/grpc-go v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= @@ -160,17 +157,29 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1 github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/zeebo/assert v0.0.0-20181109011804-10f827ce2ed6/go.mod h1:yssERNPivllc1yU3BvpjYI5BUW+zglcz6QWqeVRL5t0= +github.com/zeebo/assert v1.1.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= +github.com/zeebo/blake3 v0.0.4/go.mod h1:YOZo8A49yNqM0X/Y+JmDUZshJWLt1laHsNSn5ny2i34= +github.com/zeebo/pcg v0.0.0-20181207190024-3cdc6b625a05/go.mod h1:Gr+78ptB0MwXxm//LBaEvBiaXY7hXJ6KGe2V32X2F6E= gitlab.com/elixxir/comms v0.0.0-20200707210150-b8ebd0951d23/go.mod h1:OsWMZ1O/R9fOkm+PoHnR3rkXfFtipGoPs73FuKuurHY= -gitlab.com/elixxir/comms v0.0.0-20200730220537-60dbe58afe94 h1:AY3Nm9QXAh8jRUyKdX0jsay4A4j4z7/ofJgJKbvIFmc= -gitlab.com/elixxir/comms v0.0.0-20200730220537-60dbe58afe94/go.mod h1:rlB+AA0mNMRq9GIR587cNw5RX4Cr8VOiVpZkFTTcukQ= +gitlab.com/elixxir/comms v0.0.0-20200731222525-4309a98f7b4d h1:DR9dZn8NVTgTesOyQhFCnyLtySPp8ajVjv+GYfkjSbg= +gitlab.com/elixxir/comms v0.0.0-20200731222525-4309a98f7b4d/go.mod h1:wYiItOoVbs3LuM8eAR1mqGoMX1TY3NFkDMv0slxyH+U= gitlab.com/elixxir/crypto v0.0.0-20200707005343-97f868cbd930 h1:9qzfwyR12OYgn3j30qcHZHHVfWshWnH54lcAHppEROQ= gitlab.com/elixxir/crypto v0.0.0-20200707005343-97f868cbd930/go.mod h1:LHBAaEf48a0/AjU118rjoworH0LgXifhAqmNX3ZRvME= +gitlab.com/elixxir/crypto v0.0.0-20200721213839-b026955c55c0 h1:bXpAX607nE2edN7ei8CIAcHuD0kJxDdGFusK51qlxN4= +gitlab.com/elixxir/crypto v0.0.0-20200721213839-b026955c55c0/go.mod h1:LHBAaEf48a0/AjU118rjoworH0LgXifhAqmNX3ZRvME= gitlab.com/elixxir/ekv v0.0.0-20200729182028-159355ea5842 h1:m1zDQ6UadpuMnV7nvnyR+DUXE3AisRnVjajTb1xZE4c= gitlab.com/elixxir/ekv v0.0.0-20200729182028-159355ea5842/go.mod h1:bXY0kgbV5BHYda4YY5/hiG5bjimGK+R3PYub5yM9C/s= gitlab.com/elixxir/primitives v0.0.0-20200706165052-9fe7a4fb99a3 h1:GTfflZBNLeBq3UApYog0J3+hytdkoRsDduGQji2wyEU= gitlab.com/elixxir/primitives v0.0.0-20200706165052-9fe7a4fb99a3/go.mod h1:OQgUZq7SjnE0b+8+iIAT2eqQF+2IFHn73tOo+aV11mg= +gitlab.com/elixxir/primitives v0.0.0-20200731184040-494269b53b4d h1:OKWTmYN5q8XVHo8JXThIH0TCuvl/fLXR7MGVacpqfRg= +gitlab.com/elixxir/primitives v0.0.0-20200731184040-494269b53b4d/go.mod h1:OQgUZq7SjnE0b+8+iIAT2eqQF+2IFHn73tOo+aV11mg= +gitlab.com/xx_network/collections/ring.git v0.0.1 h1:3JLw2pgaOm57WWtjw6dvqvbud4DtoKxwYjEA95hNwgE= +gitlab.com/xx_network/collections/ring.git v0.0.1/go.mod h1:M61MlPiyB23ni0L1DJ8QErcUjOcnKEfbCpl75vE7Ej0= gitlab.com/xx_network/comms v0.0.0-20200730220144-eea32e8b696d h1:P4ceawldsxuwQ6LZHnUnemtiOJI9/QquYi8QkFuUbtI= gitlab.com/xx_network/comms v0.0.0-20200730220144-eea32e8b696d/go.mod h1:76OCijGBxYOBV5Kt7z6K7vNg3n9I57aCQMmI8GTpoEM= +gitlab.com/xx_network/comms v0.0.0-20200731231107-9e020daf0013 h1:sis9BdA5VNXUAamga/tpr4qHcJ01qugbMt6wBmaGyJ4= +gitlab.com/xx_network/comms v0.0.0-20200731231107-9e020daf0013/go.mod h1:ECW83bFGaOzZMM8axIWX6BsYpXakiM0Zf4Snp7H9+yI= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= @@ -185,11 +194,9 @@ golang.org/x/crypto v0.0.0-20200707235045-ab33eee955e0/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 h1:DZhuSZLsGlFL4CmhA8BcRA0mnthyA/nZ00AqCUo7vHg= golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -201,17 +208,16 @@ golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 h1:DYfZAGf2WMFjMxbgTjaC+2HC7NkNAQs+6Q8b9WEB/F4= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -225,14 +231,12 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= @@ -241,15 +245,6 @@ google.golang.org/genproto v0.0.0-20200514193133-8feb7f20f2a2/go.mod h1:YsZOwe1m google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200709005830-7a2ca40e9dc3 h1:JwLN1jVnmIsfE4HkDVe2AblFAbo0Z+4cjteDSOnv6oE= google.golang.org/genproto v0.0.0-20200709005830-7a2ca40e9dc3/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0 h1:M5a8xTlYTxwMn5ZFkwhRabsygDY5G8TYLyQDBxJNAxE= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/io/send.go b/io/send.go index f4d5fc97507ce718c6bdf66704facc797746a143..48da90e9d56036d7e9c180f874a8022f920368ef 100644 --- a/io/send.go +++ b/io/send.go @@ -16,9 +16,11 @@ import ( "gitlab.com/elixxir/client/parse" "gitlab.com/elixxir/client/user" pb "gitlab.com/elixxir/comms/mixmessages" + "gitlab.com/elixxir/comms/network" "gitlab.com/elixxir/crypto/cmix" "gitlab.com/elixxir/crypto/csprng" "gitlab.com/elixxir/crypto/e2e" + "gitlab.com/elixxir/crypto/hash" "gitlab.com/elixxir/primitives/format" "gitlab.com/elixxir/primitives/id" "gitlab.com/xx_network/comms/connect" @@ -138,6 +140,7 @@ func (rm *ReceptionManager) send(session user.Session, topology *connect.Circuit salt := cmix.NewSalt(csprng.Source(&csprng.SystemRNG{}), 32) encMsg, kmacs := crypto.CMIXEncrypt(session, topology, salt, message) + // Construct slot message msgPacket := &pb.Slot{ SenderID: session.GetCurrentUser().User.Marshal(), PayloadA: encMsg.GetPayloadA(), @@ -146,7 +149,42 @@ func (rm *ReceptionManager) send(session user.Session, topology *connect.Circuit KMACs: kmacs, } - return rm.Comms.SendPutMessage(transmitGateway, msgPacket) + // Retrieve the base key for the zeroeth node + nodeKeys := session.GetNodeKeys(topology) + nk := nodeKeys[0] + + clientGatewayKey := cmix.GenerateClientGatewayKey(nk.TransmissionKey) + // Hash the clientGatewayKey and the the slot's salt + h, _ := hash.NewCMixHash() + h.Write(clientGatewayKey) + h.Write(msgPacket.Salt) + hashed := h.Sum(nil) + h.Reset() + + // Construct the gateway message + msg := &pb.GatewaySlot{ + Message: msgPacket, + RoundID: 0, + } + + // Hash the gatewaySlotDigest and the above hashed data + gatewaySlotDigest := network.GenerateSlotDigest(msg) + h.Write(hashed) + h.Write(gatewaySlotDigest) + + // Place the hashed data as the message's MAC + msg.MAC = h.Sum(nil) + // Send the message + gwSlotResp, err := rm.Comms.SendPutMessage(transmitGateway, msg) + if err != nil { + return err + } + + if !gwSlotResp.Accepted { + return errors.Errorf("Message was refused!") + } + + return err } func handleE2ESending(session user.Session, diff --git a/version_vars.go.bak b/version_vars.go.bak index 67620a0b3f330cea5051e878a2c07ceea175125d..766e1c9b13bb096954c1fad0d3169f7357b4dc2b 100644 --- a/version_vars.go.bak +++ b/version_vars.go.bak @@ -1,9 +1,9 @@ // Code generated by go generate; DO NOT EDIT. // This file was generated by robots at -// 2020-07-30 15:27:18.7064291 -0700 PDT m=+0.065083001 +// 2020-08-03 10:45:37.897014448 -0700 PDT m=+0.010920997 package cmd -const GITVERSION = `4ef845a Merge branch 'hotfix/integrateekv' into 'release'` +const GITVERSION = `eacc031 Merge branch 'release' of gitlab.com:elixxir/client into XX-2431/ClientAuth` const SEMVER = "1.4.0" const DEPENDENCIES = `module gitlab.com/elixxir/client @@ -22,12 +22,17 @@ require ( 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-20200730220537-60dbe58afe94 - gitlab.com/elixxir/crypto v0.0.0-20200707005343-97f868cbd930 + gitlab.com/elixxir/comms v0.0.0-20200731222525-4309a98f7b4d + gitlab.com/elixxir/crypto v0.0.0-20200721213839-b026955c55c0 gitlab.com/elixxir/ekv v0.0.0-20200729182028-159355ea5842 - gitlab.com/elixxir/primitives v0.0.0-20200706165052-9fe7a4fb99a3 - gitlab.com/xx_network/comms v0.0.0-20200730220144-eea32e8b696d + gitlab.com/elixxir/primitives v0.0.0-20200731184040-494269b53b4d + gitlab.com/xx_network/comms v0.0.0-20200731231107-9e020daf0013 golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 gopkg.in/ini.v1 v1.52.0 // indirect ) + +replace ( + gitlab.com/xx_network/collections/ring => gitlab.com/xx_network/collections/ring.git v0.0.1 + google.golang.org/grpc => github.com/grpc/grpc-go v1.27.1 +) `