@zyphr-dev/node-sdk 0.1.37 → 0.1.38

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.
@@ -20,6 +20,7 @@ import type {
20
20
  ConvertAnonymousUserRequest,
21
21
  RegisterRequest,
22
22
  SignInAnonymouslyRequest,
23
+ SignInWithGameCenterRequest,
23
24
  } from '../models/index';
24
25
  import {
25
26
  ApiErrorFromJSON,
@@ -32,6 +33,8 @@ import {
32
33
  RegisterRequestToJSON,
33
34
  SignInAnonymouslyRequestFromJSON,
34
35
  SignInAnonymouslyRequestToJSON,
36
+ SignInWithGameCenterRequestFromJSON,
37
+ SignInWithGameCenterRequestToJSON,
35
38
  } from '../models/index';
36
39
 
37
40
  export interface AuthRegistrationApiConvertAnonymousUserOperationRequest {
@@ -46,6 +49,10 @@ export interface AuthRegistrationApiSignInAnonymouslyOperationRequest {
46
49
  signInAnonymouslyRequest: SignInAnonymouslyRequest;
47
50
  }
48
51
 
52
+ export interface AuthRegistrationApiSignInWithGameCenterOperationRequest {
53
+ signInWithGameCenterRequest: SignInWithGameCenterRequest;
54
+ }
55
+
49
56
  /**
50
57
  * AuthRegistrationApi - interface
51
58
  *
@@ -86,7 +93,7 @@ export interface AuthRegistrationApiInterface {
86
93
  registerEndUser(registerRequest: RegisterRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthResultResponse>;
87
94
 
88
95
  /**
89
- * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
96
+ * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert. Pass an optional `organization_id` to create the anonymous user directly in an organization; the returned access token then carries `org_id` (and `orgs`), matching the org-scoped register/login flow.
90
97
  * @summary Sign in anonymously
91
98
  * @param {SignInAnonymouslyRequest} signInAnonymouslyRequest
92
99
  * @param {*} [options] Override http request option.
@@ -96,11 +103,27 @@ export interface AuthRegistrationApiInterface {
96
103
  signInAnonymouslyRaw(requestParameters: AuthRegistrationApiSignInAnonymouslyOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthResultResponse>>;
97
104
 
98
105
  /**
99
- * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
106
+ * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert. Pass an optional `organization_id` to create the anonymous user directly in an organization; the returned access token then carries `org_id` (and `orgs`), matching the org-scoped register/login flow.
100
107
  * Sign in anonymously
101
108
  */
102
109
  signInAnonymously(signInAnonymouslyRequest: SignInAnonymouslyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthResultResponse>;
103
110
 
111
+ /**
112
+ * Exchange an Apple Game Center identity-verification assertion for a Zyphr end-user session. Zyphr independently re-verifies the assertion server-side (Apple certificate chain, RSA-SHA256 signature, timestamp freshness, single-use replay guard, and bundle-id binding) before provisioning-or-looking-up the user and minting tokens. The user is keyed on the modern scoped `playerId` (gamePlayerID). ## Producing the assertion (Integration) The assertion is produced **on-device by the iOS app** — there is no server-side way to mint it. The app calls GameKit\'s `GKLocalPlayer.fetchItems(forIdentityVerificationSignature:)`, which returns `publicKeyURL`, `signature`, `salt`, and `timestamp`; combine those with the local player\'s `gamePlayerID` and the app\'s bundle identifier and submit them here. Two integration shapes are supported: - **client-direct** — the iOS app holds the Zyphr application public key and calls this endpoint itself. - **backend-relayed** — the app forwards the fetched assertion fields to the customer\'s own backend, which relays them to this endpoint; the app never holds Zyphr keys. (This is the common shape for games.) On any verification failure the response is a single opaque `401` `invalid_assertion` — the specific control that failed is never disclosed.
113
+ * @summary Sign in with Apple Game Center
114
+ * @param {SignInWithGameCenterRequest} signInWithGameCenterRequest
115
+ * @param {*} [options] Override http request option.
116
+ * @throws {RequiredError}
117
+ * @memberof AuthRegistrationApiInterface
118
+ */
119
+ signInWithGameCenterRaw(requestParameters: AuthRegistrationApiSignInWithGameCenterOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthResultResponse>>;
120
+
121
+ /**
122
+ * Exchange an Apple Game Center identity-verification assertion for a Zyphr end-user session. Zyphr independently re-verifies the assertion server-side (Apple certificate chain, RSA-SHA256 signature, timestamp freshness, single-use replay guard, and bundle-id binding) before provisioning-or-looking-up the user and minting tokens. The user is keyed on the modern scoped `playerId` (gamePlayerID). ## Producing the assertion (Integration) The assertion is produced **on-device by the iOS app** — there is no server-side way to mint it. The app calls GameKit\'s `GKLocalPlayer.fetchItems(forIdentityVerificationSignature:)`, which returns `publicKeyURL`, `signature`, `salt`, and `timestamp`; combine those with the local player\'s `gamePlayerID` and the app\'s bundle identifier and submit them here. Two integration shapes are supported: - **client-direct** — the iOS app holds the Zyphr application public key and calls this endpoint itself. - **backend-relayed** — the app forwards the fetched assertion fields to the customer\'s own backend, which relays them to this endpoint; the app never holds Zyphr keys. (This is the common shape for games.) On any verification failure the response is a single opaque `401` `invalid_assertion` — the specific control that failed is never disclosed.
123
+ * Sign in with Apple Game Center
124
+ */
125
+ signInWithGameCenter(signInWithGameCenterRequest: SignInWithGameCenterRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthResultResponse>;
126
+
104
127
  }
105
128
 
106
129
  /**
@@ -193,7 +216,7 @@ export class AuthRegistrationApi extends runtime.BaseAPI implements AuthRegistra
193
216
  }
194
217
 
195
218
  /**
196
- * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
219
+ * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert. Pass an optional `organization_id` to create the anonymous user directly in an organization; the returned access token then carries `org_id` (and `orgs`), matching the org-scoped register/login flow.
197
220
  * Sign in anonymously
198
221
  */
199
222
  async signInAnonymouslyRaw(requestParameters: AuthRegistrationApiSignInAnonymouslyOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthResultResponse>> {
@@ -226,7 +249,7 @@ export class AuthRegistrationApi extends runtime.BaseAPI implements AuthRegistra
226
249
  }
227
250
 
228
251
  /**
229
- * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
252
+ * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert. Pass an optional `organization_id` to create the anonymous user directly in an organization; the returned access token then carries `org_id` (and `orgs`), matching the org-scoped register/login flow.
230
253
  * Sign in anonymously
231
254
  */
232
255
  async signInAnonymously(signInAnonymouslyRequest: SignInAnonymouslyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthResultResponse> {
@@ -234,4 +257,46 @@ export class AuthRegistrationApi extends runtime.BaseAPI implements AuthRegistra
234
257
  return await response.value();
235
258
  }
236
259
 
260
+ /**
261
+ * Exchange an Apple Game Center identity-verification assertion for a Zyphr end-user session. Zyphr independently re-verifies the assertion server-side (Apple certificate chain, RSA-SHA256 signature, timestamp freshness, single-use replay guard, and bundle-id binding) before provisioning-or-looking-up the user and minting tokens. The user is keyed on the modern scoped `playerId` (gamePlayerID). ## Producing the assertion (Integration) The assertion is produced **on-device by the iOS app** — there is no server-side way to mint it. The app calls GameKit\'s `GKLocalPlayer.fetchItems(forIdentityVerificationSignature:)`, which returns `publicKeyURL`, `signature`, `salt`, and `timestamp`; combine those with the local player\'s `gamePlayerID` and the app\'s bundle identifier and submit them here. Two integration shapes are supported: - **client-direct** — the iOS app holds the Zyphr application public key and calls this endpoint itself. - **backend-relayed** — the app forwards the fetched assertion fields to the customer\'s own backend, which relays them to this endpoint; the app never holds Zyphr keys. (This is the common shape for games.) On any verification failure the response is a single opaque `401` `invalid_assertion` — the specific control that failed is never disclosed.
262
+ * Sign in with Apple Game Center
263
+ */
264
+ async signInWithGameCenterRaw(requestParameters: AuthRegistrationApiSignInWithGameCenterOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthResultResponse>> {
265
+ if (requestParameters['signInWithGameCenterRequest'] == null) {
266
+ throw new runtime.RequiredError(
267
+ 'signInWithGameCenterRequest',
268
+ 'Required parameter "signInWithGameCenterRequest" was null or undefined when calling signInWithGameCenter().'
269
+ );
270
+ }
271
+
272
+ const queryParameters: any = {};
273
+
274
+ const headerParameters: runtime.HTTPHeaders = {};
275
+
276
+ headerParameters['Content-Type'] = 'application/json';
277
+
278
+ if (this.configuration && this.configuration.apiKey) {
279
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
280
+ }
281
+
282
+ const response = await this.request({
283
+ path: `/auth/game-center`,
284
+ method: 'POST',
285
+ headers: headerParameters,
286
+ query: queryParameters,
287
+ body: SignInWithGameCenterRequestToJSON(requestParameters['signInWithGameCenterRequest']),
288
+ }, initOverrides);
289
+
290
+ return new runtime.JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
291
+ }
292
+
293
+ /**
294
+ * Exchange an Apple Game Center identity-verification assertion for a Zyphr end-user session. Zyphr independently re-verifies the assertion server-side (Apple certificate chain, RSA-SHA256 signature, timestamp freshness, single-use replay guard, and bundle-id binding) before provisioning-or-looking-up the user and minting tokens. The user is keyed on the modern scoped `playerId` (gamePlayerID). ## Producing the assertion (Integration) The assertion is produced **on-device by the iOS app** — there is no server-side way to mint it. The app calls GameKit\'s `GKLocalPlayer.fetchItems(forIdentityVerificationSignature:)`, which returns `publicKeyURL`, `signature`, `salt`, and `timestamp`; combine those with the local player\'s `gamePlayerID` and the app\'s bundle identifier and submit them here. Two integration shapes are supported: - **client-direct** — the iOS app holds the Zyphr application public key and calls this endpoint itself. - **backend-relayed** — the app forwards the fetched assertion fields to the customer\'s own backend, which relays them to this endpoint; the app never holds Zyphr keys. (This is the common shape for games.) On any verification failure the response is a single opaque `401` `invalid_assertion` — the specific control that failed is never disclosed.
295
+ * Sign in with Apple Game Center
296
+ */
297
+ async signInWithGameCenter(signInWithGameCenterRequest: SignInWithGameCenterRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthResultResponse> {
298
+ const response = await this.signInWithGameCenterRaw({ signInWithGameCenterRequest: signInWithGameCenterRequest }, initOverrides);
299
+ return await response.value();
300
+ }
301
+
237
302
  }