zyphr 0.1.37 → 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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -1
  3. data/docs/AuthOAuthApi.md +12 -12
  4. data/docs/AuthRegistrationApi.md +145 -1
  5. data/docs/AuthUserDirectoryApi.md +627 -0
  6. data/docs/AuthUserProfileApi.md +0 -76
  7. data/docs/InviteEndUserRequest.md +26 -0
  8. data/docs/OAuthProviderName.md +15 -0
  9. data/docs/SetEndUserClaimsRequest.md +18 -0
  10. data/docs/SignInAnonymouslyRequest.md +5 -1
  11. data/docs/SignInWithGameCenterRequest.md +28 -0
  12. data/docs/SignInWithGooglePlayGamesRequest.md +18 -0
  13. data/docs/UpdateEndUserByApplicationRequest.md +26 -0
  14. data/lib/zyphr/api/auth_o_auth_api.rb +12 -12
  15. data/lib/zyphr/api/auth_registration_api.rb +138 -2
  16. data/lib/zyphr/api/auth_user_directory_api.rb +560 -0
  17. data/lib/zyphr/api/auth_user_profile_api.rb +0 -61
  18. data/lib/zyphr/models/invite_end_user_request.rb +309 -0
  19. data/lib/zyphr/models/o_auth_provider_name.rb +43 -0
  20. data/lib/zyphr/models/set_end_user_claims_request.rb +220 -0
  21. data/lib/zyphr/models/sign_in_anonymously_request.rb +43 -4
  22. data/lib/zyphr/models/sign_in_with_game_center_request.rb +373 -0
  23. data/lib/zyphr/models/sign_in_with_google_play_games_request.rb +238 -0
  24. data/lib/zyphr/models/update_end_user_by_application_request.rb +256 -0
  25. data/lib/zyphr.rb +7 -0
  26. data/spec/api/auth_registration_api_spec.rb +25 -1
  27. data/spec/api/auth_user_directory_api_spec.rb +136 -0
  28. data/spec/api/auth_user_profile_api_spec.rb +0 -12
  29. data/spec/models/invite_end_user_request_spec.rb +64 -0
  30. data/spec/models/o_auth_provider_name_spec.rb +30 -0
  31. data/spec/models/set_end_user_claims_request_spec.rb +36 -0
  32. data/spec/models/sign_in_anonymously_request_spec.rb +12 -0
  33. data/spec/models/sign_in_with_game_center_request_spec.rb +66 -0
  34. data/spec/models/sign_in_with_google_play_games_request_spec.rb +36 -0
  35. data/spec/models/update_end_user_by_application_request_spec.rb +60 -0
  36. data/zyphr.gemspec +1 -1
  37. metadata +450 -422
@@ -5,7 +5,6 @@ All URIs are relative to *https://api.zyphr.dev/v1*
5
5
  | Method | HTTP request | Description |
6
6
  | ------ | ------------ | ----------- |
