@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.js
CHANGED
|
@@ -10291,6 +10291,34 @@ function SignInWithGameCenterRequestToJSONTyped(value, ignoreDiscriminator = fal
|
|
|
10291
10291
|
};
|
|
10292
10292
|
}
|
|
10293
10293
|
|
|
10294
|
+
// src/src/models/SignInWithGooglePlayGamesRequest.ts
|
|
10295
|
+
function instanceOfSignInWithGooglePlayGamesRequest(value) {
|
|
10296
|
+
if (!("serverAuthCode" in value) || value["serverAuthCode"] === void 0) return false;
|
|
10297
|
+
return true;
|
|
10298
|
+
}
|
|
10299
|
+
function SignInWithGooglePlayGamesRequestFromJSON(json) {
|
|
10300
|
+
return SignInWithGooglePlayGamesRequestFromJSONTyped(json, false);
|
|
10301
|
+
}
|
|
10302
|
+
function SignInWithGooglePlayGamesRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
10303
|
+
if (json == null) {
|
|
10304
|
+
return json;
|
|
10305
|
+
}
|
|
10306
|
+
return {
|
|
10307
|
+
"serverAuthCode": json["serverAuthCode"]
|
|
10308
|
+
};
|
|
10309
|
+
}
|
|
10310
|
+
function SignInWithGooglePlayGamesRequestToJSON(json) {
|
|
10311
|
+
return SignInWithGooglePlayGamesRequestToJSONTyped(json, false);
|
|
10312
|
+
}
|
|
10313
|
+
function SignInWithGooglePlayGamesRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
10314
|
+
if (value == null) {
|
|
10315
|
+
return value;
|
|
10316
|
+
}
|
|
10317
|
+
return {
|
|
10318
|
+
"serverAuthCode": value["serverAuthCode"]
|
|
10319
|
+
};
|
|
10320
|
+
}
|
|
10321
|
+
|
|
10294
10322
|
// src/src/models/SlackMessage.ts
|
|
10295
10323
|
function instanceOfSlackMessage(value) {
|
|
10296
10324
|
return true;
|
|
@@ -16933,6 +16961,40 @@ var AuthRegistrationApi = class extends BaseAPI {
|
|
|
16933
16961
|
const response = await this.signInWithGameCenterRaw({ signInWithGameCenterRequest }, initOverrides);
|
|
16934
16962
|
return await response.value();
|
|
16935
16963
|
}
|
|
16964
|
+
/**
|
|
16965
|
+
* 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.
|
|
16966
|
+
* Sign in with Google Play Games Services
|
|
16967
|
+
*/
|
|
16968
|
+
async signInWithGooglePlayGamesRaw(requestParameters, initOverrides) {
|
|
16969
|
+
if (requestParameters["signInWithGooglePlayGamesRequest"] == null) {
|
|
16970
|
+
throw new RequiredError(
|
|
16971
|
+
"signInWithGooglePlayGamesRequest",
|
|
16972
|
+
'Required parameter "signInWithGooglePlayGamesRequest" was null or undefined when calling signInWithGooglePlayGames().'
|
|
16973
|
+
);
|
|
16974
|
+
}
|
|
16975
|
+
const queryParameters = {};
|
|
16976
|
+
const headerParameters = {};
|
|
16977
|
+
headerParameters["Content-Type"] = "application/json";
|
|
16978
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
16979
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
16980
|
+
}
|
|
16981
|
+
const response = await this.request({
|
|
16982
|
+
path: `/auth/google-play-games`,
|
|
16983
|
+
method: "POST",
|
|
16984
|
+
headers: headerParameters,
|
|
16985
|
+
query: queryParameters,
|
|
16986
|
+
body: SignInWithGooglePlayGamesRequestToJSON(requestParameters["signInWithGooglePlayGamesRequest"])
|
|
16987
|
+
}, initOverrides);
|
|
16988
|
+
return new JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
|
|
16989
|
+
}
|
|
16990
|
+
/**
|
|
16991
|
+
* 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.
|
|
16992
|
+
* Sign in with Google Play Games Services
|
|
16993
|
+
*/
|
|
16994
|
+
async signInWithGooglePlayGames(signInWithGooglePlayGamesRequest, initOverrides) {
|
|
16995
|
+
const response = await this.signInWithGooglePlayGamesRaw({ signInWithGooglePlayGamesRequest }, initOverrides);
|
|
16996
|
+
return await response.value();
|
|
16997
|
+
}
|
|
16936
16998
|
};
|
|
16937
16999
|
|
|
16938
17000
|
// src/src/apis/AuthSessionsApi.ts
|
|
@@ -25082,6 +25144,10 @@ export {
|
|
|
25082
25144
|
SignInWithGameCenterRequestFromJSONTyped,
|
|
25083
25145
|
SignInWithGameCenterRequestToJSON,
|
|
25084
25146
|
SignInWithGameCenterRequestToJSONTyped,
|
|
25147
|
+
SignInWithGooglePlayGamesRequestFromJSON,
|
|
25148
|
+
SignInWithGooglePlayGamesRequestFromJSONTyped,
|
|
25149
|
+
SignInWithGooglePlayGamesRequestToJSON,
|
|
25150
|
+
SignInWithGooglePlayGamesRequestToJSONTyped,
|
|
25085
25151
|
SlackApi,
|
|
25086
25152
|
SlackMessageFromJSON,
|
|
25087
25153
|
SlackMessageFromJSONTyped,
|
|
@@ -26026,6 +26092,7 @@ export {
|
|
|
26026
26092
|
instanceOfSetPreferencesRequestPreferencesInner,
|
|
26027
26093
|
instanceOfSignInAnonymouslyRequest,
|
|
26028
26094
|
instanceOfSignInWithGameCenterRequest,
|
|
26095
|
+
instanceOfSignInWithGooglePlayGamesRequest,
|
|
26029
26096
|
instanceOfSlackMessage,
|
|
26030
26097
|
instanceOfSlackMessageListResponse,
|
|
26031
26098
|
instanceOfSlackMessageListResponseMeta,
|