-
Notifications
You must be signed in to change notification settings - Fork 2
ts.User
The User contains information about the person that is using the application.
A user must be instantiated before it can be used e.g.
var user = new ts.User("/home/myuser/profiles", "myUserName", "my password");
user.setEmail("jondoe@example.com");
user.commit();
echo user.getEmail();
##Interface
-
constructor(String profilesDirectory, String username, String password = null)
loads or creates a new profile instance on the disk setEmail(String email)
setName(String name)
setPhone(String phone)
String getEmail()
String getName()
String getPhone()
Boolean commit()
NOTE: The email and name are required when publishing with the ts.Uploader. However, these constraints will be handled by that module.
##Mutli-User This module should be able to support multiple user profiles that can be loaded up by some key (possibly an email or name) with an optional password (for (de/en)cryption purposes). An instance of the user module can only represent a single user. However you can create multiple instances each with it's own profile loaded.
##Persistent The user information must be stored in a persistent manner so that it can be loaded again the next time the application loads.
The profile will be saved in a directory named with the md5 sum of the email address provided in the constructor
. For example
var hash = md5("jondoe@example.com");
var filepath= hash + "/profile.json"
// filepath is "0C0E8336309D657D4C4F0450CF8F5B73/profile.json"
##Versioned Each user profile directory will be a git repository. When changes are made to the profile they should be committed in order to maintain a versioned history and to allow publishing to the server.
##Publishable Each profile repository should be able to be pushed to some remote repository.
NOTE: The details on the publishing requirement will be described later
##Recorded Information The information stored in the user profile includes:
- Name
- Phone (optional)
Please note: Both a name and email must be provided before a profile can be successfully committed. On the disk these values will be stored in a simple json object for example:
{
"name":"Jon Doe",
"email":"jondoe@example.com",
"phone":"555-555-5555"
}
##Secure
Note: it is unclear whether or not this will be implemented. The profile will need to be decrypted before sharing or sending to the server. So there may not be a benefit to encrypting it on the device.
If a password is provided the user profile should be encrypted when saved and decrypted with opened. When creating a new user instance the module should throw an appropriate exception if the decryption fails.