First try for a client-server communication protocol.
Requests
The client sends requests to the server (including a request ID) and receives an answer (with the same ID). Each request is a JSON object, in fact a python dictionary : {‘type’:’RequestType’, ‘data’:myParameters}
Request Types
List of possible client-server request types (first version) :
- ‘Auth’:user authentication
- ‘CreateUser’: create a new user
- ‘CreateScrutin’: creation a new poll,
- ‘GetScrutin’: get the data about a poll (date, questions…),
- ‘UpdateScrutin’: update the data of an existing poll,
- ‘GetVoteTemplate’: get poll data and the questions with possible answers to display a “vote” page,
- ‘CheckAndRegisterVote’: check if a vote is valid and register it,
- ‘GetResults’: get the results of a poll,
- ‘ListScrutins’: list all available polls for the current user (current, closed…),
- ‘UserGroupManagement’: Management of users and group rights
Parameters for each request type
– Auth :
data = {‘login’:login, ‘pass’:password}
WARNING : a salt must be used during a new user registration; login, salt, and the SHA/MD5 hash of the combination (password + salt) must be saved in the database.