User Management - Hive2Hive/Hive2Hive GitHub Wiki

The user management encapsulates the following operations:


Register

Every user that wants to be connected to the network, needs to be announced first. This is done with a one-time registration. This registration requires the User Credentials as parameters. These credentials are used for the following:

The registration process includes the following steps:

  1. Check if a user with the provided user ID already exists.
  2. If not, a new User Profile is created.
  3. The created user profile is put to the DHT. (see User Profile Location)
  4. A new User Locations list is created.
  5. The created user locations list is put to the DHT.
  6. A new User Encryption Key Pair is created.
  7. The created User Encryption Public Key is put to the DHT.
  8. A new User Authentication Key Pair is created.

Unregister

A registered user might want to leave the network and not come back. In this case, the user can be unregistered.

This operation has not yet been implemented, but would comprise the following steps:

  1. Unshare all shared folders.
  2. Remove the User Encryption Public Key from the DHT.
  3. Remove the User Locations list from the DHT.
  4. Remove the User Profile from the DHT.

However, in case a user does not unregister from the network but remains absent for long time, the Time-To-Live (TTL) mechanism will remove all of the user's files, that are not shared, from the network.

Login

Users that are registered to the network can login to the network from one of their User Clients and present themselves as online. This login requires the User Credentials as parameters.

Upon successful login, the connected user client is triggered to synchronize its local state with the network. Also, since this client now is online, it is able to receive Notifications.

The login process includes the following steps:

  1. The User Profile is fetched from the DHT.
  2. A new Client Session is created.
  3. The User Locations list is fetched from the DHT.
  4. The connecting clients' location information is added to the list.
  5. Possible unfriendly leaves of other user clients are detected.
  6. It's evaluated whether the connecting user client is the Master Client.
  7. The user locations list is put back to the DHT.
  8. File Synchronization takes place.
  9. If the connecting user client is the master client, all User Profile Tasks are processed.

Logout

A user that is logged in with one of her User Clients might want to disconnect the connected client. In this case, the user client can be logged out. As soon as all user clients of a user are logged out, the user is presented as offline.

A proper logout is referred to as friendly leave from the network. (As opposed to unfreindly leave.)

In order to detect file changes during the offline phase of a user client, the last synchronized state is persisted on the client’s local disk. This information is considered during the next login.

The logout process includes the following steps:

  1. The User Locations list is fetched from the DHT.
  2. The disconnecting clients' location information is removed from the list.
  3. The user locations list is put back to the DHT.
  4. The User Clients state is persited on the local disk.