In the process of creating a website where users are required to solve puzzles quickly, I am utilizing JavaScript to track the time taken for each puzzle. However, I am concerned about the possibility of users manipulating this data before it is sent to the server via AJAX. How can I ensure that the timing information received by the server has not been tampered with?
I believe that a session-based authenticity token, similar to those used in Rails forms, may not be sufficient for my needs. I need to verify the authenticity of the source of the data, rather than just the request itself.
Is there a way to securely sign the request using cryptography? I am wary of potential vulnerabilities in client-side JavaScript that could be exploited by hackers. Should I consider using compiled technologies like Flash or hiding a secret key? Are there other methods that I have not yet explored?
Update: To clarify, I want to avoid penalizing users with slow network connections and consider the inconsistent nature of network speeds. Therefore, the timing mechanism must be entirely client-side (initiated only when the user is able to view the puzzle). Additionally, since monetary transactions are involved, complete trust in the user's actions is not an option.