I am not asking how to hide Javascript code. There are plenty questions on that topic.
I'm building a website that gathers information about the user, e.g. the time between certain key presses. The webserver uses this to do research on key presses.
However, I think the system is quite prone to simple modification of the values. So a user can manually send values for key presses to the server.
I thought of doing encryption, but my first intuition was that the user is in charge of the browser so they have access to the keys.
Is there any way I can create a secret connection between the webserver and the webbrowser, that blocks the user from reading and/or modifying the data that is sent/received without the server being able to figure out?