@zaisma/game-server 1.28.0 → 1.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bench/brand/README.md +1 -1
- package/bench/brand/sign-in/city-day-phone.webp +0 -0
- package/bench/brand/sign-in/city-day.webp +0 -0
- package/bench/brand/sign-in/city-night-phone.webp +0 -0
- package/bench/brand/sign-in/city-night.webp +0 -0
- package/bench/glass.js +3789 -499
- package/bin/local-play.js +1 -1
- package/bin/node-parts.js +1 -1
- package/bin/node.d.ts +1 -1
- package/bin/node.js +2 -2
- package/package.json +1 -1
- package/sdk/zaisma.d.ts +1 -1
- package/src/pass.d.ts +2 -2
- package/src/pass.js +2 -2
- package/bench/brand/world/day-phone.webp +0 -0
- package/bench/brand/world/day.webp +0 -0
- package/bench/brand/world/night-phone.webp +0 -0
- package/bench/brand/world/night.webp +0 -0
package/bin/local-play.js
CHANGED
|
@@ -1244,7 +1244,7 @@ export async function startLocalPlay(givenOptions) {
|
|
|
1244
1244
|
response.writeHead(204, { ...cors, "Access-Control-Allow-Methods": "GET, POST", "Access-Control-Allow-Headers": "Content-Type" });
|
|
1245
1245
|
return response.end();
|
|
1246
1246
|
}
|
|
1247
|
-
if (path ===
|
|
1247
|
+
if (path === `/v1/pass-keys/${gameSlug}`) return reply(200, jwks([passSigning.publicKey]), { "Access-Control-Allow-Origin": "*" });
|
|
1248
1248
|
if (path === "/.well-known/receipt-jwks.json") return reply(200, jwks([receiptSigning.publicKey]), { "Access-Control-Allow-Origin": "*" });
|
|
1249
1249
|
const readBody = async () => {
|
|
1250
1250
|
const chunks = [];
|
package/bin/node-parts.js
CHANGED
|
@@ -40,7 +40,7 @@ function keysFrom(jwksUrl) {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
/** The pass keys a JWKS URL publishes (Zaisma's: <issuerUrl
|
|
43
|
+
/** The pass keys a JWKS URL publishes (Zaisma's, for one game: <issuerUrl>/v1/pass-keys/<gameSlug>), as startServer's loadPassKeys takes them. */
|
|
44
44
|
export function passKeysFrom(jwksUrl) {
|
|
45
45
|
return keysFrom(jwksUrl);
|
|
46
46
|
}
|
package/bin/node.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface StartServerOptions {
|
|
|
13
13
|
origins?: string[];
|
|
14
14
|
/** Who signs your players' passes. Default https://rooms.zaisma.com (PASS_ISSUER_URL). */
|
|
15
15
|
issuerUrl?: string;
|
|
16
|
-
/** The keys that check passes. Default: the ones `<issuerUrl
|
|
16
|
+
/** The keys that check passes. Default: this game's, the ones `<issuerUrl>/v1/pass-keys/<gameSlug>` publishes, kept an hour. Called with true to fetch them again. */
|
|
17
17
|
loadPassKeys?: (isRefreshing?: boolean) => Promise<PublicKey[]>;
|
|
18
18
|
/** The keys that check receipts (room.verifyReceipt). Default: the ones `<issuerUrl>/.well-known/receipt-jwks.json` publishes. */
|
|
19
19
|
loadReceiptKeys?: (isRefreshing?: boolean) => Promise<PublicKey[]>;
|
package/bin/node.js
CHANGED
|
@@ -64,7 +64,7 @@ const CATCH_UP_MS = 50;
|
|
|
64
64
|
* wrong kind a bad_option, before anything listens): gameServer (a game server object) and gameSlug
|
|
65
65
|
* (its Zaisma slug) are required. port (8080), origins (allowed page origins, by default
|
|
66
66
|
* https://<gameSlug>.zaismausercontent.com; none allows any page), issuerUrl (who signs the passes; Zaisma's),
|
|
67
|
-
* loadPassKeys (async (isRefreshing) => the pass keys; by default from <issuerUrl
|
|
67
|
+
* loadPassKeys (async (isRefreshing) => the pass keys; by default this game's, from <issuerUrl>/v1/pass-keys/<gameSlug>),
|
|
68
68
|
* loadReceiptKeys (the same for room.verifyReceipt and server.verifyReceipt; by default from
|
|
69
69
|
* <issuerUrl>/.well-known/receipt-jwks.json), loadProfile (async (playerId) => an account's public profile or null),
|
|
70
70
|
* database (room.database and server.database; by default a local file, zaisma-database.sqlite, made the
|
|
@@ -84,7 +84,7 @@ const CATCH_UP_MS = 50;
|
|
|
84
84
|
* has stopped; fastLaneReady settles once the fast lane listens (at once without one), or rejects saying why it can't.
|
|
85
85
|
*/
|
|
86
86
|
export function startServer(options) {
|
|
87
|
-
const { gameServer, gameSlug, port: portNumber, origins, issuerUrl, loadPassKeys = passKeysFrom(`${issuerUrl}
|
|
87
|
+
const { gameServer, gameSlug, port: portNumber, origins, issuerUrl, loadPassKeys = passKeysFrom(`${issuerUrl}/v1/pass-keys/${gameSlug}`), loadReceiptKeys = receiptKeysFrom(`${issuerUrl}/.well-known/receipt-jwks.json`), loadProfile = profilesFrom(issuerUrl), database = localDatabase("zaisma-database.sqlite"), secrets = secretsFromEnvironment(), webhookSigningSecret = process.env.ZAISMA_WEBHOOK_SIGNING_SECRET, roomStateFile = "zaisma-room-states.sqlite", zaismaKey = process.env.ZAISMA_KEY, developerApiUrl = "https://zaisma.com/api/dev", webtransportPort, certificatePath, certificateKeyPath, identifyPlayer, outsideGuestsEnabled } = checkedStartServerOptions(options, PASS_ISSUER_URL);
|
|
88
88
|
const definition = defineGameServer(gameServer);
|
|
89
89
|
// Exactly once needs Zaisma's record of what's handled: without a key, purchases would come twice, so it doesn't start.
|
|
90
90
|
if ((definition.onPurchase || definition.onRefund) && !zaismaKey) {
|
package/package.json
CHANGED
package/sdk/zaisma.d.ts
CHANGED
|
@@ -1563,7 +1563,7 @@ declare namespace Zaisma {
|
|
|
1563
1563
|
interface PlayerWithPass extends Player {
|
|
1564
1564
|
/**
|
|
1565
1565
|
* The player pass: a standard EdDSA JWT (header typ "pass+jwt") any server can check against the
|
|
1566
|
-
* keys at https://rooms.zaisma.com
|
|
1566
|
+
* game's own keys at https://rooms.zaisma.com/v1/pass-keys/<gameSlug>. It proves only who the player is: its sub
|
|
1567
1567
|
* is the player's ID, kind says guest or account, aud is the game, pass_version_number is 1. A
|
|
1568
1568
|
* guest's pass also carries their name; an account's name comes from its profile
|
|
1569
1569
|
* (https://rooms.zaisma.com/v1/players/<id>). An account's pass says who it can chat with:
|
package/src/pass.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Player passes: standard JWTs signed with Ed25519 (EdDSA). Our rooms check them,
|
|
3
|
-
* and so can any developer's own server, using
|
|
4
|
-
*
|
|
3
|
+
* and so can any developer's own server, using its game's keys, published at
|
|
4
|
+
* /v1/pass-keys/<gameSlug>. Any JWT library that supports EdDSA works.
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
7
|
* What a pass proves: who the player is, for which game, until when. Nothing more; anything else
|
package/src/pass.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Player passes: standard JWTs signed with Ed25519 (EdDSA). Our rooms check them,
|
|
3
|
-
* and so can any developer's own server, using
|
|
4
|
-
*
|
|
3
|
+
* and so can any developer's own server, using its game's keys, published at
|
|
4
|
+
* /v1/pass-keys/<gameSlug>. Any JWT library that supports EdDSA works.
|
|
5
5
|
*/
|
|
6
6
|
/** A pass's JWS header typ (RFC 8725 explicit typing): verifyPass refuses any other token (wrong_kind). */
|
|
7
7
|
export const PASS_TOKEN_TYPE = "pass+jwt";
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|