@crowdedkingdoms/crowdyjs 18.23.1-test.1 → 18.24.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/MIGRATION.md +62 -0
- package/README.md +135 -14
- package/dist/crowdy-client.d.ts +10 -1
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +5 -0
- package/dist/default-origin.d.ts +6 -6
- package/dist/default-origin.d.ts.map +1 -1
- package/dist/default-origin.js +6 -6
- package/dist/domains/admin.d.ts +4 -0
- package/dist/domains/admin.d.ts.map +1 -1
- package/dist/domains/admin.js +1 -0
- package/dist/domains/apps.d.ts +43 -3
- package/dist/domains/apps.d.ts.map +1 -1
- package/dist/domains/apps.js +46 -3
- package/dist/domains/auth.d.ts +140 -16
- package/dist/domains/auth.d.ts.map +1 -1
- package/dist/domains/auth.js +153 -16
- package/dist/domains/inputLog.d.ts +4 -1
- package/dist/domains/inputLog.d.ts.map +1 -1
- package/dist/domains/inputLog.js +4 -1
- package/dist/domains/managedPlayers.d.ts +56 -3
- package/dist/domains/managedPlayers.d.ts.map +1 -1
- package/dist/domains/managedPlayers.js +16 -3
- package/dist/domains/moderation.d.ts +53 -0
- package/dist/domains/moderation.d.ts.map +1 -0
- package/dist/domains/moderation.js +68 -0
- package/dist/domains/platform.d.ts +13 -0
- package/dist/domains/platform.d.ts.map +1 -1
- package/dist/domains/platform.js +14 -0
- package/dist/domains/portal.d.ts +86 -8
- package/dist/domains/portal.d.ts.map +1 -1
- package/dist/domains/portal.js +78 -8
- package/dist/domains/safety.d.ts +163 -0
- package/dist/domains/safety.d.ts.map +1 -0
- package/dist/domains/safety.js +167 -0
- package/dist/domains/users.d.ts +9 -1
- package/dist/domains/users.d.ts.map +1 -1
- package/dist/domains/users.js +9 -1
- package/dist/errors.d.ts +135 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +163 -0
- package/dist/generated/graphql-schema.d.ts +522 -14
- package/dist/generated/graphql-schema.d.ts.map +1 -1
- package/dist/generated/graphql-schema.js +64 -0
- package/dist/generated/graphql.d.ts +375 -0
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +24 -3
- package/dist/index.d.ts +12 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/live-coding/assets/browser-authoring-index.json +1 -1
- package/dist/live-coding/assets/manifest.json +1 -1
- package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -1
- package/dist/live-coding/browser-authoring-index.generated.js +265 -6
- package/package.json +1 -1
|
@@ -28,8 +28,19 @@ function privateJwkMember(json) {
|
|
|
28
28
|
* it never belongs in a browser or a game client, and the API refuses one sent with an
|
|
29
29
|
* `Origin` header.
|
|
30
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
|
|
32
|
-
* the device trades it with
|
|
31
|
+
* ({@link registerSigningKey}), its sign-in service signs a short JWS for the player
|
|
32
|
+
* ({@link ManagedPlayerAssertionClaims}), and the device trades it with
|
|
33
|
+
* `client.portal.exchangeManagedPlayerAssertion`.
|
|
34
|
+
*
|
|
35
|
+
* **Age and country (ck-api v2.60.0).** Either way the organization says how old the player
|
|
36
|
+
* is and where it lives: `ageYears` and `country` on the mint's input
|
|
37
|
+
* (`MintManagedPlayerTokenInput`) or as the assertion's claims. Crowded Kingdoms stores an age
|
|
38
|
+
* bracket and the country on the player, applies a minor's defaults itself, and refuses the
|
|
39
|
+
* sign-in with `TERRITORY_NOT_SUPPORTED` in a country it does not serve and
|
|
40
|
+
* `AGE_REQUIREMENT_NOT_MET` under the app's, the country's or the platform's youngest age,
|
|
41
|
+
* before the player is created. Both are optional while every managed player is 18 or older
|
|
42
|
+
* under the Org-Managed Players Addendum (left out, the player counts as an adult), and
|
|
43
|
+
* required once the platform admits players under 18 (`AGE_REQUIRED` without an age).
|
|
33
44
|
*
|
|
34
45
|
* The methods below are the organization's administration. They take an org admin's
|
|
35
46
|
* session with the `manage_players` permission (or, from the organization's server, an org
|
|
@@ -95,7 +106,9 @@ export class ManagedPlayersAPI {
|
|
|
95
106
|
* again, so a later sign-in with it creates a new player. Since Game API v2.54.0 its
|
|
96
107
|
* player-side content is erased within minutes (usage and billing records and world edits
|
|
97
108
|
* stay), and a legal hold on the player or its organization refuses the delete with
|
|
98
|
-
* `LEGAL_HOLD`; the player stays as it was.
|
|
109
|
+
* `LEGAL_HOLD`; the player stays as it was. Since v2.60.0 an open or escalated safety
|
|
110
|
+
* report about the player sets such a hold first: disable the player instead
|
|
111
|
+
* ({@link update}), which keeps everything.
|
|
99
112
|
*/
|
|
100
113
|
async delete(orgId, externalId) {
|
|
101
114
|
const data = await this.api.request(DeleteManagedPlayerDocument, { orgId, externalId });
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { GraphQLClient } from '../client.js';
|
|
2
|
+
import { type SafetyReportsQuery } from '../generated/graphql.js';
|
|
3
|
+
/** Where a safety report stands: waiting, closed with an outcome, or sent to the CyberTipline. */
|
|
4
|
+
export type SafetyReportStatusValue = 'OPEN' | 'RESOLVED' | 'ESCALATED';
|
|
5
|
+
/** A safety report as a moderator reads it ({@link ModerationAPI.reports}). */
|
|
6
|
+
export type SafetyReportRecord = SafetyReportsQuery['safetyReports'][number];
|
|
7
|
+
/**
|
|
8
|
+
* An app's safety reports, for its moderators — exposed as `client.moderation` (and
|
|
9
|
+
* `client.admin.moderation`; ck-api v2.60.0).
|
|
10
|
+
*
|
|
11
|
+
* Players file reports with `client.safety.fileReport`. Each one links both players'
|
|
12
|
+
* recorded sessions around it, and the platform preserves those with both identities while
|
|
13
|
+
* the report is open. A moderator reads the reports, reads the sessions a report covers, and
|
|
14
|
+
* decides it: {@link resolveReport} closes it and deletes the preserved copy;
|
|
15
|
+
* {@link escalateReport} records a CyberTipline submission and keeps the copy for a year.
|
|
16
|
+
*
|
|
17
|
+
* **Who.** Every call needs `moderate_safety` on the app: an organization role that grants it,
|
|
18
|
+
* or an admin of the app's organization. Send the moderator's identity session (not an app
|
|
19
|
+
* token) to the app's datacenter (`apps.routeFor`, or `discovery`).
|
|
20
|
+
*
|
|
21
|
+
* **Reading a reported session.** `SafetyReport.sessions` names the recorded sessions
|
|
22
|
+
* (`InputLogSession.gameTokenId`) the report covers. A moderator mints an app token for the
|
|
23
|
+
* app (`portal.mintAppToken`) and reads them with `client.inputLog.messages(appId,
|
|
24
|
+
* gameTokenId)` on the app's client while the report is open or escalated; every read is
|
|
25
|
+
* audited.
|
|
26
|
+
*/
|
|
27
|
+
export declare class ModerationAPI {
|
|
28
|
+
private readonly api;
|
|
29
|
+
constructor(api: GraphQLClient);
|
|
30
|
+
/**
|
|
31
|
+
* The app's reports, newest first, with open `CHILD_SAFETY` reports ahead of the rest.
|
|
32
|
+
* `status` keeps one kind; `first` defaults to 50 (1 to 200).
|
|
33
|
+
*/
|
|
34
|
+
reports(appId: string, options?: {
|
|
35
|
+
status?: SafetyReportStatusValue;
|
|
36
|
+
first?: number;
|
|
37
|
+
}): Promise<SafetyReportRecord[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Resolve an open report with its outcome (at most 1,000 characters): its preserved copy is
|
|
40
|
+
* deleted, and a legal hold its reported account got on deletion is released. Resolving it
|
|
41
|
+
* again changes nothing; an escalated report cannot be resolved (`BAD_REQUEST`).
|
|
42
|
+
*/
|
|
43
|
+
resolveReport(appId: string, reportId: string, outcome: string): Promise<SafetyReportRecord>;
|
|
44
|
+
/**
|
|
45
|
+
* Record that an open report was submitted to NCMEC's CyberTipline, under the id NCMEC
|
|
46
|
+
* gave the submission: its preserved copy is kept under retention for a year from now, and
|
|
47
|
+
* the reported account's legal hold, if any, as long. Again under the same id changes
|
|
48
|
+
* nothing; under another id is `CONFLICT`; a resolved report cannot be escalated
|
|
49
|
+
* (`BAD_REQUEST`).
|
|
50
|
+
*/
|
|
51
|
+
escalateReport(appId: string, reportId: string, ncmecReportId: string): Promise<SafetyReportRecord>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=moderation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moderation.d.ts","sourceRoot":"","sources":["../../src/domains/moderation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAC;AAEjC,kGAAkG;AAClG,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,CAAC;AAExE,+EAA+E;AAC/E,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAE/C;;;OAGG;IACG,OAAO,CACX,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,uBAAuB,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GACjE,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAWhC;;;;OAIG;IACG,aAAa,CACjB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,kBAAkB,CAAC;IAS9B;;;;;;OAMG;IACG,cAAc,CAClB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,kBAAkB,CAAC;CAQ/B"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { SafetyReportsDocument, ResolveSafetyReportDocument, EscalateSafetyReportDocument, } from '../generated/graphql.js';
|
|
2
|
+
/**
|
|
3
|
+
* An app's safety reports, for its moderators — exposed as `client.moderation` (and
|
|
4
|
+
* `client.admin.moderation`; ck-api v2.60.0).
|
|
5
|
+
*
|
|
6
|
+
* Players file reports with `client.safety.fileReport`. Each one links both players'
|
|
7
|
+
* recorded sessions around it, and the platform preserves those with both identities while
|
|
8
|
+
* the report is open. A moderator reads the reports, reads the sessions a report covers, and
|
|
9
|
+
* decides it: {@link resolveReport} closes it and deletes the preserved copy;
|
|
10
|
+
* {@link escalateReport} records a CyberTipline submission and keeps the copy for a year.
|
|
11
|
+
*
|
|
12
|
+
* **Who.** Every call needs `moderate_safety` on the app: an organization role that grants it,
|
|
13
|
+
* or an admin of the app's organization. Send the moderator's identity session (not an app
|
|
14
|
+
* token) to the app's datacenter (`apps.routeFor`, or `discovery`).
|
|
15
|
+
*
|
|
16
|
+
* **Reading a reported session.** `SafetyReport.sessions` names the recorded sessions
|
|
17
|
+
* (`InputLogSession.gameTokenId`) the report covers. A moderator mints an app token for the
|
|
18
|
+
* app (`portal.mintAppToken`) and reads them with `client.inputLog.messages(appId,
|
|
19
|
+
* gameTokenId)` on the app's client while the report is open or escalated; every read is
|
|
20
|
+
* audited.
|
|
21
|
+
*/
|
|
22
|
+
export class ModerationAPI {
|
|
23
|
+
constructor(api) {
|
|
24
|
+
this.api = api;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The app's reports, newest first, with open `CHILD_SAFETY` reports ahead of the rest.
|
|
28
|
+
* `status` keeps one kind; `first` defaults to 50 (1 to 200).
|
|
29
|
+
*/
|
|
30
|
+
async reports(appId, options = {}) {
|
|
31
|
+
const data = await this.api.request(SafetyReportsDocument, {
|
|
32
|
+
appId,
|
|
33
|
+
...(options.status !== undefined
|
|
34
|
+
? { status: options.status }
|
|
35
|
+
: {}),
|
|
36
|
+
...(options.first !== undefined ? { first: options.first } : {}),
|
|
37
|
+
});
|
|
38
|
+
return data.safetyReports;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Resolve an open report with its outcome (at most 1,000 characters): its preserved copy is
|
|
42
|
+
* deleted, and a legal hold its reported account got on deletion is released. Resolving it
|
|
43
|
+
* again changes nothing; an escalated report cannot be resolved (`BAD_REQUEST`).
|
|
44
|
+
*/
|
|
45
|
+
async resolveReport(appId, reportId, outcome) {
|
|
46
|
+
const data = await this.api.request(ResolveSafetyReportDocument, {
|
|
47
|
+
appId,
|
|
48
|
+
reportId,
|
|
49
|
+
outcome,
|
|
50
|
+
});
|
|
51
|
+
return data.resolveSafetyReport;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Record that an open report was submitted to NCMEC's CyberTipline, under the id NCMEC
|
|
55
|
+
* gave the submission: its preserved copy is kept under retention for a year from now, and
|
|
56
|
+
* the reported account's legal hold, if any, as long. Again under the same id changes
|
|
57
|
+
* nothing; under another id is `CONFLICT`; a resolved report cannot be escalated
|
|
58
|
+
* (`BAD_REQUEST`).
|
|
59
|
+
*/
|
|
60
|
+
async escalateReport(appId, reportId, ncmecReportId) {
|
|
61
|
+
const data = await this.api.request(EscalateSafetyReportDocument, {
|
|
62
|
+
appId,
|
|
63
|
+
reportId,
|
|
64
|
+
ncmecReportId,
|
|
65
|
+
});
|
|
66
|
+
return data.escalateSafetyReport;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { GraphQLClient } from '../client.js';
|
|
2
|
+
import { type TerritoryPoliciesQuery } from '../generated/graphql.js';
|
|
3
|
+
/** One country Crowded Kingdoms lists ({@link PlatformAPI.territoryPolicies}). */
|
|
4
|
+
export type TerritoryPolicyRecord = TerritoryPoliciesQuery['territoryPolicies'][number];
|
|
2
5
|
/**
|
|
3
6
|
* Public platform discovery returned by {@link PlatformAPI.config}: how SDKs
|
|
4
7
|
* find the shared game-api so they can route apps deployed to the shared
|
|
@@ -44,5 +47,15 @@ export declare class PlatformAPI {
|
|
|
44
47
|
* @throws {CrowdyGraphQLError} on transport/validation failures.
|
|
45
48
|
*/
|
|
46
49
|
config(): Promise<PlatformConfig>;
|
|
50
|
+
/**
|
|
51
|
+
* The countries Crowded Kingdoms lists, by ISO 3166-1 alpha-2 `countryCode`: `status`
|
|
52
|
+
* `blocked` for one it does not serve (sign-up and play are refused there with
|
|
53
|
+
* `TERRITORY_NOT_SUPPORTED`, by the country a player gives or connects from), and `open`
|
|
54
|
+
* with a `minAge` above the platform's for the others it lists. A country not listed is
|
|
55
|
+
* open at the platform's youngest age. **Public**, so a sign-up form can tell a player
|
|
56
|
+
* before an account exists that the service is not available in their country. Do not show
|
|
57
|
+
* the ages: a sign-up screen names none. ck-api v2.60.0.
|
|
58
|
+
*/
|
|
59
|
+
territoryPolicies(): Promise<TerritoryPolicyRecord[]>;
|
|
47
60
|
}
|
|
48
61
|
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/domains/platform.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/domains/platform.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAC;AAEjC,kFAAkF;AAClF,MAAM,MAAM,qBAAqB,GAAG,sBAAsB,CAAC,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExF;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,sFAAsF;IACtF,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,mFAAmF;IACnF,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,gFAAgF;IAChF,cAAc,EAAE,MAAM,CAAC;CACxB;AAiBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAE/C;;;;;;;;OAQG;IACG,MAAM,IAAI,OAAO,CAAC,cAAc,CAAC;IAKvC;;;;;;;;OAQG;IACG,iBAAiB,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;CAI5D"}
|
package/dist/domains/platform.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { parse } from 'graphql';
|
|
2
|
+
import { TerritoryPoliciesDocument, } from '../generated/graphql.js';
|
|
2
3
|
// Hand-written document so the SDK can discover the shared game-api URL even
|
|
3
4
|
// before codegen picks up the new schema (see src/operations/platform/).
|
|
4
5
|
const PlatformConfigDocument = parse(/* GraphQL */ `
|
|
@@ -46,4 +47,17 @@ export class PlatformAPI {
|
|
|
46
47
|
const data = await this.api.request(PlatformConfigDocument, {});
|
|
47
48
|
return data.platformConfig;
|
|
48
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* The countries Crowded Kingdoms lists, by ISO 3166-1 alpha-2 `countryCode`: `status`
|
|
52
|
+
* `blocked` for one it does not serve (sign-up and play are refused there with
|
|
53
|
+
* `TERRITORY_NOT_SUPPORTED`, by the country a player gives or connects from), and `open`
|
|
54
|
+
* with a `minAge` above the platform's for the others it lists. A country not listed is
|
|
55
|
+
* open at the platform's youngest age. **Public**, so a sign-up form can tell a player
|
|
56
|
+
* before an account exists that the service is not available in their country. Do not show
|
|
57
|
+
* the ages: a sign-up screen names none. ck-api v2.60.0.
|
|
58
|
+
*/
|
|
59
|
+
async territoryPolicies() {
|
|
60
|
+
const data = await this.api.request(TerritoryPoliciesDocument, {});
|
|
61
|
+
return data.territoryPolicies;
|
|
62
|
+
}
|
|
49
63
|
}
|
package/dist/domains/portal.d.ts
CHANGED
|
@@ -127,6 +127,38 @@ export declare class BrowserSessionPkceStore implements PkceStore {
|
|
|
127
127
|
set(state: string, verifier: string): void;
|
|
128
128
|
remove(state: string): void;
|
|
129
129
|
}
|
|
130
|
+
/** {@link PortalAPI.minecraftChallenge}'s answer: a one-time server id for Mojang's session join. */
|
|
131
|
+
export interface MinecraftChallenge {
|
|
132
|
+
/** 40 hex characters: pass it unchanged as the server id of Mojang's session join, then to `signInWithMinecraft`. */
|
|
133
|
+
serverId: string;
|
|
134
|
+
/** ISO-8601 UTC; the server id is refused after it (two minutes). */
|
|
135
|
+
expiresAt: string;
|
|
136
|
+
}
|
|
137
|
+
/** A document the player accepted in game, at the version they saw. */
|
|
138
|
+
export interface AcceptedLegalDocument {
|
|
139
|
+
documentId: string;
|
|
140
|
+
version: string;
|
|
141
|
+
}
|
|
142
|
+
/** {@link PortalAPI.signInWithMinecraft}'s input. */
|
|
143
|
+
export interface MinecraftSignInParams {
|
|
144
|
+
/** The app {@link PortalAPI.minecraftChallenge} was asked for. */
|
|
145
|
+
appId: string;
|
|
146
|
+
/** The Minecraft account name the client is signed in with. */
|
|
147
|
+
username: string;
|
|
148
|
+
/** The challenge's server id, after the client joined it through Mojang's session service. */
|
|
149
|
+
serverId: string;
|
|
150
|
+
/** From the age screen: `YYYY-MM-DD` (or `YYYY-MM`); only the age bracket is kept. */
|
|
151
|
+
birthDate: string;
|
|
152
|
+
/** ISO 3166-1 alpha-2. */
|
|
153
|
+
country: string;
|
|
154
|
+
/** A player under 18 confirmed a parent or guardian agreed; required true under 18. */
|
|
155
|
+
parentalConfirmation?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Every document `auth.playerLegalDocuments()` and `auth.appRequiredDocuments(appId)` name,
|
|
158
|
+
* at those versions, which the player accepted in game (recorded with method `IN_GAME`).
|
|
159
|
+
*/
|
|
160
|
+
acceptedDocuments: AcceptedLegalDocument[];
|
|
161
|
+
}
|
|
130
162
|
export interface PortalConsentState {
|
|
131
163
|
appId: string;
|
|
132
164
|
appName: string | null;
|
|
@@ -212,12 +244,14 @@ export declare function defaultHostedSignInUrl(graphqlEndpoint: string): string;
|
|
|
212
244
|
export declare function isHostedSignInRequiredError(error: unknown): boolean;
|
|
213
245
|
/**
|
|
214
246
|
* `LEGAL_ACCEPTANCE_REQUIRED`: the player has not stored the current required
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
* {@link PortalAPI.
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
247
|
+
* documents (the platform's player documents, the app's own since ck-api v2.60.0,
|
|
248
|
+
* and the age-of-majority attestation while the platform asks for it), so no
|
|
249
|
+
* gameplay token is issued ({@link PortalAPI.mintAppToken},
|
|
250
|
+
* {@link PortalAPI.createAuthorizationCode}, {@link PortalAPI.refresh}), and a
|
|
251
|
+
* browser `auth.register` without the boxes is refused. A browser game sends the
|
|
252
|
+
* player back through {@link PortalAPI.signIn}, where Studio's `/authorize` asks; a
|
|
253
|
+
* native client shows its own clickwrap and calls `auth.recordPlayerConsents`.
|
|
254
|
+
* `legalAcceptanceRequiredOf` reads which documents are missing. ck-api v2.35.0.
|
|
221
255
|
*/
|
|
222
256
|
export declare function isLegalAcceptanceRequiredError(error: unknown): boolean;
|
|
223
257
|
export declare class PortalAPI {
|
|
@@ -246,6 +280,15 @@ export declare class PortalAPI {
|
|
|
246
280
|
* paid apps require an existing entitlement. Refused with
|
|
247
281
|
* `LEGAL_ACCEPTANCE_REQUIRED` ({@link isLegalAcceptanceRequiredError}) until the
|
|
248
282
|
* player's consents are stored (`auth.recordPlayerConsents`, ck-api v2.35.0).
|
|
283
|
+
*
|
|
284
|
+
* **The player gate (ck-api v2.60.0)** runs at every mint and refresh, in this
|
|
285
|
+
* order: `TERRITORY_NOT_SUPPORTED` (`territoryNotSupportedOf`) for a country
|
|
286
|
+
* Crowded Kingdoms does not serve; `AGE_REQUIRED` (`ageRequiredOf`) while the
|
|
287
|
+
* player's age is unknown (`auth.recordPlayerAge`); `AGE_REQUIREMENT_NOT_MET`
|
|
288
|
+
* (`ageRequirementNotMetOf`) under the app's, the country's or the platform's
|
|
289
|
+
* youngest age; then the documents. A player under 18 is also refused
|
|
290
|
+
* `SAFETY_LOG_REQUIRED` (`safetyLogRequiredOf`) in an app without the safety log.
|
|
291
|
+
* None of them is fixed by retrying.
|
|
249
292
|
*/
|
|
250
293
|
mintAppToken(appId: string): Promise<AppTokenResponse>;
|
|
251
294
|
/**
|
|
@@ -274,7 +317,9 @@ export declare class PortalAPI {
|
|
|
274
317
|
* Refused with `LEGAL_ACCEPTANCE_REQUIRED` ({@link isLegalAcceptanceRequiredError})
|
|
275
318
|
* when the player's stored consents are missing or a required document has a
|
|
276
319
|
* new version (ck-api v2.35.0). Retrying cannot succeed: send a browser player
|
|
277
|
-
* back through {@link signIn}, where `/authorize` asks for them.
|
|
320
|
+
* back through {@link signIn}, where `/authorize` asks for them. The player gate's
|
|
321
|
+
* other refusals ({@link mintAppToken}) apply at a refresh too: a country the
|
|
322
|
+
* platform stopped serving, or an app that raised its minimum age.
|
|
278
323
|
*/
|
|
279
324
|
refresh(currentServer?: CurrentServer): Promise<AppTokenResponse>;
|
|
280
325
|
/**
|
|
@@ -289,6 +334,10 @@ export declare class PortalAPI {
|
|
|
289
334
|
* A refresh is also refused with `ORG_LEGAL_ACCEPTANCE_REQUIRED`
|
|
290
335
|
* ({@link orgLegalAcceptanceRequiredOf}) while the organization has not accepted the
|
|
291
336
|
* current Org-Managed Players Addendum; only an admin of the organization can fix that.
|
|
337
|
+
* Since ck-api v2.60.0 the organization's server passes the player's `ageYears` and
|
|
338
|
+
* `country` to the mint, and the mint and every refresh answer the player gate's refusals
|
|
339
|
+
* ({@link mintAppToken}); a refresh only has the stored age bracket, so it is refused once
|
|
340
|
+
* that bracket is wholly below the app's youngest age.
|
|
292
341
|
*
|
|
293
342
|
* Refuses an org token (`cko_…`). That is the organization's server credential: it signs
|
|
294
343
|
* in any of the organization's players, so a device must never hold one.
|
|
@@ -304,12 +353,41 @@ export declare class PortalAPI {
|
|
|
304
353
|
* `extensions.reason` ({@link assertionRejectedOf}); resending the same assertion cannot
|
|
305
354
|
* succeed, so ask the sign-in service for a new one. A valid assertion is refused with
|
|
306
355
|
* `ORG_LEGAL_ACCEPTANCE_REQUIRED` ({@link orgLegalAcceptanceRequiredOf}) while the
|
|
307
|
-
* organization has not accepted the current Org-Managed Players Addendum
|
|
356
|
+
* organization has not accepted the current Org-Managed Players Addendum, and with the
|
|
357
|
+
* player gate's refusals ({@link mintAppToken}) for the age and country it asserts: the
|
|
358
|
+
* claims `ageYears` and `country` (`ManagedPlayerAssertionClaims`, ck-api v2.60.0), which
|
|
359
|
+
* become required once the platform admits players under 18.
|
|
308
360
|
*/
|
|
309
361
|
exchangeManagedPlayerAssertion(params: {
|
|
310
362
|
appId: string;
|
|
311
363
|
assertion: string;
|
|
312
364
|
}): Promise<AppTokenResponse>;
|
|
365
|
+
/**
|
|
366
|
+
* Start a Minecraft sign-in: a one-time server id for the app, good for two minutes. The
|
|
367
|
+
* Minecraft client joins it through Mojang's session service as the account signed in to
|
|
368
|
+
* the game (the request a client makes to join any online-mode server), then calls
|
|
369
|
+
* {@link signInWithMinecraft}. Ask for it yourself, and never join a server id something
|
|
370
|
+
* else hands you: whoever holds a joined server id can sign in as that account.
|
|
371
|
+
*
|
|
372
|
+
* Open only to Crowded Kingdoms' own apps: any other app is refused `FORBIDDEN`, and a
|
|
373
|
+
* tier without Minecraft sign-in `FEATURE_DISABLED`. Public; rate-limited per address.
|
|
374
|
+
* ck-api v2.60.0.
|
|
375
|
+
*/
|
|
376
|
+
minecraftChallenge(appId: string): Promise<MinecraftChallenge>;
|
|
377
|
+
/**
|
|
378
|
+
* Sign a Minecraft player in to one of Crowded Kingdoms' own apps, and store the app token
|
|
379
|
+
* (as {@link adoptAppToken} does). The API asks Mojang whether `username` joined with the
|
|
380
|
+
* challenge's `serverId` and admits the player only on a yes; the player is an org-managed
|
|
381
|
+
* player of the app's organization, identified by its Minecraft account, and refreshes
|
|
382
|
+
* with {@link refresh}. Public. ck-api v2.60.0.
|
|
383
|
+
*
|
|
384
|
+
* Refusals: `MINECRAFT_VERIFICATION_FAILED` (`minecraftVerificationFailedOf`, with the
|
|
385
|
+
* reason: start again from {@link minecraftChallenge}), `MINECRAFT_VERIFICATION_UNAVAILABLE`
|
|
386
|
+
* (`minecraftVerificationUnavailableOf`: Mojang did not answer; retry shortly), the player
|
|
387
|
+
* gate's ({@link mintAppToken}), `LEGAL_ACCEPTANCE_REQUIRED` when `acceptedDocuments` misses
|
|
388
|
+
* one (`legalAcceptanceRequiredOf` lists them), and `ORG_LEGAL_ACCEPTANCE_REQUIRED`.
|
|
389
|
+
*/
|
|
390
|
+
signInWithMinecraft(params: MinecraftSignInParams): Promise<AppTokenResponse>;
|
|
313
391
|
/** Whether portaling into an app needs a consent prompt (Overworld side). */
|
|
314
392
|
getConsent(appId: string): Promise<PortalConsentState>;
|
|
315
393
|
/** Record the user's consent for an app (call from the consent screen). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../src/domains/portal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACpE,qFAAqF;IACrF,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,UAAU,EAAE,MAAM,GAA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;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IA8BnD;;;;;;OAMG;IACG,oBAAoB,CACxB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAQnC;;;;OAIG;IACG,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAa3D;;;;;;OAMG;IACG,sBAAsB,CAC1B,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GACtD,OAAO,CAAC,MAAM,CAAC;IAoClB;;;;;OAKG;IACG,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;CAmBvE"}
|
package/dist/domains/portal.js
CHANGED
|
@@ -66,6 +66,8 @@ const RefreshAppTokenDocument = parse(`mutation RefreshAppToken { refreshAppToke
|
|
|
66
66
|
// v1.83.7 (no `currentServer` argument, no `authorizedServer` field) keeps refreshing.
|
|
67
67
|
const RefreshAppTokenOnServerDocument = parse(`mutation RefreshAppTokenOnServer($currentServer: CurrentServerInput) { refreshAppToken(currentServer: $currentServer) { ${APP_TOKEN_FIELDS} authorizedServer { ip4 clientPort } } }`);
|
|
68
68
|
const ExchangeManagedPlayerAssertionDocument = parse(`mutation ExchangeManagedPlayerAssertion($input: ExchangeManagedPlayerAssertionInput!) { exchangeManagedPlayerAssertion(input: $input) { ${APP_TOKEN_FIELDS} } }`);
|
|
69
|
+
const MinecraftChallengeDocument = parse(`mutation MinecraftChallenge($appId: BigInt!) { minecraftChallenge(appId: $appId) { serverId expiresAt } }`);
|
|
70
|
+
const SignInWithMinecraftDocument = parse(`mutation SignInWithMinecraft($input: SignInWithMinecraftInput!) { signInWithMinecraft(input: $input) { ${APP_TOKEN_FIELDS} } }`);
|
|
69
71
|
/** What every org token starts with: an organization's server credential, never a device's. */
|
|
70
72
|
const ORG_TOKEN_PREFIX = 'cko_';
|
|
71
73
|
/** Thrown by {@link PortalAPI.handleAuthorizeRequest} when the user must consent. */
|
|
@@ -121,12 +123,14 @@ export function isHostedSignInRequiredError(error) {
|
|
|
121
123
|
}
|
|
122
124
|
/**
|
|
123
125
|
* `LEGAL_ACCEPTANCE_REQUIRED`: the player has not stored the current required
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* {@link PortalAPI.
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
126
|
+
* documents (the platform's player documents, the app's own since ck-api v2.60.0,
|
|
127
|
+
* and the age-of-majority attestation while the platform asks for it), so no
|
|
128
|
+
* gameplay token is issued ({@link PortalAPI.mintAppToken},
|
|
129
|
+
* {@link PortalAPI.createAuthorizationCode}, {@link PortalAPI.refresh}), and a
|
|
130
|
+
* browser `auth.register` without the boxes is refused. A browser game sends the
|
|
131
|
+
* player back through {@link PortalAPI.signIn}, where Studio's `/authorize` asks; a
|
|
132
|
+
* native client shows its own clickwrap and calls `auth.recordPlayerConsents`.
|
|
133
|
+
* `legalAcceptanceRequiredOf` reads which documents are missing. ck-api v2.35.0.
|
|
130
134
|
*/
|
|
131
135
|
export function isLegalAcceptanceRequiredError(error) {
|
|
132
136
|
const e = error;
|
|
@@ -165,6 +169,15 @@ export class PortalAPI {
|
|
|
165
169
|
* paid apps require an existing entitlement. Refused with
|
|
166
170
|
* `LEGAL_ACCEPTANCE_REQUIRED` ({@link isLegalAcceptanceRequiredError}) until the
|
|
167
171
|
* player's consents are stored (`auth.recordPlayerConsents`, ck-api v2.35.0).
|
|
172
|
+
*
|
|
173
|
+
* **The player gate (ck-api v2.60.0)** runs at every mint and refresh, in this
|
|
174
|
+
* order: `TERRITORY_NOT_SUPPORTED` (`territoryNotSupportedOf`) for a country
|
|
175
|
+
* Crowded Kingdoms does not serve; `AGE_REQUIRED` (`ageRequiredOf`) while the
|
|
176
|
+
* player's age is unknown (`auth.recordPlayerAge`); `AGE_REQUIREMENT_NOT_MET`
|
|
177
|
+
* (`ageRequirementNotMetOf`) under the app's, the country's or the platform's
|
|
178
|
+
* youngest age; then the documents. A player under 18 is also refused
|
|
179
|
+
* `SAFETY_LOG_REQUIRED` (`safetyLogRequiredOf`) in an app without the safety log.
|
|
180
|
+
* None of them is fixed by retrying.
|
|
168
181
|
*/
|
|
169
182
|
async mintAppToken(appId) {
|
|
170
183
|
const data = await this.api.request(MintAppTokenDocument, {
|
|
@@ -202,7 +215,9 @@ export class PortalAPI {
|
|
|
202
215
|
* Refused with `LEGAL_ACCEPTANCE_REQUIRED` ({@link isLegalAcceptanceRequiredError})
|
|
203
216
|
* when the player's stored consents are missing or a required document has a
|
|
204
217
|
* new version (ck-api v2.35.0). Retrying cannot succeed: send a browser player
|
|
205
|
-
* back through {@link signIn}, where `/authorize` asks for them.
|
|
218
|
+
* back through {@link signIn}, where `/authorize` asks for them. The player gate's
|
|
219
|
+
* other refusals ({@link mintAppToken}) apply at a refresh too: a country the
|
|
220
|
+
* platform stopped serving, or an app that raised its minimum age.
|
|
206
221
|
*/
|
|
207
222
|
async refresh(currentServer) {
|
|
208
223
|
// NATIVE CLIENTS NAME THEIR SERVER. A Buddy drops datagrams for a token it was
|
|
@@ -230,6 +245,10 @@ export class PortalAPI {
|
|
|
230
245
|
* A refresh is also refused with `ORG_LEGAL_ACCEPTANCE_REQUIRED`
|
|
231
246
|
* ({@link orgLegalAcceptanceRequiredOf}) while the organization has not accepted the
|
|
232
247
|
* current Org-Managed Players Addendum; only an admin of the organization can fix that.
|
|
248
|
+
* Since ck-api v2.60.0 the organization's server passes the player's `ageYears` and
|
|
249
|
+
* `country` to the mint, and the mint and every refresh answer the player gate's refusals
|
|
250
|
+
* ({@link mintAppToken}); a refresh only has the stored age bracket, so it is refused once
|
|
251
|
+
* that bracket is wholly below the app's youngest age.
|
|
233
252
|
*
|
|
234
253
|
* Refuses an org token (`cko_…`). That is the organization's server credential: it signs
|
|
235
254
|
* in any of the organization's players, so a device must never hold one.
|
|
@@ -255,7 +274,10 @@ export class PortalAPI {
|
|
|
255
274
|
* `extensions.reason` ({@link assertionRejectedOf}); resending the same assertion cannot
|
|
256
275
|
* succeed, so ask the sign-in service for a new one. A valid assertion is refused with
|
|
257
276
|
* `ORG_LEGAL_ACCEPTANCE_REQUIRED` ({@link orgLegalAcceptanceRequiredOf}) while the
|
|
258
|
-
* organization has not accepted the current Org-Managed Players Addendum
|
|
277
|
+
* organization has not accepted the current Org-Managed Players Addendum, and with the
|
|
278
|
+
* player gate's refusals ({@link mintAppToken}) for the age and country it asserts: the
|
|
279
|
+
* claims `ageYears` and `country` (`ManagedPlayerAssertionClaims`, ck-api v2.60.0), which
|
|
280
|
+
* become required once the platform admits players under 18.
|
|
259
281
|
*/
|
|
260
282
|
async exchangeManagedPlayerAssertion(params) {
|
|
261
283
|
const data = await this.api.request(ExchangeManagedPlayerAssertionDocument, {
|
|
@@ -264,6 +286,54 @@ export class PortalAPI {
|
|
|
264
286
|
this.session.setToken(data.exchangeManagedPlayerAssertion.token);
|
|
265
287
|
return data.exchangeManagedPlayerAssertion;
|
|
266
288
|
}
|
|
289
|
+
// ----- Minecraft sign-in (Crowded Kingdoms' own apps) ------------------------
|
|
290
|
+
/**
|
|
291
|
+
* Start a Minecraft sign-in: a one-time server id for the app, good for two minutes. The
|
|
292
|
+
* Minecraft client joins it through Mojang's session service as the account signed in to
|
|
293
|
+
* the game (the request a client makes to join any online-mode server), then calls
|
|
294
|
+
* {@link signInWithMinecraft}. Ask for it yourself, and never join a server id something
|
|
295
|
+
* else hands you: whoever holds a joined server id can sign in as that account.
|
|
296
|
+
*
|
|
297
|
+
* Open only to Crowded Kingdoms' own apps: any other app is refused `FORBIDDEN`, and a
|
|
298
|
+
* tier without Minecraft sign-in `FEATURE_DISABLED`. Public; rate-limited per address.
|
|
299
|
+
* ck-api v2.60.0.
|
|
300
|
+
*/
|
|
301
|
+
async minecraftChallenge(appId) {
|
|
302
|
+
const data = await this.api.request(MinecraftChallengeDocument, { appId });
|
|
303
|
+
return data.minecraftChallenge;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Sign a Minecraft player in to one of Crowded Kingdoms' own apps, and store the app token
|
|
307
|
+
* (as {@link adoptAppToken} does). The API asks Mojang whether `username` joined with the
|
|
308
|
+
* challenge's `serverId` and admits the player only on a yes; the player is an org-managed
|
|
309
|
+
* player of the app's organization, identified by its Minecraft account, and refreshes
|
|
310
|
+
* with {@link refresh}. Public. ck-api v2.60.0.
|
|
311
|
+
*
|
|
312
|
+
* Refusals: `MINECRAFT_VERIFICATION_FAILED` (`minecraftVerificationFailedOf`, with the
|
|
313
|
+
* reason: start again from {@link minecraftChallenge}), `MINECRAFT_VERIFICATION_UNAVAILABLE`
|
|
314
|
+
* (`minecraftVerificationUnavailableOf`: Mojang did not answer; retry shortly), the player
|
|
315
|
+
* gate's ({@link mintAppToken}), `LEGAL_ACCEPTANCE_REQUIRED` when `acceptedDocuments` misses
|
|
316
|
+
* one (`legalAcceptanceRequiredOf` lists them), and `ORG_LEGAL_ACCEPTANCE_REQUIRED`.
|
|
317
|
+
*/
|
|
318
|
+
async signInWithMinecraft(params) {
|
|
319
|
+
const input = {
|
|
320
|
+
appId: params.appId,
|
|
321
|
+
username: params.username,
|
|
322
|
+
serverId: params.serverId,
|
|
323
|
+
birthDate: params.birthDate,
|
|
324
|
+
country: params.country,
|
|
325
|
+
acceptedDocuments: params.acceptedDocuments.map((doc) => ({
|
|
326
|
+
documentId: doc.documentId,
|
|
327
|
+
version: doc.version,
|
|
328
|
+
})),
|
|
329
|
+
...(params.parentalConfirmation !== undefined
|
|
330
|
+
? { parentalConfirmation: params.parentalConfirmation }
|
|
331
|
+
: {}),
|
|
332
|
+
};
|
|
333
|
+
const data = await this.api.request(SignInWithMinecraftDocument, { input });
|
|
334
|
+
this.session.setToken(data.signInWithMinecraft.token);
|
|
335
|
+
return data.signInWithMinecraft;
|
|
336
|
+
}
|
|
267
337
|
// ----- Consent + connected apps ------------------------------------------
|
|
268
338
|
/** Whether portaling into an app needs a consent prompt (Overworld side). */
|
|
269
339
|
async getConsent(appId) {
|