ilyo
ilyo

Reputation: 36391

Security to prevent hacks in a game with node server

I am making a browser card game. Each player has a number of purchased cards out of a big pool of available cards.

I need to make sure a player can not hack the cards he uses from the browser, so the server must authenticate he owns each card he uses and it is indeed the same card.

In order to make the app faster I want to store the cards data in an external JSON file and only say "player x owns cards y and z" and get the info on those cards from the JSON.

Are there any security patterns that can help me here?

Upvotes: 1

Views: 546

Answers (1)

silicakes
silicakes

Reputation: 6902

You can use openPGP for node in order to create two sets of keys: One public - for your client and one Private for the server.

Using the public key for each client - you'll be able to encrypt the JSON representing the state of each player and prevent its circumvention by manners of hackery.

Make sure you read the dependancy section in order to properly polyfill your game for older browser versions.

Upvotes: 1

Related Questions