diff --git a/api/notifications.go b/api/notifications.go index 838d1e1794216e7a52d4d71210e9127d92a776ae..da7f6642a4678b7e25efe217ef34d9c8542d1057 100644 --- a/api/notifications.go +++ b/api/notifications.go @@ -40,7 +40,7 @@ func (c *Client) RegisterForNotifications(token string) error { &mixmessages.NotificationRegisterRequest{ Token: token, IntermediaryId: intermediaryReceptionID, - TransmissionRsa: rsa.CreatePublicKeyPem(c.GetUser().TransmissionRSA.GetPublic()), + TransmissionRsa: rsa.CreatePublicKeyPem(c.GetStorage().User().GetCryptographicIdentity().GetTransmissionRSA().GetPublic()), TransmissionSalt: c.GetUser().TransmissionSalt, TransmissionRsaSig: c.GetStorage().User().GetTransmissionRegistrationValidationSignature(), IIDTransmissionRsaSig: sig, @@ -95,7 +95,8 @@ func (c *Client) getIidAndSig() ([]byte, []byte, error) { } stream := c.rng.GetStream() - sig, err := rsa.Sign(stream, c.GetUser().TransmissionRSA, hash.CMixHash, h.Sum(nil), nil) + c.GetUser() + sig, err := rsa.Sign(stream, c.storage.User().GetCryptographicIdentity().GetTransmissionRSA(), hash.CMixHash, h.Sum(nil), nil) if err != nil { return nil, nil, errors.WithMessage(err, "RegisterForNotifications: Failed to sign intermediary ID") } diff --git a/cmd/root.go b/cmd/root.go index 01b245cec199c3d1ceb726de9c3b1938c7261614..ae852c8a1ec659c75497c712c95a99be3d05e096 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -116,7 +116,7 @@ var rootCmd = &cobra.Command{ client.GetHealth().AddChannel(connected) waitUntilConnected(connected) - //err = client.RegisterForNotifications([]byte("dJwuGGX3KUyKldWK5PgQH8:APA91bFjuvimRc4LqOyMDiy124aLedifA8DhldtaB_b76ggphnFYQWJc_fq0hzQ-Jk4iYp2wPpkwlpE1fsOjs7XWBexWcNZoU-zgMiM0Mso9vTN53RhbXUferCbAiEylucEOacy9pniN")) + //err = client.RegisterForNotifications("dJwuGGX3KUyKldWK5PgQH8:APA91bFjuvimRc4LqOyMDiy124aLedifA8DhldtaB_b76ggphnFYQWJc_fq0hzQ-Jk4iYp2wPpkwlpE1fsOjs7XWBexWcNZoU-zgMiM0Mso9vTN53RhbXUferCbAiEylucEOacy9pniN") //if err != nil { // jww.FATAL.Panicf("Failed to register for notifications: %+v", err) //} diff --git a/go.mod b/go.mod index 13cf8b2867b9d097a645ae4c7720efffa3bc5416..5adeb654fcc0b32b1f52f368b5e54a416aeb98af 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( gitlab.com/elixxir/primitives v0.0.3-0.20210427004615-c68ecf15fcf3 gitlab.com/xx_network/comms v0.0.4-0.20210409202820-eb3dca6571d3 gitlab.com/xx_network/crypto v0.0.5-0.20210405224157-2b1f387b42c1 - gitlab.com/xx_network/primitives v0.0.4-0.20210402222416-37c1c4d3fac4 + gitlab.com/xx_network/primitives v0.0.4-0.20210419175212-11b843dd4791 golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 // indirect google.golang.org/genproto v0.0.0-20210105202744-fe13368bc0e1 // indirect diff --git a/go.sum b/go.sum index 87d34b61f799615b1d3f90a2f26170233aa70ea5..8dd7ece321e30d8dc552f474fe93c067a02de762 100644 --- a/go.sum +++ b/go.sum @@ -309,6 +309,8 @@ gitlab.com/xx_network/primitives v0.0.2 h1:r45yKenJ9e7PylI1ZXJ1Es09oYNaYXjxVy9+u gitlab.com/xx_network/primitives v0.0.2/go.mod h1:cs0QlFpdMDI6lAo61lDRH2JZz+3aVkHy+QogOB6F/qc= gitlab.com/xx_network/primitives v0.0.4-0.20210402222416-37c1c4d3fac4 h1:YPYTKF0zQf08y0eQrjQP01C/EWQTypdqawjZPr5c6rc= gitlab.com/xx_network/primitives v0.0.4-0.20210402222416-37c1c4d3fac4/go.mod h1:9imZHvYwNFobxueSvVtHneZLk9wTK7HQTzxPm+zhFhE= +gitlab.com/xx_network/primitives v0.0.4-0.20210419175212-11b843dd4791 h1:RSeT0tJiwRr1BuKsTCaulr+eJAxQHDl/r9ZMo4lN9mg= +gitlab.com/xx_network/primitives v0.0.4-0.20210419175212-11b843dd4791/go.mod h1:9imZHvYwNFobxueSvVtHneZLk9wTK7HQTzxPm+zhFhE= gitlab.com/xx_network/ring v0.0.2 h1:TlPjlbFdhtJrwvRgIg4ScdngMTaynx/ByHBRZiXCoL0= gitlab.com/xx_network/ring v0.0.2/go.mod h1:aLzpP2TiZTQut/PVHR40EJAomzugDdHXetbieRClXIM= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= diff --git a/permissioning/register.go b/permissioning/register.go index 1a64e54798560b270ab0d62267f7b2704a2c8ae1..50f6c7ca603c6c73423e9b1af160bb302ee9f33e 100644 --- a/permissioning/register.go +++ b/permissioning/register.go @@ -27,7 +27,6 @@ type registrationMessageSender interface { // Returns an error if registration fails. func register(comms registrationMessageSender, host *connect.Host, transmissionPublicKey, receptionPublicKey *rsa.PublicKey, registrationCode string) ([]byte, []byte, error) { - response, err := comms. SendRegistrationMessage(host, &pb.UserRegistration{ @@ -35,8 +34,9 @@ func register(comms registrationMessageSender, host *connect.Host, ClientRSAPubKey: string(rsa.CreatePublicKeyPem(transmissionPublicKey)), ClientReceptionRSAPubKey: string(rsa.CreatePublicKeyPem(receptionPublicKey)), }) + if err != nil { - err = errors.Wrap(err, "sendRegistrationMessage: Unable to contact Identity Server!") + err = errors.WithMessage(err, "sendRegistrationMessage: Unable to contact Identity Server!") return nil, nil, err } if response.Error != "" { diff --git a/storage/user.go b/storage/user.go index df1d9055e3490a3290d9ad378b3857bc16ca7cc4..a443d81cb2f052445a2b24a0a6becf9da0a2774b 100644 --- a/storage/user.go +++ b/storage/user.go @@ -16,7 +16,7 @@ func (s *Session) GetUser() user.User { return user.User{ TransmissionID: ci.GetTransmissionID().DeepCopy(), TransmissionSalt: copySlice(ci.GetTransmissionSalt()), - TransmissionRSA: ci.GetReceptionRSA(), + TransmissionRSA: ci.GetTransmissionRSA(), ReceptionID: ci.GetReceptionID().DeepCopy(), ReceptionSalt: copySlice(ci.GetReceptionSalt()), ReceptionRSA: ci.GetReceptionRSA(),