@crowdedkingdoms/crowdyjs 18.15.0 → 18.16.0-dev.1

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/README.md CHANGED
@@ -12,19 +12,23 @@ gameplay, minted per app through `client.portal`.
12
12
 
13
13
  Start here:
14
14
 
15
- - [SDK guide](https://docs.crowdedkingdoms.com/crowdyjs/readme) — the canonical
15
+ - [SDK guide](https://docs.dev.crowdedkingdoms.com/crowdyjs/readme) — the canonical
16
16
  walkthrough of everything in this README.
17
- - [Build a game](https://docs.crowdedkingdoms.com/build-a-game/intro) — a
17
+ - [Build a game](https://docs.dev.crowdedkingdoms.com/build-a-game/intro) — a
18
18
  hands-on tutorial from sign-in to a playable voxel game.
19
- - [Platform overview](https://docs.crowdedkingdoms.com/overview/client-workflow)
19
+ - [Platform overview](https://docs.dev.crowdedkingdoms.com/overview/client-workflow)
20
20
  — how a client session flows through the platform.
21
21
 
22
22
  ## Install
23
23
 
24
24
  ```bash
25
- npm install @crowdedkingdoms/crowdyjs
25
+ npm install @crowdedkingdoms/crowdyjs@dev
26
26
  ```
27
27
 
28
+ This README is the `dev` branch's: it documents the release on the `dev` dist-tag
29
+ (`npm view @crowdedkingdoms/crowdyjs dist-tags`), and its links go to the dev docs site. A
30
+ plain `npm install` resolves `latest`, the production release, which has no `client.exec`.
31
+
28
32
  **Server compatibility.** A release selects fields the Game API it was built against has,
29
33
  so it needs that Game API or newer; promote the Game API before the SDK on each tier.
30
34
 
@@ -103,6 +107,7 @@ game stack never receives the player's full session.
103
107
  | in a browser, on your own domain (every customer game) | `portal.signIn` -> Studio -> `portal.handleSignInCallback` | the client already holds the app token |
104
108
  | in a browser, on the first-party host (Studio) | `auth.login` / magic link / social | `portal.mintAppToken(appId)` |
105
109
  | outside a browser (Node, CLI, CrowdyCPP, tests) | `auth.login` / `auth.register` | `portal.mintAppToken(appId)` |
110
+ | anywhere, for players of an organization that runs its own accounts (dev only) | the organization signs its player in: its server mints with an org token, or its sign-in service signs an assertion | `portal.adoptAppToken(response)` / `portal.exchangeManagedPlayerAssertion(...)` — see [Org-managed players](#org-managed-players-dev-only) |
106
111
 
107
112
  The first row is the only one a game on its own domain can take: the direct
108
113
  sign-in mutations are refused from a non-first-party browser origin with
@@ -195,8 +200,73 @@ Notes:
195
200
  - Use `client.auth.setToken(token)` to seed a token externally (e.g. when
196
201
  restoring auth from a non-default storage).
197
202
 
198
- Deeper reading: [Portals & app-scoped tokens](https://docs.crowdedkingdoms.com/management-api/portals-and-app-tokens)
199
- and [Sign in](https://docs.crowdedkingdoms.com/management-api/authentication).
203
+ Deeper reading: [Portals & app-scoped tokens](https://docs.dev.crowdedkingdoms.com/management-api/portals-and-app-tokens)
204
+ and [Sign in](https://docs.dev.crowdedkingdoms.com/management-api/authentication).
205
+
206
+ ### Org-managed players (dev only)
207
+
208
+ An organization that runs its own accounts can sign its players in to its own apps itself
209
+ (18.16.0, cks-game-api #557). The player never types a Crowded Kingdoms password, and Crowded
210
+ Kingdoms holds no email or password for it: the organization vouches for the player and the
211
+ device gets the player's own app token, which plays exactly like any other. An org-managed
212
+ player has no session and no wallet, plays only its organization's apps, and its mods are paid
213
+ for by the organization where it switched them on (`managedPlayers.setAppMods`). An operator
214
+ turns the feature on for an organization; outside the dev tier every call answers
215
+ `FEATURE_DISABLED`.
216
+
217
+ **From the organization's server, with an org token.** Create the token in Studio (or
218
+ `organizations.createToken({ orgId, scopes: ['players:mint'], appIds: [appId] })`) and keep it
219
+ on the server: it signs in any of the organization's players, and the API refuses one sent
220
+ with an `Origin` header. The SDK deliberately has no wrapper for the mint; it is one request:
221
+
222
+ ```ts
223
+ // your server, after your own sign-in succeeded
224
+ const res = await fetch('https://ck.dev.crowdedkingdoms.com/graphql', {
225
+ method: 'POST',
226
+ headers: { 'content-type': 'application/json', authorization: `Bearer ${process.env.CK_ORG_TOKEN}` },
227
+ body: JSON.stringify({
228
+ query: `mutation($i: MintManagedPlayerTokenInput!) { mintManagedPlayerToken(input: $i) {
229
+ token gameTokenId appId expiresAt gameApiUrl gameApiWsUrl discoveryUrl launchUrl } }`,
230
+ variables: { i: { appId, externalId: account.id, gamertag: account.displayName } },
231
+ }),
232
+ });
233
+ const { data } = await res.json();
234
+ // send data.mintManagedPlayerToken to the player's device
235
+ ```
236
+
237
+ ```ts
238
+ // the player's device
239
+ const access = await fetch('/api/crowded-kingdoms/token').then((r) => r.json());
240
+ const game = createCrowdyClient({ httpUrl: access.gameApiUrl, wsUrl: access.gameApiWsUrl });
241
+ game.portal.adoptAppToken(access); // refuses an org token by mistake
242
+ game.world(appId).subscribe({ actorUpdate: (n) => { /* ... */ } });
243
+ ```
244
+
245
+ `externalId` is your own stable account id (not an email); the first sign-in creates the player
246
+ and the same id is always the same player. The token refreshes (`refreshGameplayToken`) until
247
+ the sign-in's lifetime ends (`sessionTtlSeconds`, at most the organization's setting); then the
248
+ device asks your server again.
249
+
250
+ **With a signed assertion.** Register a public key once
251
+ (`managedPlayers.registerSigningKey({ orgId, kid, algorithm: 'EdDSA', publicJwk, issuer })`);
252
+ your sign-in service signs a short JWS per player (`iss`, `aud: 'ck:app:<appId>'`, `sub` your
253
+ account id, `iat`, `exp` at most 300 s later, a fresh `jti`, optionally `gamertag`) and the
254
+ device trades it, without your server calling Crowded Kingdoms:
255
+
256
+ ```ts
257
+ const access = await game.portal.exchangeManagedPlayerAssertion({ appId, assertion });
258
+ ```
259
+
260
+ Each assertion works once; a refusal reads with `assertionRejectedOf(err)?.reason`
261
+ (`expired`, `replayed`, `signature`, …).
262
+
263
+ **Administration** takes an org admin's session with `manage_players`:
264
+ `client.managedPlayers.list` / `get` / `provision` (up to 500 a call: pre-provision before a
265
+ launch) / `update` (rename, disable, enable) / `endSessions` / `delete`, `settings` (the
266
+ operator-set limits), `signingKeys` / `registerSigningKey` / `revokeSigningKey`, and
267
+ `appModsEnabled` / `setAppMods` (`manage_billing`). From your server, an org token with
268
+ `players:manage` also works for the six player operations. `organizations.revokeToken(id, { endSessions: true })`
269
+ also ends the sessions a token signed in.
200
270
 
201
271
  ### Token refresh during gameplay
202
272
 
@@ -244,7 +314,7 @@ never told about, so a native refresh without it is a re-placement.
244
314
  | `client.auth` | Sign-in: `login` / `register` (email + password), magic link, social/OIDC. Passwords: `requestPasswordReset` / `resetPassword`, `changePassword`, and `setInitialPassword` for an account created by magic link or a social provider (added in 15.1.0). Log out, and linked identities (`myIdentities`, `linkIdentity`/`unlinkIdentity`). **No dev bypass** — `devLogin` was removed in 15.0.0 and `DEV_AUTH_BYPASS` is gone from every tier. |
245
315
  | `client.users` | `me`, `updateGamertag`, profile reads; `playerProfile` / `playerProfiles` (up to 100) for other players' public `{ userId, gamertag, disambiguation }`. |
246
316
  | `client.session` | Token store, `restore()`, `getToken()`, manual `setToken()`. |
247
- | `client.portal` | App-scoped token minting (`mintAppToken`) and the cross-origin PKCE entry flow (`beginEntry` / `handleAuthorizeRequest` / `completeEntry` / `refresh`). |
317
+ | `client.portal` | App-scoped token minting (`mintAppToken`) and the cross-origin PKCE entry flow (`beginEntry` / `handleAuthorizeRequest` / `completeEntry` / `refresh`). For an org-managed player (dev only), `adoptAppToken` stores the token its organization minted and `exchangeManagedPlayerAssertion` trades the organization's signed assertion. |
248
318
  | `client.hosting` | Third-party hosting on Crowdy Games (17.2.0): `claim` a slug for an app, `beginPublish` / `completePublish` / `abandonPublish` a built bundle, `setEnabled`; public `game(slug)` / `listed()`. Mutations need an identity session with `manage_apps`. `@crowdedkingdoms/crowdyjs/hosting` exports `publishDirectory(client, { dir, slug })`, the Node helper that does the whole publish for a `dist/`. |
249
319
  | `client.platform` | Public platform configuration (`config()`). |
250
320
  | `client.serverStatus` | `gameClientBootstrap(appId)` — per-app version info, UDP status, spatial limits. |
@@ -270,7 +340,8 @@ grouped under `client.admin` and mirrored at the top level):
270
340
 
271
341
  | Sub-client | What it does |
272
342
  |---|---|
273
- | `client.organizations` | Orgs, members, RBAC roles, org API tokens. |
343
+ | `client.organizations` | Orgs, members, RBAC roles, org API tokens (with `scopes` and `appIds` for org-managed players). |
344
+ | `client.managedPlayers` | Org-managed players (dev only): list, provision, rename, disable, end sessions, delete; assertion signing keys; whether the org pays for their mods in an app. See [Org-managed players](#org-managed-players-dev-only). |
274
345
  | `client.apps` | App registry, discovery + routing (`create`, `routeFor`, `marketplace`), visibility, and player-code admission mode / allow-list administration. |
275
346
  | `client.appAccess` | Access tiers + per-user grants, and the feature keys a tier grants (`defineFeature`, `grantTierFeature`, `tierFeatures`, …), which a hub checks with the node API's `players.features`; timed bans (`suspend`, `unsuspend`) and `resyncTierGridPermissions`. |
276
347
  | `client.billing` | Org wallet + per-app spend budgets. |
@@ -320,7 +391,7 @@ query AppForRouting($appId: BigInt!) {
320
391
  `CrowdyClient` with `httpUrl: gameApiUrl` (and the matching `wsUrl`) holding
321
392
  that app's app-scoped token, then drive gameplay through that client. Apps
322
393
  with no `gameApiUrl` keep working against the default `httpUrl` you
323
- configured. See [Loading an app's Game API](https://docs.crowdedkingdoms.com/crowdyjs/shared-environment-routing).
394
+ configured. See [Loading an app's Game API](https://docs.dev.crowdedkingdoms.com/crowdyjs/shared-environment-routing).
324
395
 
325
396
  ## Realtime notifications
326
397
 
@@ -746,7 +817,7 @@ reach your bundle. Reads are synchronous snapshots and writes happen on
746
817
  WebSocket events (not `requestAnimationFrame`), so render loops read freely
747
818
  and a backgrounded tab keeps ingesting updates; pass `workerTicker()` to also
748
819
  keep timer-driven sends at full rate while hidden. See the
749
- [World Stores guide](https://docs.crowdedkingdoms.com/crowdyjs/stores).
820
+ [World Stores guide](https://docs.dev.crowdedkingdoms.com/crowdyjs/stores).
750
821
 
751
822
  ## Game Kit
752
823
 
@@ -824,7 +895,7 @@ The protocol is held to ck-exec's golden record of the starters
824
895
  (`test/unit/fixtures/kit-protocol.json`): every module call and topic in it is replayed in
825
896
  `test/unit/game-kit.test.mjs`. The blueprints, `kit.deploy`, the engines and the model-backed
826
897
  helpers went with the game model in 18.0.0; the hub modules replace them. See the
827
- [Game Kit docs](https://docs.crowdedkingdoms.com/game-kit/intro) and
898
+ [Game Kit docs](https://docs.dev.crowdedkingdoms.com/game-kit/intro) and
828
899
  [MIGRATION.md](MIGRATION.md).
829
900
 
830
901
  ## ck-exec
@@ -888,7 +959,7 @@ Integers above 2^53 decode as `number` and lose precision unless you pass
888
959
  `{ decode: { useBigInt64: true } }`. A call's whole numbers outside 32 bits (a timestamp in
889
960
  milliseconds, a player id) go out as 64-bit integers (18.11.0; before, as floats, which a
890
961
  hub's integer fields refuse). The wire format is in the
891
- [ck-exec docs](https://docs.crowdedkingdoms.com/exec/intro).
962
+ [ck-exec docs](https://docs.dev.crowdedkingdoms.com/exec/intro).
892
963
 
893
964
  ### A mod's CLIENT half
894
965
 
@@ -959,7 +1030,7 @@ counts what was dropped); `invoke` sends at most 256 KiB each way and is refused
959
1030
  module is not running. `NOT_FOUND` holds a CLIENT half back 15 s and `RATE_LIMITED` 60 s. The
960
1031
  grid's owner is asked about their own CLIENT halves like anyone; answer yes in `confirm` when
961
1032
  `prompt.authorId` is the player. See
962
- [CLIENT halves](https://docs.crowdedkingdoms.com/exec/client-halves).
1033
+ [CLIENT halves](https://docs.dev.crowdedkingdoms.com/exec/client-halves).
963
1034
 
964
1035
  ## Hosting a game on Crowdy Games
965
1036
 
@@ -1078,8 +1149,8 @@ CLIENT project needs ck-api `v2.25.1` or later. A CLIENT crate still on the lega
1078
1149
  `mountCrowdyStudio` and the controller take `mods: client.exec`. Crowdy Studio runs nothing
1079
1150
  on legacy player compute since 18.0.0.
1080
1151
 
1081
- See [CLIENT halves](https://docs.crowdedkingdoms.com/exec/client-halves), [mods](https://docs.crowdedkingdoms.com/exec/mods)
1082
- and [Embed Crowdy Studio in your game](https://docs.crowdedkingdoms.com/crowdyjs/crowdy-studio-embed).
1152
+ See [CLIENT halves](https://docs.dev.crowdedkingdoms.com/exec/client-halves), [mods](https://docs.dev.crowdedkingdoms.com/exec/mods)
1153
+ and [Embed Crowdy Studio in your game](https://docs.dev.crowdedkingdoms.com/crowdyjs/crowdy-studio-embed).
1083
1154
 
1084
1155
  ### The Studio agent (DeepSeek Harness in the browser)
1085
1156
 
@@ -1170,7 +1241,9 @@ Readers for the refusals a player should be told about, each `null` for any othe
1170
1241
  `ACCESS_NOT_GRANTED`), `appPausedOf(err)` (`APP_PAUSED`, with `reason`) and `actorExistsOf(err)`
1171
1242
  (`ACTOR_EXISTS`; `ownedByCaller: true` means a retried create of your own actor). A paused app
1172
1243
  still mints tokens: check `isAppPaused(token.runtimeGate)` (or the bootstrap's `runtimeGate`)
1173
- before entering the world.
1244
+ before entering the world. For org-managed players: `assertionRejectedOf(err)`
1245
+ (`ASSERTION_REJECTED`, with the failed check as `reason`) and `managedPlayerNotAllowedOf(err)`
1246
+ (`MANAGED_PLAYER_NOT_ALLOWED`: no wallet, or mods the organization has not switched on).
1174
1247
 
1175
1248
  ## Idempotent retries
1176
1249
 
@@ -1268,7 +1341,7 @@ no other repositories and no network access required:
1268
1341
  `src/generated/graphql-schema.ts`, the generated schema types.
1269
1342
 
1270
1343
  Schema refresh is explicit, from the published
1271
- [SDL](https://docs.crowdedkingdoms.com/schema/game-api.graphql):
1344
+ [SDL](https://docs.dev.crowdedkingdoms.com/schema/game-api.graphql):
1272
1345
 
1273
1346
  ```bash
1274
1347
  npm run schema:sync:prod
@@ -37,6 +37,7 @@ import { HostingAPI } from './domains/hosting.js';
37
37
  import { PortalAPI, type AppTokenResponse, type PkceStore } from './domains/portal.js';
38
38
  import { PlatformAPI } from './domains/platform.js';
39
39
  import { OrganizationsAPI } from './domains/organizations.js';
40
+ import { ManagedPlayersAPI } from './domains/managedPlayers.js';
40
41
  import { AppAccessAPI } from './domains/appAccess.js';
41
42
  import { BillingAPI } from './domains/billing.js';
42
43
  import { PaymentsAPI } from './domains/payments.js';
@@ -242,6 +243,8 @@ export declare class CrowdyClient {
242
243
  readonly platform: PlatformAPI;
243
244
  /** Organizations, members, RBAC roles, and org API tokens (studio admin). */
244
245
  readonly organizations: OrganizationsAPI;
246
+ /** An organization's own players, signed in by the organization (studio admin, dev only). */
247
+ readonly managedPlayers: ManagedPlayersAPI;
245
248
  /** App access tiers + per-user access grants (studio admin). */
246
249
  readonly appAccess: AppAccessAPI;
247
250
  /** Org wallet + per-app spend budgets (studio admin). */
@@ -1 +1 @@
1
- {"version":3,"file":"crowdy-client.d.ts","sourceRoot":"","sources":["../src/crowdy-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B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BAAkB,EAAE,2BAA2B,CAAC;IAEzD,iEAAiE;IACjE,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;IACrC,+EAA+E;IAC/E,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;IACvC,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;gBAEnB,MAAM,GAAE,kBAAuB;IA0M3C,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIpC,0DAA0D;IAC1D,QAAQ,IAAI,MAAM,GAAG,IAAI;IAIzB;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACG,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,CAAC;YAczC,2BAA2B;IAezC;;;;OAIG;IACG,2BAA2B,IAAI,OAAO,CAAC,IAAI,CAAC;IASlD;;;;;;;OAOG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAIjC;;;;;;;OAOG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS;IAI7D;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,aAAa;IAgB3D,gEAAgE;IAChE,KAAK,IAAI,IAAI;IAQb,yDAAyD;IACzD,IAAI,eAAe,IAAI,MAAM,CAE5B;CACF;AAED,wBAAgB,kBAAkB,CAChC,MAAM,GAAE,kBAAuB,GAC9B,YAAY,CAEd"}
@@ -38,6 +38,7 @@ import { HostingAPI } from './domains/hosting.js';
38
38
  import { PortalAPI, } from './domains/portal.js';
39
39
  import { PlatformAPI } from './domains/platform.js';
40
40
  import { OrganizationsAPI } from './domains/organizations.js';
41
+ import { ManagedPlayersAPI } from './domains/managedPlayers.js';
41
42
  import { AppAccessAPI } from './domains/appAccess.js';
42
43
  import { BillingAPI } from './domains/billing.js';
43
44
  import { PaymentsAPI } from './domains/payments.js';
@@ -196,6 +197,7 @@ export class CrowdyClient {
196
197
  this.discovery = new DiscoveryDomain(this.graphql);
197
198
  this.platform = new PlatformAPI(this.graphql);
198
199
  this.organizations = new OrganizationsAPI(this.graphql);
200
+ this.managedPlayers = new ManagedPlayersAPI(this.graphql);
199
201
  this.appAccess = new AppAccessAPI(this.graphql);
200
202
  this.billing = new BillingAPI(this.graphql);
201
203
  this.payments = new PaymentsAPI(this.graphql);
@@ -223,6 +225,7 @@ export class CrowdyClient {
223
225
  this.gameApps = new GameAppsAPI(this.graphql);
224
226
  this.admin = new AdminAPI({
225
227
  organizations: this.organizations,
228
+ managedPlayers: this.managedPlayers,
226
229
  apps: this.apps,
227
230
  appAccess: this.appAccess,
228
231
  billing: this.billing,
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * GENERATED — do not edit. The operator tooling's
3
- * `sync-client-origins.mjs --write --tier prod` writes this file, and
3
+ * `sync-client-origins.mjs --write --tier dev` writes this file, and
4
4
  * `check-sdk-default-origin.mjs` refuses it when it names the wrong tier or a
5
5
  * host that declaration does not carry. Regenerate; never hand-edit.
6
6
  *
@@ -10,14 +10,14 @@
10
10
  * than no default at all. Every fallback this SDK ever removed named a host that
11
11
  * was already dead. A generated file plus a gate is what makes this one different.
12
12
  *
13
- * Source: the operator's per-tier public CK API origin declaration, tier 'prod'
13
+ * Source: the operator's per-tier public CK API origin declaration, tier 'dev'
14
14
  */
15
15
  /** The tier this build of the SDK is published for. */
16
- export declare const CROWDY_DEFAULT_TIER = "prod";
16
+ export declare const CROWDY_DEFAULT_TIER = "dev";
17
17
  /** The public CK API origin for that tier. */
18
- export declare const CROWDY_DEFAULT_HTTP_ORIGIN = "https://ck.prod.crowdedkingdoms.com";
18
+ export declare const CROWDY_DEFAULT_HTTP_ORIGIN = "https://ck.dev.crowdedkingdoms.com";
19
19
  /** The same host over WebSocket. A scheme is composed; a hostname is looked up. */
20
- export declare const CROWDY_DEFAULT_WS_ORIGIN = "wss://ck.prod.crowdedkingdoms.com";
20
+ export declare const CROWDY_DEFAULT_WS_ORIGIN = "wss://ck.dev.crowdedkingdoms.com";
21
21
  /** The bare hostname, for callers that need to compare rather than dial. */
22
- export declare const CROWDY_DEFAULT_HOST = "ck.prod.crowdedkingdoms.com";
22
+ export declare const CROWDY_DEFAULT_HOST = "ck.dev.crowdedkingdoms.com";
23
23
  //# sourceMappingURL=default-origin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"default-origin.d.ts","sourceRoot":"","sources":["../src/default-origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAE1C,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,wCAAwC,CAAC;AAEhF,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,sCAAsC,CAAC;AAE5E,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,gCAAgC,CAAC"}
1
+ {"version":3,"file":"default-origin.d.ts","sourceRoot":"","sources":["../src/default-origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,QAAQ,CAAC;AAEzC,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,uCAAuC,CAAC;AAE/E,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,qCAAqC,CAAC;AAE3E,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,+BAA+B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * GENERATED — do not edit. The operator tooling's
3
- * `sync-client-origins.mjs --write --tier prod` writes this file, and
3
+ * `sync-client-origins.mjs --write --tier dev` writes this file, and
4
4
  * `check-sdk-default-origin.mjs` refuses it when it names the wrong tier or a
5
5
  * host that declaration does not carry. Regenerate; never hand-edit.
6
6
  *
@@ -10,13 +10,13 @@
10
10
  * than no default at all. Every fallback this SDK ever removed named a host that
11
11
  * was already dead. A generated file plus a gate is what makes this one different.
12
12
  *
13
- * Source: the operator's per-tier public CK API origin declaration, tier 'prod'
13
+ * Source: the operator's per-tier public CK API origin declaration, tier 'dev'
14
14
  */
15
15
  /** The tier this build of the SDK is published for. */
16
- export const CROWDY_DEFAULT_TIER = 'prod';
16
+ export const CROWDY_DEFAULT_TIER = 'dev';
17
17
  /** The public CK API origin for that tier. */
18
- export const CROWDY_DEFAULT_HTTP_ORIGIN = 'https://ck.prod.crowdedkingdoms.com';
18
+ export const CROWDY_DEFAULT_HTTP_ORIGIN = 'https://ck.dev.crowdedkingdoms.com';
19
19
  /** The same host over WebSocket. A scheme is composed; a hostname is looked up. */
20
- export const CROWDY_DEFAULT_WS_ORIGIN = 'wss://ck.prod.crowdedkingdoms.com';
20
+ export const CROWDY_DEFAULT_WS_ORIGIN = 'wss://ck.dev.crowdedkingdoms.com';
21
21
  /** The bare hostname, for callers that need to compare rather than dial. */
22
- export const CROWDY_DEFAULT_HOST = 'ck.prod.crowdedkingdoms.com';
22
+ export const CROWDY_DEFAULT_HOST = 'ck.dev.crowdedkingdoms.com';
@@ -1,4 +1,5 @@
1
1
  import type { OrganizationsAPI } from './organizations.js';
2
+ import type { ManagedPlayersAPI } from './managedPlayers.js';
2
3
  import type { AppsAPI } from './apps.js';
3
4
  import type { AppAccessAPI } from './appAccess.js';
4
5
  import type { BillingAPI } from './billing.js';
@@ -30,6 +31,8 @@ import type { GameAppsAPI } from './gameApps.js';
30
31
  export declare class AdminAPI {
31
32
  /** Organizations, members, RBAC roles, and org API tokens. */
32
33
  readonly organizations: OrganizationsAPI;
34
+ /** The organization's own players, signed in by the organization (dev only). */
35
+ readonly managedPlayers: ManagedPlayersAPI;
33
36
  /** App registry, routing, and player-code admission policy. */
34
37
  readonly apps: AppsAPI;
35
38
  /** App access tiers + per-user access grants. */
@@ -48,6 +51,7 @@ export declare class AdminAPI {
48
51
  readonly grids: GameAppsAPI;
49
52
  constructor(deps: {
50
53
  organizations: OrganizationsAPI;
54
+ managedPlayers: ManagedPlayersAPI;
51
55
  apps: AppsAPI;
52
56
  appAccess: AppAccessAPI;
53
57
  billing: BillingAPI;
@@ -1 +1 @@
1
- {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../src/domains/admin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,QAAQ;IACnB,8DAA8D;IAC9D,QAAQ,CAAC,aAAa,EAAE,gBAAgB,CAAC;IACzC,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,0CAA0C;IAC1C,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,yCAAyC;IACzC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,6CA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B,CAAC;IACzC,gFAAgF;IAChF,QAAQ,CAAC,cAAc,EAAE,iBAAiB,CAAC;IAC3C,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,0CAA0C;IAC1C,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,yCAAyC;IACzC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,mEAAmE;IACnE,QAAQ,CAAC,iBAAiB,EAAE,oBAAoB,CAAC;IACjD,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;gBAEhB,IAAI,EAAE;QAChB,aAAa,EAAE,gBAAgB,CAAC;QAChC,cAAc,EAAE,iBAAiB,CAAC;QAClC,IAAI,EAAE,OAAO,CAAC;QACd,SAAS,EAAE,YAAY,CAAC;QACxB,OAAO,EAAE,UAAU,CAAC;QACpB,QAAQ,EAAE,WAAW,CAAC;QACtB,MAAM,EAAE,SAAS,CAAC;QAClB,KAAK,EAAE,QAAQ,CAAC;QAChB,iBAAiB,EAAE,oBAAoB,CAAC;QACxC,KAAK,EAAE,WAAW,CAAC;KACpB;CAYF"}
@@ -21,6 +21,7 @@
21
21
  export class AdminAPI {
22
22
  constructor(deps) {
23
23
  this.organizations = deps.organizations;
24
+ this.managedPlayers = deps.managedPlayers;
24
25
  this.apps = deps.apps;
25
26
  this.appAccess = deps.appAccess;
26
27
  this.billing = deps.billing;
@@ -0,0 +1,99 @@
1
+ import type { GraphQLClient } from '../client.js';
2
+ import { type ManagedPlayersQuery, type ManagedPlayerQuery, type ProvisionManagedPlayersMutation, type UpdateManagedPlayerMutation, type OrgManagedPlayerSettingsQuery, type OrgSigningKeysQuery, type RegisterOrgSigningKeyMutation, type ProvisionManagedPlayersInput, type UpdateManagedPlayerInput, type RegisterOrgSigningKeyInput } from '../generated/graphql.js';
3
+ /** A public key as {@link ManagedPlayersAPI.registerSigningKey} takes it: a JWK object or its JSON. */
4
+ export type OrgSigningKeyRegistration = Omit<RegisterOrgSigningKeyInput, 'publicJwk'> & {
5
+ publicJwk: string | Record<string, unknown>;
6
+ };
7
+ /**
8
+ * Org-managed players (dev only): an organization's own players, signed in by the
9
+ * organization instead of with a Crowded Kingdoms email and password. Exposed as
10
+ * `client.managedPlayers` (and `client.admin.managedPlayers`).
11
+ *
12
+ * An org-managed player has no email, password, session or wallet. Its organization
13
+ * vouches for it in one of two ways, and either one ends in the player's own app token:
14
+ *
15
+ * - **From its server, with an org token** (`cko_…`, scope `players:mint`): the server calls
16
+ * the `mintManagedPlayerToken` mutation itself and hands the response to the player's
17
+ * device, which stores it with `client.portal.adoptAppToken`. This SDK has no wrapper for
18
+ * that mutation on purpose: an org token signs in any of the organization's players, so
19
+ * it never belongs in a browser or a game client, and the API refuses one sent with an
20
+ * `Origin` header.
21
+ * - **With a signed assertion**: the organization registers a public key here
22
+ * ({@link registerSigningKey}), its sign-in service signs a short JWS for the player, and
23
+ * the device trades it with `client.portal.exchangeManagedPlayerAssertion`.
24
+ *
25
+ * The methods below are the organization's administration. They take an org admin's
26
+ * session with the `manage_players` permission (or, from the organization's server, an org
27
+ * token with `players:manage` for the player operations). An operator turns the feature on
28
+ * for an organization and sets its limits; {@link settings} reads them.
29
+ *
30
+ * Every field answers `FEATURE_DISABLED` outside the dev tier.
31
+ */
32
+ export declare class ManagedPlayersAPI {
33
+ private readonly api;
34
+ constructor(api: GraphQLClient);
35
+ /**
36
+ * The organization's players in the order they were created, a page at a time (`first`
37
+ * defaults to 50, at most 200). `search` matches the start of an external id (exactly) or
38
+ * of a gamertag (any case). Pass `nextCursor` back as `after` for the next page; it is
39
+ * null on the last.
40
+ */
41
+ list(orgId: string, options?: {
42
+ search?: string;
43
+ first?: number;
44
+ after?: string;
45
+ }): Promise<ManagedPlayersQuery['managedPlayers']>;
46
+ /** One player by the id the organization knows it by, or null. */
47
+ get(orgId: string, externalId: string): Promise<ManagedPlayerQuery['managedPlayer']>;
48
+ /**
49
+ * Create players ahead of their first sign-in, up to 500 per call (one statement, much
50
+ * faster than first sign-ins one at a time: pre-provision before a launch). A player
51
+ * that already exists is left as it is and counted in `existing`.
52
+ */
53
+ provision(input: ProvisionManagedPlayersInput): Promise<ProvisionManagedPlayersMutation['provisionManagedPlayers']>;
54
+ /**
55
+ * Rename a player, or disable or enable it. Disabling ends every session the player has
56
+ * (its devices stop at once) and refuses its sign-ins until enabled again. A block a
57
+ * platform operator set also reads as disabled, and only an operator lifts it.
58
+ */
59
+ update(input: UpdateManagedPlayerInput): Promise<UpdateManagedPlayerMutation['updateManagedPlayer']>;
60
+ /** End every session of a player now (sign it out everywhere); it can sign in again. */
61
+ endSessions(orgId: string, externalId: string): Promise<boolean>;
62
+ /**
63
+ * Delete a player: its sessions end and its account is scrubbed. The external id is free
64
+ * again, so a later sign-in with it creates a new player.
65
+ */
66
+ delete(orgId: string, externalId: string): Promise<boolean>;
67
+ /**
68
+ * Whether an operator has turned managed players on for the organization, and its limits:
69
+ * the player cap, sign-ins per minute and the session lengths. Read-only here.
70
+ */
71
+ settings(orgId: string): Promise<OrgManagedPlayerSettingsQuery['orgManagedPlayerSettings']>;
72
+ /** The organization's assertion signing keys, revoked ones included. */
73
+ signingKeys(orgId: string): Promise<OrgSigningKeysQuery['orgSigningKeys']>;
74
+ /**
75
+ * Register a PUBLIC key the organization's sign-in service signs player assertions with:
76
+ * `EdDSA` (Ed25519), `ES256` (P-256) or `RS256` (RSA, 2048 bits or more). `publicJwk` may be
77
+ * the JWK object (for example `publicKey.export({ format: 'jwk' })` in Node) or its JSON.
78
+ * A JWK with private members is refused. `appIds` limits the key to some of the
79
+ * organization's apps; `audience` replaces the default `ck:app:<appId>` when the
80
+ * organization's identity provider sets its own.
81
+ */
82
+ registerSigningKey(input: OrgSigningKeyRegistration): Promise<RegisterOrgSigningKeyMutation['registerOrgSigningKey']>;
83
+ /** Revoke a signing key: assertions it signed are refused from now on. */
84
+ revokeSigningKey(orgId: string, keyId: string): Promise<boolean>;
85
+ /**
86
+ * Whether the organization pays for its managed players' mods in this app. A managed
87
+ * player has no wallet, so with this off its mods, its Crowdy Studio writes and its use
88
+ * of the Studio agent are refused with `MANAGED_PLAYER_NOT_ALLOWED`. False for an app the
89
+ * caller cannot see.
90
+ */
91
+ appModsEnabled(appId: string): Promise<boolean>;
92
+ /**
93
+ * Switch the organization paying for its managed players' mods in this app on or off
94
+ * (`manage_billing` on the app). On, their mods' compute, storage and agent use are billed
95
+ * to the organization; off, those mods are switched off at once.
96
+ */
97
+ setAppMods(appId: string, enabled: boolean): Promise<boolean>;
98
+ }
99
+ //# sourceMappingURL=managedPlayers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"managedPlayers.d.ts","sourceRoot":"","sources":["../../src/domains/managedPlayers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAaL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,+BAA+B,EACpC,KAAK,2BAA2B,EAChC,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAChC,MAAM,yBAAyB,CAAC;AAgBjC,uGAAuG;AACvG,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,0BAA0B,EAAE,WAAW,CAAC,GAAG;IACtF,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,GA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C,OAAO,CAAC;IAKtE;;;;;OAKG;IACG,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKrD;;;;OAIG;IACG,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAIpE"}
@@ -0,0 +1,149 @@
1
+ import { ManagedPlayersDocument, ManagedPlayerDocument, ProvisionManagedPlayersDocument, UpdateManagedPlayerDocument, EndManagedPlayerSessionsDocument, DeleteManagedPlayerDocument, OrgManagedPlayerSettingsDocument, OrgSigningKeysDocument, RegisterOrgSigningKeyDocument, RevokeOrgSigningKeyDocument, AppManagedPlayerModsDocument, SetAppManagedPlayerModsDocument, } from '../generated/graphql.js';
2
+ /** The JWK members that only a private key has (RFC 7518: EC and OKP `d`, RSA's CRT values, `oct`'s `k`). */
3
+ const PRIVATE_JWK_MEMBERS = ['d', 'p', 'q', 'dp', 'dq', 'qi', 'oth', 'k'];
4
+ function privateJwkMember(json) {
5
+ let parsed;
6
+ try {
7
+ parsed = JSON.parse(json);
8
+ }
9
+ catch {
10
+ return null; // not JSON: the API refuses it with its own message
11
+ }
12
+ if (!parsed || typeof parsed !== 'object')
13
+ return null;
14
+ return PRIVATE_JWK_MEMBERS.find((m) => m in parsed) ?? null;
15
+ }
16
+ /**
17
+ * Org-managed players (dev only): an organization's own players, signed in by the
18
+ * organization instead of with a Crowded Kingdoms email and password. Exposed as
19
+ * `client.managedPlayers` (and `client.admin.managedPlayers`).
20
+ *
21
+ * An org-managed player has no email, password, session or wallet. Its organization
22
+ * vouches for it in one of two ways, and either one ends in the player's own app token:
23
+ *
24
+ * - **From its server, with an org token** (`cko_…`, scope `players:mint`): the server calls
25
+ * the `mintManagedPlayerToken` mutation itself and hands the response to the player's
26
+ * device, which stores it with `client.portal.adoptAppToken`. This SDK has no wrapper for
27
+ * that mutation on purpose: an org token signs in any of the organization's players, so
28
+ * it never belongs in a browser or a game client, and the API refuses one sent with an
29
+ * `Origin` header.
30
+ * - **With a signed assertion**: the organization registers a public key here
31
+ * ({@link registerSigningKey}), its sign-in service signs a short JWS for the player, and
32
+ * the device trades it with `client.portal.exchangeManagedPlayerAssertion`.
33
+ *
34
+ * The methods below are the organization's administration. They take an org admin's
35
+ * session with the `manage_players` permission (or, from the organization's server, an org
36
+ * token with `players:manage` for the player operations). An operator turns the feature on
37
+ * for an organization and sets its limits; {@link settings} reads them.
38
+ *
39
+ * Every field answers `FEATURE_DISABLED` outside the dev tier.
40
+ */
41
+ export class ManagedPlayersAPI {
42
+ constructor(api) {
43
+ this.api = api;
44
+ }
45
+ /**
46
+ * The organization's players in the order they were created, a page at a time (`first`
47
+ * defaults to 50, at most 200). `search` matches the start of an external id (exactly) or
48
+ * of a gamertag (any case). Pass `nextCursor` back as `after` for the next page; it is
49
+ * null on the last.
50
+ */
51
+ async list(orgId, options = {}) {
52
+ const data = await this.api.request(ManagedPlayersDocument, { orgId, ...options });
53
+ return data.managedPlayers;
54
+ }
55
+ /** One player by the id the organization knows it by, or null. */
56
+ async get(orgId, externalId) {
57
+ const data = await this.api.request(ManagedPlayerDocument, { orgId, externalId });
58
+ return data.managedPlayer;
59
+ }
60
+ /**
61
+ * Create players ahead of their first sign-in, up to 500 per call (one statement, much
62
+ * faster than first sign-ins one at a time: pre-provision before a launch). A player
63
+ * that already exists is left as it is and counted in `existing`.
64
+ */
65
+ async provision(input) {
66
+ const data = await this.api.request(ProvisionManagedPlayersDocument, { input });
67
+ return data.provisionManagedPlayers;
68
+ }
69
+ /**
70
+ * Rename a player, or disable or enable it. Disabling ends every session the player has
71
+ * (its devices stop at once) and refuses its sign-ins until enabled again. A block a
72
+ * platform operator set also reads as disabled, and only an operator lifts it.
73
+ */
74
+ async update(input) {
75
+ const data = await this.api.request(UpdateManagedPlayerDocument, { input });
76
+ return data.updateManagedPlayer;
77
+ }
78
+ /** End every session of a player now (sign it out everywhere); it can sign in again. */
79
+ async endSessions(orgId, externalId) {
80
+ const data = await this.api.request(EndManagedPlayerSessionsDocument, { orgId, externalId });
81
+ return data.endManagedPlayerSessions;
82
+ }
83
+ /**
84
+ * Delete a player: its sessions end and its account is scrubbed. The external id is free
85
+ * again, so a later sign-in with it creates a new player.
86
+ */
87
+ async delete(orgId, externalId) {
88
+ const data = await this.api.request(DeleteManagedPlayerDocument, { orgId, externalId });
89
+ return data.deleteManagedPlayer;
90
+ }
91
+ /**
92
+ * Whether an operator has turned managed players on for the organization, and its limits:
93
+ * the player cap, sign-ins per minute and the session lengths. Read-only here.
94
+ */
95
+ async settings(orgId) {
96
+ const data = await this.api.request(OrgManagedPlayerSettingsDocument, { orgId });
97
+ return data.orgManagedPlayerSettings;
98
+ }
99
+ /** The organization's assertion signing keys, revoked ones included. */
100
+ async signingKeys(orgId) {
101
+ const data = await this.api.request(OrgSigningKeysDocument, { orgId });
102
+ return data.orgSigningKeys;
103
+ }
104
+ /**
105
+ * Register a PUBLIC key the organization's sign-in service signs player assertions with:
106
+ * `EdDSA` (Ed25519), `ES256` (P-256) or `RS256` (RSA, 2048 bits or more). `publicJwk` may be
107
+ * the JWK object (for example `publicKey.export({ format: 'jwk' })` in Node) or its JSON.
108
+ * A JWK with private members is refused. `appIds` limits the key to some of the
109
+ * organization's apps; `audience` replaces the default `ck:app:<appId>` when the
110
+ * organization's identity provider sets its own.
111
+ */
112
+ async registerSigningKey(input) {
113
+ const publicJwk = typeof input.publicJwk === 'string' ? input.publicJwk : JSON.stringify(input.publicJwk);
114
+ // The API refuses a private JWK too; refusing here keeps the private key from ever
115
+ // leaving the machine that holds it.
116
+ const privateMember = privateJwkMember(publicJwk);
117
+ if (privateMember) {
118
+ throw new TypeError(`registerSigningKey: the JWK carries the private member '${privateMember}'. Register the PUBLIC key only.`);
119
+ }
120
+ const data = await this.api.request(RegisterOrgSigningKeyDocument, {
121
+ input: { ...input, publicJwk },
122
+ });
123
+ return data.registerOrgSigningKey;
124
+ }
125
+ /** Revoke a signing key: assertions it signed are refused from now on. */
126
+ async revokeSigningKey(orgId, keyId) {
127
+ const data = await this.api.request(RevokeOrgSigningKeyDocument, { orgId, keyId });
128
+ return data.revokeOrgSigningKey;
129
+ }
130
+ /**
131
+ * Whether the organization pays for its managed players' mods in this app. A managed
132
+ * player has no wallet, so with this off its mods, its Crowdy Studio writes and its use
133
+ * of the Studio agent are refused with `MANAGED_PLAYER_NOT_ALLOWED`. False for an app the
134
+ * caller cannot see.
135
+ */
136
+ async appModsEnabled(appId) {
137
+ const data = await this.api.request(AppManagedPlayerModsDocument, { appId });
138
+ return data.app?.managedPlayerModsEnabled ?? false;
139
+ }
140
+ /**
141
+ * Switch the organization paying for its managed players' mods in this app on or off
142
+ * (`manage_billing` on the app). On, their mods' compute, storage and agent use are billed
143
+ * to the organization; off, those mods are switched off at once.
144
+ */
145
+ async setAppMods(appId, enabled) {
146
+ const data = await this.api.request(SetAppManagedPlayerModsDocument, { appId, enabled });
147
+ return data.setAppManagedPlayerMods;
148
+ }
149
+ }