7
7
  | [**delete_end_user**](AuthUserProfileApi.md#delete_end_user) | **DELETE** /auth/users/me | Delete current end user account |
8
- | [**delete_end_user_by_application**](AuthUserProfileApi.md#delete_end_user_by_application) | **DELETE** /auth/users/{user_id} | Delete an end user (test environment only) |
9
8
  | [**get_end_user**](AuthUserProfileApi.md#get_end_user) | **GET** /auth/users/me | Get current end user profile |
10
9
  | [**update_end_user**](AuthUserProfileApi.md#update_end_user) | **PATCH** /auth/users/me | Update current end user profile |
11
10
 
@@ -81,81 +80,6 @@ This endpoint does not need any parameter.
81
80
  - **Accept**: application/json
82
81
 
83
82
 
84
- ## delete_end_user_by_application
85
-
86
- > delete_end_user_by_application(user_id)
87
-
88
- Delete an end user (test environment only)
89
-
90
- App-credentialed soft-delete for an end user, scoped to the test environment only. Live-mode credentials receive 403 — this is the intentional safety guard against a misconfigured CI runner nuking production users. Mirrors the self-service `DELETE /auth/users/me` flow: revokes all sessions, soft-deletes the row (status='deleted'), and emits a `user.deleted` webhook with `method='application_admin'`. The audit log row survives (no FK to end_users), so org-history queries still resolve. Intended for smoke / test-fixture cleanup. Production deletes should continue to use `DELETE /auth/users/me` from the end-user's own session or the dashboard.
91
-
92
- ### Examples
93
-
94
- ```ruby
95
- require 'time'
96
- require 'zyphr'
97
- # setup authorization
98
- Zyphr.configure do |config|
99
- # Configure API key authorization: ApplicationSecret
100
- config.api_key['X-Application-Secret'] = 'YOUR API KEY'
101
- # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
102
- # config.api_key_prefix['X-Application-Secret'] = 'Bearer'
103
-
104
- # Configure API key authorization: ApplicationPublicKey
105
- config.api_key['X-Application-Key'] = 'YOUR API KEY'
106
- # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
107
- # config.api_key_prefix['X-Application-Key'] = 'Bearer'
108
- end
109
-
110
- api_instance = Zyphr::AuthUserProfileApi.new
111
- user_id = '38400000-8cf0-11bd-b23e-10b96e4ef00d' # String |
112
-
113
- begin
114
- # Delete an end user (test environment only)
115
- api_instance.delete_end_user_by_application(user_id)
116
- rescue Zyphr::ApiError => e
117
- puts "Error when calling AuthUserProfileApi->delete_end_user_by_application: #{e}"
118
- end
119
- ```
120
-
121
- #### Using the delete_end_user_by_application_with_http_info variant
122
-
123
- This returns an Array which contains the response data (`nil` in this case), status code and headers.
124
-
125
- > <Array(nil, Integer, Hash)> delete_end_user_by_application_with_http_info(user_id)
126
-
127
- ```ruby
128
- begin
129
- # Delete an end user (test environment only)
130
- data, status_code, headers = api_instance.delete_end_user_by_application_with_http_info(user_id)
131
- p status_code # => 2xx
132
- p headers # => { ... }
133
- p data # => nil
134
- rescue Zyphr::ApiError => e
135
- puts "Error when calling AuthUserProfileApi->delete_end_user_by_application_with_http_info: #{e}"
136
- end
137
- ```
138
-
139
- ### Parameters
140
-
141
- | Name | Type | Description | Notes |
142
- | ---- | ---- | ----------- | ----- |
143
- | **user_id** | **String** | | |
144
-
145
- ### Return type
146
-
147
- nil (empty response body)
148
-
149
- ### Authorization
150
-
151
- [ApplicationSecret](../README.md#ApplicationSecret), [ApplicationPublicKey](../README.md#ApplicationPublicKey)
152
-
153
- ### HTTP request headers
154
-
155
- - **Content-Type**: Not defined
156
- - **Accept**: Not defined
157
-
158
-
159
83
  ## get_end_user
160
84
 
161
85
  > <AuthUserResponse> get_end_user
@@ -0,0 +1,26 @@
1
+ # Zyphr::InviteEndUserRequest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **email** | **String** | | |
8
+ | **name** | **String** | | [optional] |
9
+ | **metadata** | **Object** | | [optional] |
10
+ | **send_link** | **String** | | [optional][default to &#39;none&#39;] |
11
+ | **redirect_url** | **String** | | [optional] |
12
+
13
+ ## Example
14
+
15
+ ```ruby
16
+ require 'zyphr'
17
+
18
+ instance = Zyphr::InviteEndUserRequest.new(
19
+ email: null,
20
+ name: null,
21
+ metadata: null,
22
+ send_link: null,
23
+ redirect_url: null
24
+ )
25
+ ```
26
+
@@ -0,0 +1,15 @@
1
+ # Zyphr::OAuthProviderName
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+
8
+ ## Example
9
+
10
+ ```ruby
11
+ require 'zyphr'
12
+
13
+ instance = Zyphr::OAuthProviderName.new()
14
+ ```
15
+
@@ -0,0 +1,18 @@
1
+ # Zyphr::SetEndUserClaimsRequest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **claims** | **Object** | | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'zyphr'
13
+
14
+ instance = Zyphr::SetEndUserClaimsRequest.new(
15
+ claims: null
16
+ )
17
+ ```
18
+
@@ -7,6 +7,8 @@
7
7
  | **device_id** | **String** | Stable per-device identifier supplied by the client. Use a cryptographically-random opaque value persisted to client storage on first run. | |
8
8
  | **name** | **String** | Optional display name. If omitted, the user has no name until conversion. | [optional] |
9
9
  | **metadata** | **Hash&lt;String, Object&gt;** | | [optional] |
10
+ | **organization_id** | **String** | Optional organization to scope the anonymous user into. Must exist in the key&#39;s environment. When set, the returned token carries org_id and orgs. | [optional] |
11
+ | **organization_role** | **String** | Optional membership role for the org add. Requires organization_id. Opaque, up to 80 characters. | [optional] |
10
12
 
11
13
  ## Example
12
14
 
@@ -16,7 +18,9 @@ require 'zyphr'
16
18
  instance = Zyphr::SignInAnonymouslyRequest.new(
17
19
  device_id: null,
18
20
  name: null,
19
- metadata: null
21
+ metadata: null,
22
+ organization_id: null,
23
+ organization_role: null
20
24
  )
21
25
  ```
22
26
 
@@ -0,0 +1,28 @@
1
+ # Zyphr::SignInWithGameCenterRequest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **player_id** | **String** | The modern scoped gamePlayerID from GKLocalPlayer (NOT the deprecated legacy playerID). | |
8
+ | **public_key_url** | **String** | Apple-supplied URL to the public-key certificate. Must be https on an apple.com host; server-side SSRF-guarded before fetch. | |
9
+ | **signature** | **String** | Base64-encoded RSA signature returned by GameKit. | |
10
+ | **salt** | **String** | Base64-encoded salt bytes returned by GameKit. | |
11
+ | **timestamp** | **Float** | Apple-supplied timestamp (epoch milliseconds) returned by GameKit. | |
12
+ | **bundle_id** | **String** | The iOS bundle identifier the assertion was generated for. Must match a bundle id configured on the application&#39;s Game Center provider. | |
13
+
14
+ ## Example
15
+
16
+ ```ruby
17
+ require 'zyphr'
18
+
19
+ instance = Zyphr::SignInWithGameCenterRequest.new(
20
+ player_id: null,
21
+ public_key_url: null,
22
+ signature: null,
23
+ salt: null,
24
+ timestamp: null,
25
+ bundle_id: null
26
+ )
27
+ ```
28
+
@@ -0,0 +1,18 @@
1
+ # Zyphr::SignInWithGooglePlayGamesRequest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **server_auth_code** | **String** | The single-use server auth code from GamesSignInClient.requestServerSideAccess (obtained with the game&#39;s web/server client id). Zyphr exchanges it server-side; a client-supplied player id is neither accepted nor trusted. | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'zyphr'
13
+
14
+ instance = Zyphr::SignInWithGooglePlayGamesRequest.new(
15
+ server_auth_code: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,26 @@
1
+ # Zyphr::UpdateEndUserByApplicationRequest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **email** | **String** | | [optional] |
8
+ | **name** | **String** | | [optional] |
9
+ | **avatar_url** | **String** | | [optional] |
10
+ | **metadata** | **Object** | | [optional] |
11
+ | **status** | **String** | | [optional] |
12
+
13
+ ## Example
14
+
15
+ ```ruby
16
+ require 'zyphr'
17
+
18
+ instance = Zyphr::UpdateEndUserByApplicationRequest.new(
19
+ email: null,
20
+ name: null,
21
+ avatar_url: null,
22
+ metadata: null,
23
+ status: null
24
+ )
25
+ ```
26
+
@@ -21,7 +21,7 @@ module Zyphr
21
21
  end
22
22
  # Disconnect OAuth provider
23
23
  # Disconnect an OAuth provider from the current user.
24
- # @param provider [String] OAuth provider name
24
+ # @param provider [OAuthProviderName] OAuth provider name
25
25
  # @param [Hash] opts the optional parameters
26
26
  # @return [SuccessResult]
27
27
  def disconnect_o_auth_provider(provider, opts = {})
@@ -31,7 +31,7 @@ module Zyphr
31
31
 
32
32
  # Disconnect OAuth provider
33
33
  # Disconnect an OAuth provider from the current user.
34
- # @param provider [String] OAuth provider name
34
+ # @param provider [OAuthProviderName] OAuth provider name
35
35
  # @param [Hash] opts the optional parameters
36
36
  # @return [Array<(SuccessResult, Integer, Hash)>] SuccessResult data, response status code and response headers
37
37
  def disconnect_o_auth_provider_with_http_info(provider, opts = {})
@@ -84,7 +84,7 @@ module Zyphr
84
84
 
85
85
  # Get OAuth authorization URL
86
86
  # Generate an OAuth authorization URL for the specified provider.
87
- # @param provider [String] OAuth provider name
87
+ # @param provider [OAuthProviderName] OAuth provider name
88
88
  # @param redirect_uri [String] Redirect URI after authorization
89
89
  # @param [Hash] opts the optional parameters
90
90
  # @return [OAuthAuthorizationUrlResponse]
@@ -95,7 +95,7 @@ module Zyphr
95
95
 
96
96
  # Get OAuth authorization URL
97
97
  # Generate an OAuth authorization URL for the specified provider.
98
- # @param provider [String] OAuth provider name
98
+ # @param provider [OAuthProviderName] OAuth provider name
99
99
  # @param redirect_uri [String] Redirect URI after authorization
100
100
  # @param [Hash] opts the optional parameters
101
101
  # @return [Array<(OAuthAuthorizationUrlResponse, Integer, Hash)>] OAuthAuthorizationUrlResponse data, response status code and response headers
@@ -154,7 +154,7 @@ module Zyphr
154
154
 
155
155
  # Get OAuth connection info
156
156
  # Get OAuth connection info for a specific provider (without tokens). Safe for public key authentication.
157
- # @param provider [String] OAuth provider name
157
+ # @param provider [OAuthProviderName] OAuth provider name
158
158
  # @param [Hash] opts the optional parameters
159
159
  # @return [OAuthConnectionInfoResponse]
160
160
  def get_o_auth_connection_info(provider, opts = {})
@@ -164,7 +164,7 @@ module Zyphr
164
164
 
165
165
  # Get OAuth connection info
166
166
  # Get OAuth connection info for a specific provider (without tokens). Safe for public key authentication.
167
- # @param provider [String] OAuth provider name
167
+ # @param provider [OAuthProviderName] OAuth provider name
168
168
  # @param [Hash] opts the optional parameters
169
169
  # @return [Array<(OAuthConnectionInfoResponse, Integer, Hash)>] OAuthConnectionInfoResponse data, response status code and response headers
170
170
  def get_o_auth_connection_info_with_http_info(provider, opts = {})
@@ -217,7 +217,7 @@ module Zyphr
217
217
 
218
218
  # Get OAuth provider tokens
219
219
  # Get OAuth provider tokens for an end user. Requires secret key authentication (server-side only). This allows developers to access downstream APIs on behalf of their users.
220
- # @param provider [String] OAuth provider name
220
+ # @param provider [OAuthProviderName] OAuth provider name
221
221
  # @param user_id [String] End user ID
222
222
  # @param [Hash] opts the optional parameters
223
223
  # @return [OAuthTokensResponse]
@@ -228,7 +228,7 @@ module Zyphr
228
228
 
229
229
  # Get OAuth provider tokens
230
230
  # Get OAuth provider tokens for an end user. Requires secret key authentication (server-side only). This allows developers to access downstream APIs on behalf of their users.
231
- # @param provider [String] OAuth provider name
231
+ # @param provider [OAuthProviderName] OAuth provider name
232
232
  # @param user_id [String] End user ID
233
233
  # @param [Hash] opts the optional parameters
234
234
  # @return [Array<(OAuthTokensResponse, Integer, Hash)>] OAuthTokensResponse data, response status code and response headers
@@ -287,7 +287,7 @@ module Zyphr
287
287
 
288
288
  # Handle OAuth callback
289
289
  # Handle the OAuth callback by exchanging the authorization code for tokens and authenticating the user.
290
- # @param provider [String] OAuth provider name
290
+ # @param provider [OAuthProviderName] OAuth provider name
291
291
  # @param o_auth_callback_request [OAuthCallbackRequest]
292
292
  # @param [Hash] opts the optional parameters
293
293
  # @return [OAuthCallbackResponse]
@@ -298,7 +298,7 @@ module Zyphr
298
298
 
299
299
  # Handle OAuth callback
300
300
  # Handle the OAuth callback by exchanging the authorization code for tokens and authenticating the user.
301
- # @param provider [String] OAuth provider name
301
+ # @param provider [OAuthProviderName] OAuth provider name
302
302
  # @param o_auth_callback_request [OAuthCallbackRequest]
303
303
  # @param [Hash] opts the optional parameters
304
304
  # @return [Array<(OAuthCallbackResponse, Integer, Hash)>] OAuthCallbackResponse data, response status code and response headers
@@ -475,7 +475,7 @@ module Zyphr
475
475
 
476
476
  # Refresh OAuth provider tokens
477
477
  # Refresh OAuth provider tokens for an end user. Requires secret key authentication (server-side only). Only supported for providers that support token refresh (e.g., Google, Microsoft).
478
- # @param provider [String] OAuth provider name
478
+ # @param provider [OAuthProviderName] OAuth provider name
479
479
  # @param refresh_o_auth_tokens_request [RefreshOAuthTokensRequest]
480
480
  # @param [Hash] opts the optional parameters
481
481
  # @return [OAuthTokensRefreshResponse]
@@ -486,7 +486,7 @@ module Zyphr
486
486
 
487
487
  # Refresh OAuth provider tokens
488
488
  # Refresh OAuth provider tokens for an end user. Requires secret key authentication (server-side only). Only supported for providers that support token refresh (e.g., Google, Microsoft).
489
- # @param provider [String] OAuth provider name
489
+ # @param provider [OAuthProviderName] OAuth provider name
490
490
  # @param refresh_o_auth_tokens_request [RefreshOAuthTokensRequest]
491
491
  # @param [Hash] opts the optional parameters
492
492
  # @return [Array<(OAuthTokensRefreshResponse, Integer, Hash)>] OAuthTokensRefreshResponse data, response status code and response headers
@@ -156,7 +156,7 @@ module Zyphr
156
156
  end
157
157
 
158
158
  # Sign in anonymously
159
- # 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.
159
+ # 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.
160
160
  # @param sign_in_anonymously_request [SignInAnonymouslyRequest]
161
161
  # @param [Hash] opts the optional parameters
162
162
  # @return [AuthResultResponse]
@@ -166,7 +166,7 @@ module Zyphr
166
166
  end
167
167
 
168
168
  # Sign in anonymously
169
- # 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.
169
+ # 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 &#x60;organization_id&#x60; to create the anonymous user directly in an organization; the returned access token then carries &#x60;org_id&#x60; (and &#x60;orgs&#x60;), matching the org-scoped register/login flow.
170
170
  # @param sign_in_anonymously_request [SignInAnonymouslyRequest]
171
171
  # @param [Hash] opts the optional parameters
172
172
  # @return [Array<(AuthResultResponse, Integer, Hash)>] AuthResultResponse data, response status code and response headers
@@ -222,5 +222,141 @@ module Zyphr
222
222
  end
223
223
  return data, status_code, headers
224
224
  end
225
+
226
+ # Sign in with Apple Game Center
227
+ # 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.
228
+ # @param sign_in_with_game_center_request [SignInWithGameCenterRequest]
229
+ # @param [Hash] opts the optional parameters
230
+ # @return [AuthResultResponse]
231
+ def sign_in_with_game_center(sign_in_with_game_center_request, opts = {})
232
+ data, _status_code, _headers = sign_in_with_game_center_with_http_info(sign_in_with_game_center_request, opts)
233
+ data
234
+ end
235
+
236
+ # Sign in with Apple Game Center
237
+ # 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 &#x60;playerId&#x60; (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&#39;s &#x60;GKLocalPlayer.fetchItems(forIdentityVerificationSignature:)&#x60;, which returns &#x60;publicKeyURL&#x60;, &#x60;signature&#x60;, &#x60;salt&#x60;, and &#x60;timestamp&#x60;; combine those with the local player&#39;s &#x60;gamePlayerID&#x60; and the app&#39;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&#39;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 &#x60;401&#x60; &#x60;invalid_assertion&#x60; — the specific control that failed is never disclosed.
238
+ # @param sign_in_with_game_center_request [SignInWithGameCenterRequest]
239
+ # @param [Hash] opts the optional parameters
240
+ # @return [Array<(AuthResultResponse, Integer, Hash)>] AuthResultResponse data, response status code and response headers
241
+ def sign_in_with_game_center_with_http_info(sign_in_with_game_center_request, opts = {})
242
+ if @api_client.config.debugging
243
+ @api_client.config.logger.debug 'Calling API: AuthRegistrationApi.sign_in_with_game_center ...'
244
+ end
245
+ # verify the required parameter 'sign_in_with_game_center_request' is set
246
+ if @api_client.config.client_side_validation && sign_in_with_game_center_request.nil?
247
+ fail ArgumentError, "Missing the required parameter 'sign_in_with_game_center_request' when calling AuthRegistrationApi.sign_in_with_game_center"
248
+ end
249
+ # resource path
250
+ local_var_path = '/auth/game-center'
251
+
252
+ # query parameters
253
+ query_params = opts[:query_params] || {}
254
+
255
+ # header parameters
256
+ header_params = opts[:header_params] || {}
257
+ # HTTP header 'Accept' (if needed)
258
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
259
+ # HTTP header 'Content-Type'
260
+ content_type = @api_client.select_header_content_type(['application/json'])
261
+ if !content_type.nil?
262
+ header_params['Content-Type'] = content_type
263
+ end
264
+
265
+ # form parameters
266
+ form_params = opts[:form_params] || {}
267
+
268
+ # http body (model)
269
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(sign_in_with_game_center_request)
270
+
271
+ # return_type
272
+ return_type = opts[:debug_return_type] || 'AuthResultResponse'
273
+
274
+ # auth_names
275
+ auth_names = opts[:debug_auth_names] || ['ApplicationPublicKey']
276
+
277
+ new_options = opts.merge(
278
+ :operation => :"AuthRegistrationApi.sign_in_with_game_center",
279
+ :header_params => header_params,
280
+ :query_params => query_params,
281
+ :form_params => form_params,
282
+ :body => post_body,
283
+ :auth_names => auth_names,
284
+ :return_type => return_type
285
+ )
286
+
287
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
288
+ if @api_client.config.debugging
289
+ @api_client.config.logger.debug "API called: AuthRegistrationApi#sign_in_with_game_center\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
290
+ end
291
+ return data, status_code, headers
292
+ end
293
+
294
+ # Sign in with Google Play Games Services
295
+ # 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.
296
+ # @param sign_in_with_google_play_games_request [SignInWithGooglePlayGamesRequest]
297
+ # @param [Hash] opts the optional parameters
298
+ # @return [AuthResultResponse]
299
+ def sign_in_with_google_play_games(sign_in_with_google_play_games_request, opts = {})
300
+ data, _status_code, _headers = sign_in_with_google_play_games_with_http_info(sign_in_with_google_play_games_request, opts)
301
+ data
302
+ end
303
+
304
+ # Sign in with Google Play Games Services
305
+ # 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&#39;s OAuth2 token endpoint, then calls the Play Games REST API (&#x60;players/me&#x60;) server-side to obtain the trusted, tamper-proof &#x60;playerId&#x60;. The user is provisioned-or-looked-up on that server-fetched &#x60;playerId&#x60; 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 &#x60;GamesSignInClient.requestServerSideAccess(serverClientId, …)&#x60; 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 &#x60;serverAuthCode&#x60;. The **backend-relayed** shape is the common one: the app forwards the auth code to the customer&#39;s own backend, which relays it to this endpoint; the app never holds Zyphr keys. ## Security The &#x60;playerId&#x60; is derived **only** from Zyphr&#39;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 &#x60;401&#x60; &#x60;invalid_auth_code&#x60;; the specific control that failed is never disclosed.
306
+ # @param sign_in_with_google_play_games_request [SignInWithGooglePlayGamesRequest]
307
+ # @param [Hash] opts the optional parameters
308
+ # @return [Array<(AuthResultResponse, Integer, Hash)>] AuthResultResponse data, response status code and response headers
309
+ def sign_in_with_google_play_games_with_http_info(sign_in_with_google_play_games_request, opts = {})
310
+ if @api_client.config.debugging
311
+ @api_client.config.logger.debug 'Calling API: AuthRegistrationApi.sign_in_with_google_play_games ...'
312
+ end
313
+ # verify the required parameter 'sign_in_with_google_play_games_request' is set
314
+ if @api_client.config.client_side_validation && sign_in_with_google_play_games_request.nil?
315
+ fail ArgumentError, "Missing the required parameter 'sign_in_with_google_play_games_request' when calling AuthRegistrationApi.sign_in_with_google_play_games"
316
+ end
317
+ # resource path
318
+ local_var_path = '/auth/google-play-games'
319
+
320
+ # query parameters
321
+ query_params = opts[:query_params] || {}
322
+
323
+ # header parameters
324
+ header_params = opts[:header_params] || {}
325
+ # HTTP header 'Accept' (if needed)
326
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
327
+ # HTTP header 'Content-Type'
328
+ content_type = @api_client.select_header_content_type(['application/json'])
329
+ if !content_type.nil?
330
+ header_params['Content-Type'] = content_type
331
+ end
332
+
333
+ # form parameters
334
+ form_params = opts[:form_params] || {}
335
+
336
+ # http body (model)
337
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(sign_in_with_google_play_games_request)
338
+
339
+ # return_type
340
+ return_type = opts[:debug_return_type] || 'AuthResultResponse'
341
+
342
+ # auth_names
343
+ auth_names = opts[:debug_auth_names] || ['ApplicationPublicKey']
344
+
345
+ new_options = opts.merge(
346
+ :operation => :"AuthRegistrationApi.sign_in_with_google_play_games",
347
+ :header_params => header_params,
348
+ :query_params => query_params,
349
+ :form_params => form_params,
350
+ :body => post_body,
351
+ :auth_names => auth_names,
352
+ :return_type => return_type
353
+ )
354
+
355
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
356
+ if @api_client.config.debugging
357
+ @api_client.config.logger.debug "API called: AuthRegistrationApi#sign_in_with_google_play_games\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
358
+ end
359
+ return data, status_code, headers
360
+ end
225
361
  end
226
362
  end