Skip to content
Snippets Groups Projects
Commit 0fc178f7 authored by Jonah Husson's avatar Jonah Husson
Browse files

Merge branch 'et/verify-perm' into 'release'

Include perm signature in register message to notifications bot

See merge request !606
parents 7305ea4f 3edeb88a
No related branches found
No related tags found
1 merge request!23Release
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
package api package api
import ( import (
"fmt"
"github.com/pkg/errors" "github.com/pkg/errors"
jww "github.com/spf13/jwalterweatherman" jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/comms/mixmessages" "gitlab.com/elixxir/comms/mixmessages"
...@@ -26,7 +25,6 @@ import ( ...@@ -26,7 +25,6 @@ import (
// risk to the user. // risk to the user.
func (c *Client) RegisterForNotifications(token string) error { func (c *Client) RegisterForNotifications(token string) error {
jww.INFO.Printf("RegisterForNotifications(%s)", token) jww.INFO.Printf("RegisterForNotifications(%s)", token)
fmt.Println("RegisterforNotifications")
// Pull the host from the manage // Pull the host from the manage
notificationBotHost, ok := c.comms.GetHost(&id.NotificationBot) notificationBotHost, ok := c.comms.GetHost(&id.NotificationBot)
if !ok { if !ok {
...@@ -36,16 +34,15 @@ func (c *Client) RegisterForNotifications(token string) error { ...@@ -36,16 +34,15 @@ func (c *Client) RegisterForNotifications(token string) error {
if err != nil { if err != nil {
return err return err
} }
fmt.Println("Sending message")
// Send the register message // Send the register message
_, err = c.comms.RegisterForNotifications(notificationBotHost, _, err = c.comms.RegisterForNotifications(notificationBotHost,
&mixmessages.NotificationRegisterRequest{ &mixmessages.NotificationRegisterRequest{
Token: token, Token: token,
IntermediaryId: intermediaryReceptionID, IntermediaryId: intermediaryReceptionID,
TransmissionRsa: rsa.CreatePublicKeyPem(c.GetUser().TransmissionRSA.GetPublic()), TransmissionRsa: rsa.CreatePublicKeyPem(c.GetStorage().User().GetCryptographicIdentity().GetTransmissionRSA().GetPublic()),
TransmissionRsaSig: sig,
TransmissionSalt: c.GetUser().TransmissionSalt, TransmissionSalt: c.GetUser().TransmissionSalt,
IIDTransmissionRsaSig: []byte("temp"), TransmissionRsaSig: c.GetStorage().User().GetTransmissionRegistrationValidationSignature(),
IIDTransmissionRsaSig: sig,
RegistrationTimestamp: c.GetUser().RegistrationTimestamp.UnixNano(), RegistrationTimestamp: c.GetUser().RegistrationTimestamp.UnixNano(),
}) })
if err != nil { if err != nil {
...@@ -97,9 +94,12 @@ func (c *Client) getIidAndSig() ([]byte, []byte, error) { ...@@ -97,9 +94,12 @@ func (c *Client) getIidAndSig() ([]byte, []byte, error) {
return nil, nil, errors.WithMessage(err, "RegisterForNotifications: Failed to write intermediary ID to hash") return nil, nil, errors.WithMessage(err, "RegisterForNotifications: Failed to write intermediary ID to hash")
} }
sig, err := rsa.Sign(c.rng.GetStream(), c.GetUser().TransmissionRSA, hash.CMixHash, h.Sum(nil), nil) stream := c.rng.GetStream()
c.GetUser()
sig, err := rsa.Sign(stream, c.storage.User().GetCryptographicIdentity().GetTransmissionRSA(), hash.CMixHash, h.Sum(nil), nil)
if err != nil { if err != nil {
return nil, nil, errors.WithMessage(err, "RegisterForNotifications: Failed to sign intermediary ID") return nil, nil, errors.WithMessage(err, "RegisterForNotifications: Failed to sign intermediary ID")
} }
stream.Close()
return intermediaryReceptionID, sig, nil return intermediaryReceptionID, sig, nil
} }
...@@ -103,7 +103,7 @@ var rootCmd = &cobra.Command{ ...@@ -103,7 +103,7 @@ var rootCmd = &cobra.Command{
client.GetHealth().AddChannel(connected) client.GetHealth().AddChannel(connected)
waitUntilConnected(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 { //if err != nil {
// jww.FATAL.Panicf("Failed to register for notifications: %+v", err) // jww.FATAL.Panicf("Failed to register for notifications: %+v", err)
//} //}
......
...@@ -81,7 +81,6 @@ func sendCmixHelper(sender *gateway.Sender, msg format.Message, ...@@ -81,7 +81,6 @@ func sendCmixHelper(sender *gateway.Sender, msg format.Message,
continue continue
} }
//add the round on to the list of attempted so it is not tried again //add the round on to the list of attempted so it is not tried again
attempted.Insert(bestRound) attempted.Insert(bestRound)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment