Metadata-Version: 2.5
Name: rookiegamers
Version: 1.5.0
Summary: Server-side RookieGamers helpers: verify player JWTs and report scores
Project-URL: Homepage, https://rookiegamers.com
Project-URL: Documentation, https://rookiegamers.com/docs
Project-URL: Repository, https://github.com/ecoay/rookiegamers
Project-URL: Issues, https://github.com/ecoay/rookiegamers/issues
Author: Tenacié LLC
License: SEE LICENSE IN README
Keywords: game,jwt,leaderboard,rookiegamers
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Games/Entertainment
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: pyjwt[crypto]>=2.8
Description-Content-Type: text/markdown

# rookiegamers (Python)

Server-side helpers for [RookieGamers](https://rookiegamers.com) games: verify the short-lived player JWT from the browser SDK, and report trusted scores with a game server key.

This is the companion to the browser SDK (`https://rookiegamers.com/sdk/v1.js` / npm `rookiegamers`). Version **1.5.0** matches that SDK line.

Docs: [rookiegamers.com/docs](https://rookiegamers.com/docs) · Source: [github.com/ecoay/rookiegamers](https://github.com/ecoay/rookiegamers)

## Install

```bash
pip install rookiegamers
```

## Usage

```python
from rookiegamers import RookieGamers, TokenError

rg = RookieGamers(
    "my-game",
    server_key="rgs_...",   # from /dev or create_server_key MCP/CLI
)

# Browser sent the SDK token (rg.user.token()) to your server:
try:
    claims = rg.verify_token(token_from_browser)
except TokenError:
    ...  # reject

player_id = claims["sub"]   # e.g. p0123...

# Trusted score (same body unsays posts):
rg.submit_score(player_id, 212)

# Optional — documented store entitlements check:
owned = rg.entitlements(player_id)
```

### What `verify_token` checks

Matches the unsays reference integration:

| Check | Value |
| --- | --- |
| Algorithm | `ES256` (EC P-256), with `kid` |
| Keys | `{base}/.well-known/jwks.json` |
| `iss` | portal base URL (default `https://rookiegamers.com`) |
| `aud` | your game slug |
| `exp` | not expired |
| `sub` | RookieGamers player id `^p[a-f0-9]{20}$` |

### Documented REST used here

- `POST /api/v1/scores` — `{ "game", "player", "score" }` with `Authorization: Bearer rgs_...`
- `GET /api/v1/store/<slug>/entitlements?player=<id>` — with the same server key

No other endpoints are wrapped. For publishing games, use the CLI/MCP (`rgk_...` developer key), not this library.

## License

Proprietary. Copyright © Tenacié LLC. All rights reserved.

The RookieGamers portal repository does not currently ship a LICENSE file. Use of this package is subject to the [RookieGamers Terms](https://rookiegamers.com/terms). Contact the publisher for other licensing.
