@zyphr-dev/node-sdk 0.1.38 → 0.1.39
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/dist/index.cjs +72 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -1
- package/dist/index.d.ts +61 -1
- package/dist/index.js +67 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/.openapi-generator/FILES +1 -0
- package/src/src/apis/AuthRegistrationApi.ts +65 -0
- package/src/src/models/SignInWithGooglePlayGamesRequest.ts +66 -0
- package/src/src/models/index.ts +1 -0
package/dist/index.cjs
CHANGED
|
@@ -1228,6 +1228,10 @@ __export(index_exports, {
|
|
|
1228
1228
|
SignInWithGameCenterRequestFromJSONTyped: () => SignInWithGameCenterRequestFromJSONTyped,
|
|
1229
1229
|
SignInWithGameCenterRequestToJSON: () => SignInWithGameCenterRequestToJSON,
|
|
1230
1230
|
SignInWithGameCenterRequestToJSONTyped: () => SignInWithGameCenterRequestToJSONTyped,
|
|
1231
|
+
SignInWithGooglePlayGamesRequestFromJSON: () => SignInWithGooglePlayGamesRequestFromJSON,
|
|
1232
|
+
SignInWithGooglePlayGamesRequestFromJSONTyped: () => SignInWithGooglePlayGamesRequestFromJSONTyped,
|
|
1233
|
+
SignInWithGooglePlayGamesRequestToJSON: () => SignInWithGooglePlayGamesRequestToJSON,
|
|
1234
|
+
SignInWithGooglePlayGamesRequestToJSONTyped: () => SignInWithGooglePlayGamesRequestToJSONTyped,
|
|
1231
1235
|
SlackApi: () => SlackApi,
|
|
1232
1236
|
SlackMessageFromJSON: () => SlackMessageFromJSON,
|
|
1233
1237
|
SlackMessageFromJSONTyped: () => SlackMessageFromJSONTyped,
|
|
@@ -2172,6 +2176,7 @@ __export(index_exports, {
|
|
|
2172
2176
|
instanceOfSetPreferencesRequestPreferencesInner: () => instanceOfSetPreferencesRequestPreferencesInner,
|
|
2173
2177
|
instanceOfSignInAnonymouslyRequest: () => instanceOfSignInAnonymouslyRequest,
|
|
2174
2178
|
instanceOfSignInWithGameCenterRequest: () => instanceOfSignInWithGameCenterRequest,
|
|
2179
|
+
instanceOfSignInWithGooglePlayGamesRequest: () => instanceOfSignInWithGooglePlayGamesRequest,
|
|
2175
2180
|
instanceOfSlackMessage: () => instanceOfSlackMessage,
|
|
2176
2181
|
instanceOfSlackMessageListResponse: () => instanceOfSlackMessageListResponse,
|
|
2177
2182
|
instanceOfSlackMessageListResponseMeta: () => instanceOfSlackMessageListResponseMeta,
|
|
@@ -12623,6 +12628,34 @@ function SignInWithGameCenterRequestToJSONTyped(value, ignoreDiscriminator = fal
|
|
|
12623
12628
|
};
|
|
12624
12629
|
}
|
|
12625
12630
|
|
|
12631
|
+
// src/src/models/SignInWithGooglePlayGamesRequest.ts
|
|
12632
|
+
function instanceOfSignInWithGooglePlayGamesRequest(value) {
|
|
12633
|
+
if (!("serverAuthCode" in value) || value["serverAuthCode"] === void 0) return false;
|
|
12634
|
+
return true;
|
|
12635
|
+
}
|
|
12636
|
+
function SignInWithGooglePlayGamesRequestFromJSON(json) {
|
|
12637
|
+
return SignInWithGooglePlayGamesRequestFromJSONTyped(json, false);
|
|
12638
|
+
}
|
|
12639
|
+
function SignInWithGooglePlayGamesRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
12640
|
+
if (json == null) {
|
|
12641
|
+
return json;
|
|
12642
|
+
}
|
|
12643
|
+
return {
|
|
12644
|
+
"serverAuthCode": json["serverAuthCode"]
|
|
12645
|
+
};
|
|
12646
|
+
}
|
|
12647
|
+
function SignInWithGooglePlayGamesRequestToJSON(json) {
|
|
12648
|
+
return SignInWithGooglePlayGamesRequestToJSONTyped(json, false);
|
|
12649
|
+
}
|
|
12650
|
+
function SignInWithGooglePlayGamesRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
12651
|
+
if (value == null) {
|
|
12652
|
+
return value;
|
|
12653
|
+
}
|
|
12654
|
+
return {
|
|
12655
|
+
"serverAuthCode": value["serverAuthCode"]
|
|
12656
|
+
};
|
|
12657
|
+
}
|
|
12658
|
+
|
|
12626
12659
|
// src/src/models/SlackMessage.ts
|
|
12627
12660
|
function instanceOfSlackMessage(value) {
|
|
12628
12661
|
return true;
|
|
@@ -19265,6 +19298,40 @@ var AuthRegistrationApi = class extends BaseAPI {
|
|
|
19265
19298
|
const response = await this.signInWithGameCenterRaw({ signInWithGameCenterRequest }, initOverrides);
|
|
19266
19299
|
return await response.value();
|
|
19267
19300
|
}
|
|
19301
|
+
/**
|
|
19302
|
+
* Exchange a Google Play Games Services (GPGS) **server auth code** for a Zyphr end-user session. Unlike Game Center (which submits an Apple-signed assertion), GPGS is verified by Google: Zyphr exchanges the single-use server auth code at Google\'s OAuth2 token endpoint, then calls the Play Games REST API (`players/me`) server-side to obtain the trusted, tamper-proof `playerId`. The user is provisioned-or-looked-up on that server-fetched `playerId` and tokens are minted. ## Producing the server auth code (Integration) The server auth code is obtained **on-device by the Android app** — there is no server-side way to mint it. The app calls `GamesSignInClient.requestServerSideAccess(serverClientId, …)` using the Google Cloud **web (server) client id** configured for the game, which returns a single-use auth code string. Submit that string here as `serverAuthCode`. The **backend-relayed** shape is the common one: the app forwards the auth code to the customer\'s own backend, which relays it to this endpoint; the app never holds Zyphr keys. ## Security The `playerId` is derived **only** from Zyphr\'s own server-side call to Google after the token exchange — a client-supplied player id is never accepted or trusted. On any verification failure the response is a single opaque `401` `invalid_auth_code`; the specific control that failed is never disclosed.
|
|
19303
|
+
* Sign in with Google Play Games Services
|
|
19304
|
+
*/
|
|
19305
|
+
async signInWithGooglePlayGamesRaw(requestParameters, initOverrides) {
|
|
19306
|
+
if (requestParameters["signInWithGooglePlayGamesRequest"] == null) {
|
|
19307
|
+
throw new RequiredError(
|
|
19308
|
+
"signInWithGooglePlayGamesRequest",
|
|
19309
|
+
'Required parameter "signInWithGooglePlayGamesRequest" was null or undefined when calling signInWithGooglePlayGames().'
|
|
19310
|
+
);
|
|
19311
|
+
}
|
|
19312
|
+
const queryParameters = {};
|
|
19313
|
+
const headerParameters = {};
|
|
19314
|
+
headerParameters["Content-Type"] = "application/json";
|
|
19315
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19316
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
19317
|
+
}
|
|
19318
|
+
const response = await this.request({
|
|
19319
|
+
path: `/auth/google-play-games`,
|
|
19320
|
+
method: "POST",
|
|
19321
|
+
headers: headerParameters,
|
|
19322
|
+
query: queryParameters,
|
|
19323
|
+
body: SignInWithGooglePlayGamesRequestToJSON(requestParameters["signInWithGooglePlayGamesRequest"])
|
|
19324
|
+
}, initOverrides);
|
|
19325
|
+
return new JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
|
|
19326
|
+
}
|
|
19327
|
+
/**
|
|
19328
|
+
* Exchange a Google Play Games Services (GPGS) **server auth code** for a Zyphr end-user session. Unlike Game Center (which submits an Apple-signed assertion), GPGS is verified by Google: Zyphr exchanges the single-use server auth code at Google\'s OAuth2 token endpoint, then calls the Play Games REST API (`players/me`) server-side to obtain the trusted, tamper-proof `playerId`. The user is provisioned-or-looked-up on that server-fetched `playerId` and tokens are minted. ## Producing the server auth code (Integration) The server auth code is obtained **on-device by the Android app** — there is no server-side way to mint it. The app calls `GamesSignInClient.requestServerSideAccess(serverClientId, …)` using the Google Cloud **web (server) client id** configured for the game, which returns a single-use auth code string. Submit that string here as `serverAuthCode`. The **backend-relayed** shape is the common one: the app forwards the auth code to the customer\'s own backend, which relays it to this endpoint; the app never holds Zyphr keys. ## Security The `playerId` is derived **only** from Zyphr\'s own server-side call to Google after the token exchange — a client-supplied player id is never accepted or trusted. On any verification failure the response is a single opaque `401` `invalid_auth_code`; the specific control that failed is never disclosed.
|
|
19329
|
+
* Sign in with Google Play Games Services
|
|
19330
|
+
*/
|
|
19331
|
+
async signInWithGooglePlayGames(signInWithGooglePlayGamesRequest, initOverrides) {
|
|
19332
|
+
const response = await this.signInWithGooglePlayGamesRaw({ signInWithGooglePlayGamesRequest }, initOverrides);
|
|
19333
|
+
return await response.value();
|
|
19334
|
+
}
|
|
19268
19335
|
};
|
|
19269
19336
|
|
|
19270
19337
|
// src/src/apis/AuthSessionsApi.ts
|
|
@@ -27415,6 +27482,10 @@ var SDK_VERSION = "0.1.0";
|
|
|
27415
27482
|
SignInWithGameCenterRequestFromJSONTyped,
|
|
27416
27483
|
SignInWithGameCenterRequestToJSON,
|
|
27417
27484
|
SignInWithGameCenterRequestToJSONTyped,
|
|
27485
|
+
SignInWithGooglePlayGamesRequestFromJSON,
|
|
27486
|
+
SignInWithGooglePlayGamesRequestFromJSONTyped,
|
|
27487
|
+
SignInWithGooglePlayGamesRequestToJSON,
|
|
27488
|
+
SignInWithGooglePlayGamesRequestToJSONTyped,
|
|
27418
27489
|
SlackApi,
|
|
27419
27490
|
SlackMessageFromJSON,
|
|
27420
27491
|
SlackMessageFromJSONTyped,
|
|
@@ -28359,6 +28430,7 @@ var SDK_VERSION = "0.1.0";
|
|
|
28359
28430
|
instanceOfSetPreferencesRequestPreferencesInner,
|
|
28360
28431
|
instanceOfSignInAnonymouslyRequest,
|
|
28361
28432
|
instanceOfSignInWithGameCenterRequest,
|
|
28433
|
+
instanceOfSignInWithGooglePlayGamesRequest,
|
|
28362
28434
|
instanceOfSlackMessage,
|
|
28363
28435
|
instanceOfSlackMessageListResponse,
|
|
28364
28436
|
instanceOfSlackMessageListResponseMeta,
|