Player
Player identification
On the Jest platform, each user has a unique playerId per game. This identifier remains the same if a player starts as a guest and later registers, allowing you to track player progress and store player data.
Guest users can be prompted to register or sign in on the Jest platform. See Platform login for more information.
Registered users can be re-engaged via notifications. See Notifications for more information.
player.id
Returns the unique identifier for the current player.
var player = JestSDK.player
var player_id = player.id
player.is_registered
Returns whether the current player is registered or playing as a guest.
var player = JestSDK.player
if not player.is_registered:
# Guest player: notifications cannot be scheduled
# Consider prompting the player to register
pass
else:
# Registered player: full functionality available
var options = JestNotificationOptions.new()
options.body = "Come back and play!"
options.cta_text = "Play Now"
options.identifier = "comeback"
options.scheduled_in_days = 1
JestSDK.notifications.schedule(options)
player.get_signed()
If your game has a backend, use this method to obtain a signed payload that can be sent to your server to authenticate the player and attach to authenticated requests.
This works for both registered players and guests. For guests, result.registered is false.
var player = JestSDK.player
var result = await player.get_signed()
if result.ok:
var player_id = result.player_id
var is_registered = result.registered
var signed_payload = result.player_signed # JWS format for server verification
The returned player_signed value is a JSON Web Signature (JWS) signed using your game's shared secret with the HS-256 algorithm. You can use any standard JWS/JWT library on your backend to verify the signature and extract the player information.
The shared secret shown in the Developer Console is base64-encoded. Most JWT libraries expect the decoded key when verifying the signature.
The signed payload includes an issued-at (iat) timestamp that can be used to verify token freshness. Jest does not set an explicit expiration time; you may reject tokens older than a chosen threshold and have the client request a new token.
For server-side verification examples in various languages, see the HTML5 SDK Player documentation.
Player data
If your game does not have a backend, Jest provides a simple key-value store for per-player data.
Player data is stored alongside the player record on the Jest platform and is persistent across sessions and devices. All values must be serializable to JSON.
Player data is written directly from the game client and must not be used to store sensitive information or data that requires strong security guarantees.
Player data is limited to 1 MB per game; if this limit is exceeded, further writes will fail until the stored data size is reduced.
player.get_value(key)
Retrieves a string value associated with the given key.
var player = JestSDK.player
var nickname = player.get_value("nickname")
Typed getters
The SDK provides typed getter methods that convert the stored string value to the requested type:
var player = JestSDK.player
# Get as integer (returns 0 if not found)
var level = player.get_int("level")
# Get as float (returns 0.0 if not found)
var score = player.get_float("score")
# Get as bool (parses "true"/"false", returns false if not found)
var has_tutorial = player.get_bool("has_completed_tutorial")
# Get as parsed JSON (Dictionary or Array)
var inventory = player.get_json("inventory")
# Get all player data as a Dictionary
var all_data = player.get_all()
# Check if a key exists
if player.has_value("nickname"):
var name = player.get_value("nickname")
# Get with a default value
var theme = player.get_value_or_default("theme", "default")
player.set_value(key, value)
Sets a string value for the given key.
var player = JestSDK.player
player.set_value("nickname", "Ace")
Typed setters
The SDK provides typed setter methods for convenience:
var player = JestSDK.player
# Set an integer
player.set_int("level", 5)
# Set a float
player.set_float("high_score", 99.5)
# Set a boolean
player.set_bool("has_completed_tutorial", true)
# Set a Dictionary or Array as JSON
player.set_json("inventory", {"sword": 1, "shield": 2})
# Set multiple values at once
player.set_bulk({"level": "5", "nickname": "Ace", "theme": "dark"})
player.delete_value(key)
Deletes the value associated with the specified key.
var player = JestSDK.player
player.delete_value("temporary_boost")
player.flush()
Flushes any pending player data changes to the server. The SDK batches multiple updates to reduce network requests; calling this method ensures all pending changes are sent immediately.
var player = JestSDK.player
# Update some data
player.set_int("score", 1500)
# Flush pending changes before navigating away
# or when data must be persisted immediately
var result = await player.flush()
if result.ok:
print("All player data changes have been saved to the server.")