diff --git a/bindings/e2e.go b/bindings/e2e.go index f9c302bcfb77a7d30bc08f7900da9bb5c48ec3c8..22bc2b7249c48ffff3aff0ce88102175282fd024 100644 --- a/bindings/e2e.go +++ b/bindings/e2e.go @@ -145,19 +145,26 @@ func (e *E2e) GetUdCertFromNdf() []byte { // Returns // - []byte - A byte marshalled contact.Contact. func (e *E2e) GetUdContactFromNdf() ([]byte, error) { - udIdData := e.api.GetCmix().GetInstance().GetPartialNdf().Get().UDB.ID + // Retrieve data from E2e + netDef := e.api.GetCmix().GetInstance().GetPartialNdf().Get() + e2eGroup := e.api.GetE2E().GetGroup() + + // Unmarshal UD ID + udIdData := netDef.UDB.ID udId, err := id.Unmarshal(udIdData) if err != nil { return nil, err } - udDhPubKeyData := e.api.GetCmix().GetInstance().GetPartialNdf().Get().UDB.DhPubKey - udDhPubKey := e.api.GetE2E().GetGroup().NewInt(1) + // Unmarshal DH pub key + udDhPubKeyData := netDef.UDB.DhPubKey + udDhPubKey := e2eGroup.NewInt(1) err = udDhPubKey.UnmarshalJSON(udDhPubKeyData) if err != nil { return nil, err } + // Construct contact udContact := contact.Contact{ ID: udId, DhPubKey: udDhPubKey, diff --git a/bindings/identity.go b/bindings/identity.go index b55ee183462f0784785bb2a18b892e4b7fff8460..e3aa4abdc2362f80c7d12f103cea39e55bfc93e4 100644 --- a/bindings/identity.go +++ b/bindings/identity.go @@ -26,12 +26,14 @@ import ( // "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYjBJOS9UL1BFUUxtd2x3ejZHV3FjMUNYemVIVXhoVEc4bmg1WWRWSXMxCmJ2THpBVjNOMDJxdXN6K2s4TVFEWjBtejMzdkswUmhPczZIY0NUSFdzTEpXRkE5WWpzWWlCRi9qTDd1bmd1ckIKL2tvK1JJSnNrWGFWaEZaazRGdERoRXhTNWY4RnR0Qmk1NmNLZmdJQlVKT3ozZi9qQllTMkxzMlJ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mYTQzZWYwZTY5OTg4NjBmMTM5MGI1ZDNmZWFjYWYxNjk2MDE1Y2I3OWMzZjljMmQ5M2Q5NjExMjBjZDBlNWYxMmNiYjY4N2VhYjA0NTI0MWY5Njc4OWMzOGU4OWQ3OTYxMzhlNjMxOWJlNjJlMzVkODdiMTA0OGNhMjhiZTM4OWI1NzVlOTk0ZGNhNzU1NDcxNTg0YTA5ZWM3MjM3NDJkYzM1ODczODQ3YWVmNDlmNjZlNDM4NzMifQ==" +// } type ReceptionIdentity struct { ID []byte // User ID (base64) RSAPrivatePem []byte // RSA Private key (PEM format) Salt []byte // Salt for identity (base64) DHKeyPrivate []byte // DH Private key + E2eGrp []byte } // StoreReceptionIdentity stores the given identity in Cmix storage with the @@ -77,7 +79,8 @@ func (c *Cmix) MakeReceptionIdentity() ([]byte, error) { } // MakeLegacyReceptionIdentity generates the legacy identity for receiving -// messages. +// messages. As with all legacy calls, this should primarily be used +// for the xx messenger team. func (c *Cmix) MakeLegacyReceptionIdentity() ([]byte, error) { ident, err := xxdk.MakeLegacyReceptionIdentity(c.api) if err != nil { @@ -90,7 +93,8 @@ func (c *Cmix) MakeLegacyReceptionIdentity() ([]byte, error) { // GetReceptionRegistrationValidationSignature returns the signature provided by // the xx network. func (c *Cmix) GetReceptionRegistrationValidationSignature() []byte { - return c.api.GetStorage().GetReceptionRegistrationValidationSignature() + regSig := c.api.GetStorage().GetReceptionRegistrationValidationSignature() + return regSig } //////////////////////////////////////////////////////////////////////////////// diff --git a/bindings/identity_test.go b/bindings/identity_test.go index 949d51b2451f574d4fdfb2f634f9995588fa88fa..3dda17691bc63fc1e049ff14cccbbe7888d55146 100644 --- a/bindings/identity_test.go +++ b/bindings/identity_test.go @@ -29,13 +29,16 @@ func TestIdentity_JSON(t *testing.T) { dhpk := dh.GeneratePrivateKey(64, grp, rng) dhpkJson, _ := dhpk.MarshalJSON() op := make([]byte, 64) + e2eGrp, _ := getGroup().MarshalJSON() _, _ = rng.Read(op) identity := ReceptionIdentity{ ID: uid.Marshal(), RSAPrivatePem: rsa.CreatePrivateKeyPem(pk), Salt: salt, DHKeyPrivate: dhpkJson, + E2eGrp: e2eGrp, } + im, _ := json.Marshal(identity) t.Log("Marshalled ReceptionIdentity object") t.Log(string(im)) diff --git a/bindings/ud.go b/bindings/ud.go index 9f17d29bbd671503c600f3eaafff02eac28048cd..c9f75557f8c9f23ead3d6c171040f88ad1597827 100644 --- a/bindings/ud.go +++ b/bindings/ud.go @@ -105,31 +105,72 @@ type UdNetworkStatus interface { // Manager functions // //////////////////////////////////////////////////////////////////////////////// -// NewOrLoadUd loads an existing Manager from storage or creates a new one if -// there is no extant storage information. Parameters need be provided to -// specify how to connect to the User Discovery service. These parameters may be -// used to contact either the UD server hosted by the xx network team or a -// custom third-party operated server. For the former, all the information may -// be pulled from the NDF using the bindings. +// IsRegisteredWithUD is a function which checks the internal state +// files to determine if a user has registered with UD in the past. +// +// Parameters: +// - e2eID - REQUIRED. The tracked e2e object ID. This can be retrieved using [E2e.GetID]. +// +// Returns: +// - bool - A boolean representing true if the user has been registered with UD already +// or false if it has not been registered already. +// - error - An error should only be returned if the internal tracker failed to retrieve an +// E2e object given the e2eId. If an error was returned, the registration state check +// was not performed properly, and the boolean returned should be ignored. +func IsRegisteredWithUD(e2eId int) (bool, error) { + + // Get user from singleton + user, err := e2eTrackerSingleton.get(e2eId) + if err != nil { + return false, err + } + + return ud.IsRegistered(user.api.GetStorage().GetKV()), nil +} + +// NewOrLoadUd loads an existing UserDiscovery from storage or creates a new +// UserDiscovery if there is no storage data. Regardless of storage state, +// the UserDiscovery object returned will be registered with the +// User Discovery service. If the user is not already registered, a call +// to register will occur internally. If the user is already registered, +// this call will simply load state and return to you a UserDiscovery object. +// Some parameters are required for registering with the service, but are not required +// if the user is already registered. These will be noted in the parameters section as +// "SEMI-REQUIRED". +// +// Certain parameters are required every call to this function. These parameters are listed below +// as "REQUIRED". For example, parameters need be provided to specify how to connect to the +// User Discovery service. These parameters specifically may be used to contact either the UD +// server hosted by the xx network team or a custom third-party operated server. For the former, +// all the information may be fetched from the NDF using the bindings. These fetch +// methods are detailed in the parameters section. // // Params -// - e2eID - e2e object ID in the tracker -// - follower - network follower func wrapped in UdNetworkStatus -// - username - the username the user wants to register with UD. If the user is -// already registered, this field may be blank -// - registrationValidationSignature - a signature provided by the network -// (i.e., the client registrar). This may be nil; however, UD may return an -// error in some cases (e.g., in a production level environment). -// - cert - the TLS certificate for the UD server this call will connect with. -// You may use the UD server run by the xx network team by using -// E2e.GetUdCertFromNdf. -// - contactFile - the data within a marshalled contact.Contact. This -// represents the contact file of the server this call will connect with. You -// may use the UD server run by the xx network team by using -// E2e.GetUdContactFromNdf. -// - address - the IP address of the UD server this call will connect with. You -// may use the UD server run by the xx network team by using -// E2e.GetUdAddressFromNdf. +// - e2eID - REQUIRED. The tracked e2e object ID. This is returned by [E2e.GetID]. +// - follower - REQUIRED. Network follower function. This will check if the network +// follower is running. +// - username - SEMI-REQUIRED. The username the user wants to register with UD. +// If the user is already registered, this field may be blank. If the user is not +// already registered, these field must be populated with a username that meets the +// requirements of the UD service. For example, in the xx network's UD service, +// the username must not be registered by another user. +// - registrationValidationSignature - SEMI-REQUIRED. A signature provided by the xx network +// (i.e. the client registrar). If the user is not already registered, this field is required +// in order to register with the xx network. This may be nil if the user is already registered +// or connecting to a third-party UD service unassociated with the xx network. +// - cert - REQUIRED. The TLS certificate for the UD server this call will connect with. +// If this is nil, you may not contact the UD server hosted by the xx network. +// Third-party services may vary. +// You may use the UD server run by the xx network team by using [E2e.GetUdCertFromNdf]. +// - contactFile - REQUIRED. The data within a marshalled [contact.Contact]. This represents the +// contact file of the server this call will connect with. +// If this is nil, you may not contact the UD server hosted by the xx network. +// Third-party services may vary. +// You may use the UD server run by the xx network team by using [E2e.GetUdContactFromNdf]. +// - address - REQUIRED. The IP address of the UD server this call will connect with. +// You may use the UD server run by the xx network team by using [E2e.GetUdAddressFromNdf]. +// If this is nil, you may not contact the UD server hosted by the xx network. +// Third-party services may vary. // // Returns // - A Manager object which is registered to the specified UD service. diff --git a/connect/authenticated.go b/connect/authenticated.go index 6a311978d78333ec9709151e7528c7da7f55657f..c45489fbc78ab87ab1115ab6da02d2b0fe5167f4 100644 --- a/connect/authenticated.go +++ b/connect/authenticated.go @@ -67,7 +67,7 @@ func ConnectWithAuthentication(recipient contact.Contact, user *xxdk.E2e, // Build the authenticated connection and return identity := user.GetReceptionIdentity() - privKey, err := identity.GetRSAPrivatePem() + privKey, err := identity.GetRSAPrivateKey() if err != nil { return nil, err } diff --git a/registration/register.go b/registration/register.go index 57b6cf8f2003b0323d96d9b53aff9dc6e0f1ac2c..97c1f3d6d9ef121ca3d4efa8e71c6070d85614a0 100644 --- a/registration/register.go +++ b/registration/register.go @@ -62,14 +62,6 @@ func register(comms registrationMessageSender, host *connect.Host, "reception confirmation message") } - transmissionConfirmation := &pb.ClientRegistrationConfirmation{} - err = proto.Unmarshal(response.GetClientReceptionConfirmation(). - ClientRegistrationConfirmation, transmissionConfirmation) - if err != nil { - return nil, nil, 0, errors.WithMessage(err, "Failed to unmarshal "+ - "transmission confirmation message") - } - // Verify reception signature receptionSignature := response.GetClientReceptionConfirmation(). GetRegistrarSignature().Signature @@ -80,6 +72,15 @@ func register(comms registrationMessageSender, host *connect.Host, return nil, nil, 0, errors.WithMessage(err, "Failed to verify reception signature") } + // Unmarshal transmission confirmation + transmissionConfirmation := &pb.ClientRegistrationConfirmation{} + err = proto.Unmarshal(response.GetClientTransmissionConfirmation(). + ClientRegistrationConfirmation, transmissionConfirmation) + if err != nil { + return nil, nil, 0, errors.WithMessage(err, "Failed to unmarshal "+ + "transmission confirmation message") + } + // Verify transmission signature transmissionSignature := response.GetClientTransmissionConfirmation(). GetRegistrarSignature().Signature diff --git a/ud/addFact.go b/ud/addFact.go index 719e7d137ab1f9c3e5ce4d414c9db08876d668a4..2022b82e03482dbbe5d172ff6fc95a533c1d87d2 100644 --- a/ud/addFact.go +++ b/ud/addFact.go @@ -40,7 +40,7 @@ func (m *Manager) addFact(inFact fact.Fact, myId *id.ID, fHash := factID.Fingerprint(f) // Sign our inFact for putting into the request - privKey, err := m.user.GetReceptionIdentity().GetRSAPrivatePem() + privKey, err := m.user.GetReceptionIdentity().GetRSAPrivateKey() if err != nil { return "", err } diff --git a/ud/manager.go b/ud/manager.go index 75380113f86a7632db15d99b830e47c2e855181b..1f2301050e12503412dadcd9139c27e71cf70934 100644 --- a/ud/manager.go +++ b/ud/manager.go @@ -90,7 +90,7 @@ func NewOrLoad(user udE2e, comms Comms, follower udNetworkStatus, } // If already registered, return - if m.isRegistered() { + if IsRegistered(m.getKv()) { return m, nil } @@ -223,7 +223,7 @@ func (m *Manager) getCmix() udCmix { return m.user.GetCmix() } -// getKv returns a versioned.KV used for isRegistered and setRegistered. +// getKv returns a versioned.KV used for IsRegistered and setRegistered. // This is separated from store operations as store's kv // has a different prefix which breaks backwards compatibility. func (m *Manager) getKv() *versioned.KV { diff --git a/ud/register.go b/ud/register.go index 495d50da5e1fb51dd0e9d0e9d0211547d3314946..48074cf1ac491fb5496d1160d1ef7cda54138edb 100644 --- a/ud/register.go +++ b/ud/register.go @@ -19,7 +19,7 @@ func (m *Manager) register(username string, networkSignature []byte, // Retrieve data used for registration identity := m.user.GetReceptionIdentity() - privKey, err := identity.GetRSAPrivatePem() + privKey, err := identity.GetRSAPrivateKey() if err != nil { return err } diff --git a/ud/registered.go b/ud/registered.go index 06dba95886e3d92717ae9d8143fbd3ca8bd3189c..77742fc17923e1b0a30c03622db40e797e76ec36 100644 --- a/ud/registered.go +++ b/ud/registered.go @@ -11,10 +11,10 @@ import ( const isRegisteredKey = "isRegisteredKey" const isRegisteredVersion = 0 -// isRegistered loads from storage if the user is registered with user +// IsRegistered loads from storage if the user is registered with user // discovery. -func (m *Manager) isRegistered() bool { - _, err := m.getKv().Get(isRegisteredKey, isRegisteredVersion) +func IsRegistered(kv *versioned.KV) bool { + _, err := kv.Get(isRegisteredKey, isRegisteredVersion) if err != nil { return false } diff --git a/ud/remove.go b/ud/remove.go index ebb809c0022ab0bbc81237c092c106bcbf946bd2..691d9792f4468093ed2468b654b829ec60353c35 100644 --- a/ud/remove.go +++ b/ud/remove.go @@ -40,7 +40,7 @@ func (m *Manager) removeFact(f fact.Fact, // Sign our inFact for putting into the request identity := m.user.GetReceptionIdentity() - privKey, err := identity.GetRSAPrivatePem() + privKey, err := identity.GetRSAPrivateKey() if err != nil { return err } @@ -78,7 +78,7 @@ func (m *Manager) PermanentDeleteAccount(f fact.Fact) error { "a username. Cannot remove fact %q", f.Fact)) } identity := m.user.GetReceptionIdentity() - privKey, err := identity.GetRSAPrivatePem() + privKey, err := identity.GetRSAPrivateKey() if err != nil { return err } diff --git a/ud/ud.go b/ud/ud.go index 5fb27e619de9d5196b24022b35277f1f26c37837..fd4633483eb34b52a9106a00cbc3b8c342bec5fd 100644 --- a/ud/ud.go +++ b/ud/ud.go @@ -4,7 +4,6 @@ import ( "github.com/pkg/errors" "gitlab.com/elixxir/crypto/contact" "gitlab.com/xx_network/comms/connect" - "gitlab.com/xx_network/primitives/id" "time" ) @@ -23,35 +22,26 @@ func (m *Manager) setUserDiscovery(cert, params.AuthEnabled = false params.SendTimeout = 20 * time.Second - udIdBytes, dhPubKeyBytes, err := contact.ReadContactFromFile(contactFile) - if err != nil { - return err - } - - udID, err := id.Unmarshal(udIdBytes) + // Unmarshal the new contact + con, err := contact.Unmarshal(contactFile) if err != nil { return err } // Add a new host and return it if it does not already exist - host, err := m.comms.AddHost(udID, address, + host, err := m.comms.AddHost(con.ID, address, cert, params) if err != nil { return errors.WithMessage(err, "User Discovery host object could "+ "not be constructed.") } - dhPubKey := m.user.GetE2E().GetGroup().NewInt(1) - err = dhPubKey.UnmarshalJSON(dhPubKeyBytes) - if err != nil { - return err - } - + // Set the user discovery object within the manager m.ud = &userDiscovery{ host: host, contact: contact.Contact{ - ID: udID, - DhPubKey: dhPubKey, + ID: con.ID, + DhPubKey: con.DhPubKey, }, } diff --git a/xxdk/e2e.go b/xxdk/e2e.go index 4c2b9e22ca2e800e77489f69690092e13f6db6bc..cd0d7f00c2931b192d20ba6206e4b21067e6740f 100644 --- a/xxdk/e2e.go +++ b/xxdk/e2e.go @@ -102,7 +102,7 @@ func loginLegacy(net *Cmix, callbacks AuthCallbacks, return nil, err } - rsaKey, err := identity.GetRSAPrivatePem() + rsaKey, err := identity.GetRSAPrivateKey() if err != nil { return nil, err } @@ -116,7 +116,7 @@ func login(net *Cmix, callbacks AuthCallbacks, identity ReceptionIdentity, kv *versioned.KV, params E2EParams) (m *E2e, err error) { // Verify the passed-in ReceptionIdentity matches its properties - privatePem, err := identity.GetRSAPrivatePem() + privatePem, err := identity.GetRSAPrivateKey() if err != nil { return nil, err } @@ -246,7 +246,7 @@ func (m *E2e) ConstructProtoUserFile() ([]byte, error) { transIdentity := m.Cmix.GetTransmissionIdentity() receptionIdentity := m.GetReceptionIdentity() - privatePem, err := receptionIdentity.GetRSAPrivatePem() + privatePem, err := receptionIdentity.GetRSAPrivateKey() if err != nil { return nil, err } diff --git a/xxdk/identity.go b/xxdk/identity.go index 9d646785fd71c713398036fd4dc8ae66ecbbc447..1b2dd605dfa9f6bd63daeff49967dcdcd9fb459e 100644 --- a/xxdk/identity.go +++ b/xxdk/identity.go @@ -80,8 +80,8 @@ func (r ReceptionIdentity) GetDHKeyPrivate() (*cyclic.Int, error) { return dhKeyPriv, err } -// GetRSAPrivatePem returns the RSAPrivatePem. -func (r ReceptionIdentity) GetRSAPrivatePem() (*rsa.PrivateKey, error) { +// GetRSAPrivateKey returns the RSAPrivatePem. +func (r ReceptionIdentity) GetRSAPrivateKey() (*rsa.PrivateKey, error) { return rsa.LoadPrivateKeyFromPem(r.RSAPrivatePem) }