Answer the question
In order to leave comments, you need to log in
Simple JavaScript game. How to secure ajax requests from falsification?
Hello, let's say there is a simple 3-level game in JS. The game has an overall "Best Playing Time" rating. When an unauthorized user passes the 3rd level, a request is sent to the server with the passage time.
Accordingly, anyone can see what request is being sent and substitute their time, thereby falsifying the rating. How to secure such requests?
Only one thing came to mind: to make an aes-token on the client through how to install a js-lib with a transit time stamp and decrypt and receive a label on the server. And the key itself, by which the token is encrypted, is hidden somewhere in the depths of js so that no one can find it. Well, I think it's too...
Answer the question
In order to leave comments, you need to log in
If someone sets a goal, they will send a fake request, because all the code is available on the client.
Options:
1) Code obfuscation, where something like md5 (time + something) will be calculated and checked on the server. It just increases the complexity of the algorithm search.
2) Recording and sending to the game process server, checking the game process on the server (depends on the game).
Считайте время на сервере. Когда игра начинается отправляйте старт запрос, когда заканчивается стоп запрос. А там уже вычисляйте разность.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question