Monday 31 August 2020

How to create a unique key-value server side, save it server-side & send it to the client?

Hello,I am trying to learn node.js and I would like to know how for each client that hits my web app to generate:A random_number + hash_of_random_number on the server.Send client hash_of_random_number.If the client refreshes the page, they would receive a new random_number + hash_of_random_number.Only when the client hits a button, the random_number + hash_of_random_number is stored securely server-side to be retrieved later.Essentially, i would like to create a random number (I know how to do the random number) which is hashed server side then serve only the hash_of_random_number to the client, the client then does something client side (e.g. clicks a button), which only then stores the random_number + hash_of_random_number server-side. If the client closes the app before clicking the button, the server-side generated random_number + hash_of_random_number are not saved server side and the client would be served a new generated random_number + hash_of_random_number if they refresh the app. Each client and page refresh is treated independently and they each receive their own random_number + hash_of_random_number.What is the best way (secure, stable, reliable) to do this in node.js? I'm not even sure how to word what I am trying to achieve. Can anyone point me to any tutorials which can guide me in the right direction? I'm thinking i would like to eventually save the random_number + hash_of_random_number to a database, but for this example, id be happy to just store it in memory to get me started...Can anybody help me with this? I hope this makes sense? Any help is greatly appreciated in advance. Thank you.

Submitted August 31, 2020 at 08:39AM by asus_wtf

No comments:

Post a Comment