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

Flip some identity uses from transmission to receiption

parent d6f27a16
No related branches found
No related tags found
No related merge requests found
...@@ -47,7 +47,7 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader, ...@@ -47,7 +47,7 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
} }
// check that the request is being sent from the proper ID // check that the request is being sent from the proper ID
if !me.ID.Cmp(storage.GetUser().TransmissionID) { if !me.ID.Cmp(storage.GetUser().ReceptionID) {
return errors.Errorf("Authenticated channel request " + return errors.Errorf("Authenticated channel request " +
"can only be sent from user's identity") "can only be sent from user's identity")
} }
...@@ -116,7 +116,7 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader, ...@@ -116,7 +116,7 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
jww.INFO.Printf("RequestAuth THEIRPUBKEY: %v", partner.DhPubKey.Bytes()) jww.INFO.Printf("RequestAuth THEIRPUBKEY: %v", partner.DhPubKey.Bytes())
/*encrypt payload*/ /*encrypt payload*/
requestFmt.SetID(storage.GetUser().TransmissionID) requestFmt.SetID(storage.GetUser().ReceptionID)
requestFmt.SetMsgPayload(msgPayloadBytes) requestFmt.SetMsgPayload(msgPayloadBytes)
ecrFmt.SetOwnership(ownership) ecrFmt.SetOwnership(ownership)
ecrPayload, mac := cAuth.Encrypt(newPrivKey, partner.DhPubKey, ecrPayload, mac := cAuth.Encrypt(newPrivKey, partner.DhPubKey,
......
...@@ -22,9 +22,9 @@ var initCmd = &cobra.Command{ ...@@ -22,9 +22,9 @@ var initCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
client := createClient() client := createClient()
user := client.GetUser() user := client.GetUser()
jww.INFO.Printf("User: %s", user.TransmissionID) jww.INFO.Printf("User: %s", user.ReceptionID)
writeContact(user.GetContact()) writeContact(user.GetContact())
fmt.Printf("%s\n", user.TransmissionID) fmt.Printf("%s\n", user.ReceptionID)
}, },
} }
......
...@@ -49,7 +49,7 @@ var rootCmd = &cobra.Command{ ...@@ -49,7 +49,7 @@ var rootCmd = &cobra.Command{
client := initClient() client := initClient()
user := client.GetUser() user := client.GetUser()
jww.INFO.Printf("User: %s", user.TransmissionID) jww.INFO.Printf("User: %s", user.ReceptionID)
writeContact(user.GetContact()) writeContact(user.GetContact())
// Set up reception handler // Set up reception handler
......
...@@ -34,7 +34,7 @@ var udCmd = &cobra.Command{ ...@@ -34,7 +34,7 @@ var udCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
client := initClient() client := initClient()
user := client.GetUser() user := client.GetUser()
jww.INFO.Printf("User: %s", user.TransmissionID) jww.INFO.Printf("User: %s", user.ReceptionID)
writeContact(user.GetContact()) writeContact(user.GetContact())
// Set up reception handler // Set up reception handler
......
...@@ -77,7 +77,7 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard, ...@@ -77,7 +77,7 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard,
Health: health.Init(instance, params.NetworkHealthTimeout), Health: health.Init(instance, params.NetworkHealthTimeout),
NodeRegistration: make(chan network.NodeGateway, params.RegNodesBufferLen), NodeRegistration: make(chan network.NodeGateway, params.RegNodesBufferLen),
Instance: instance, Instance: instance,
Uid: session.User().GetCryptographicIdentity().GetReceptionID(), Uid: session.User().GetCryptographicIdentity().GetTransmissionID(),
} }
//create sub managers //create sub managers
......
...@@ -26,7 +26,7 @@ type addFactComms interface { ...@@ -26,7 +26,7 @@ type addFactComms interface {
// called along with the code to finalize the fact. // called along with the code to finalize the fact.
func (m *Manager) SendRegisterFact(fact fact.Fact) (string, error) { func (m *Manager) SendRegisterFact(fact fact.Fact) (string, error) {
jww.INFO.Printf("ud.SendRegisterFact(%s)", fact.Stringify()) jww.INFO.Printf("ud.SendRegisterFact(%s)", fact.Stringify())
uid := m.storage.User().GetCryptographicIdentity().GetTransmissionID() uid := m.storage.User().GetCryptographicIdentity().GetReceptionID()
return m.addFact(fact, uid, m.comms) return m.addFact(fact, uid, m.comms)
} }
......
...@@ -92,7 +92,7 @@ func NewManager(client *api.Client) (*Manager, error) { ...@@ -92,7 +92,7 @@ func NewManager(client *api.Client) (*Manager, error) {
} }
//get the commonly used data from storage //get the commonly used data from storage
m.privKey = m.storage.GetUser().TransmissionRSA m.privKey = m.storage.GetUser().ReceptionRSA
//load the last used commID //load the last used commID
m.loadCommID() m.loadCommID()
......
...@@ -41,19 +41,19 @@ func (m *Manager) register(username string, comm registerUserComms) error { ...@@ -41,19 +41,19 @@ func (m *Manager) register(username string, comm registerUserComms) error {
// Construct the user registration message // Construct the user registration message
msg := &pb.UDBUserRegistration{ msg := &pb.UDBUserRegistration{
PermissioningSignature: user.GetTransmissionRegistrationValidationSignature(), PermissioningSignature: user.GetReceptionRegistrationValidationSignature(),
RSAPublicPem: string(rsa.CreatePublicKeyPem(cryptoUser.GetTransmissionRSA().GetPublic())), RSAPublicPem: string(rsa.CreatePublicKeyPem(cryptoUser.GetReceptionRSA().GetPublic())),
IdentityRegistration: &pb.Identity{ IdentityRegistration: &pb.Identity{
Username: username, Username: username,
DhPubKey: m.storage.E2e().GetDHPublicKey().Bytes(), DhPubKey: m.storage.E2e().GetDHPublicKey().Bytes(),
Salt: cryptoUser.GetTransmissionSalt(), Salt: cryptoUser.GetReceptionSalt(),
}, },
UID: cryptoUser.GetTransmissionID().Marshal(), UID: cryptoUser.GetReceptionID().Marshal(),
} }
// Sign the identity data and add to user registration message // Sign the identity data and add to user registration message
identityDigest := msg.IdentityRegistration.Digest() identityDigest := msg.IdentityRegistration.Digest()
msg.IdentitySignature, err = rsa.Sign(rng, cryptoUser.GetTransmissionRSA(), msg.IdentitySignature, err = rsa.Sign(rng, cryptoUser.GetReceptionRSA(),
hash.CMixHash, identityDigest, nil) hash.CMixHash, identityDigest, nil)
if err != nil { if err != nil {
return errors.Errorf("Failed to sign user's IdentityRegistration: %+v", err) return errors.Errorf("Failed to sign user's IdentityRegistration: %+v", err)
...@@ -67,11 +67,11 @@ func (m *Manager) register(username string, comm registerUserComms) error { ...@@ -67,11 +67,11 @@ func (m *Manager) register(username string, comm registerUserComms) error {
// Hash and sign fact // Hash and sign fact
hashedFact := factID.Fingerprint(usernameFact) hashedFact := factID.Fingerprint(usernameFact)
signedFact, err := rsa.Sign(rng, cryptoUser.GetTransmissionRSA(), hash.CMixHash, hashedFact, nil) signedFact, err := rsa.Sign(rng, cryptoUser.GetReceptionRSA(), hash.CMixHash, hashedFact, nil)
// Add username fact register request to the user registration message // Add username fact register request to the user registration message
msg.Frs = &pb.FactRegisterRequest{ msg.Frs = &pb.FactRegisterRequest{
UID: cryptoUser.GetTransmissionID().Marshal(), UID: cryptoUser.GetReceptionID().Marshal(),
Fact: &pb.Fact{ Fact: &pb.Fact{
Fact: username, Fact: username,
FactType: 0, FactType: 0,
......
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