@tinyburg/pocket-trains-sdk 0.0.0-stage → 0.1.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/README.md CHANGED
@@ -1,3 +1,9 @@
1
- # Temporary Holding Version
1
+ # @tinyburg/pocket-trains-sdk
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Pocket Trains api, for the authproxy.
4
+
5
+ Pocket Trains speaks Nimblebit's NBSync protocol under the game code `pt`. Requests
6
+ are signed with `NimblebitAuth` from `@tinyburg/nimblebit-sdk`, using the
7
+ game's own secret salt, and the endpoints carry the `pockettrains` scope tree
8
+ built by `defineGame`. Game-specific save and meta payloads are still
9
+ `Schema.Unknown`.
@@ -0,0 +1,201 @@
1
+ /**
2
+ * Pocket Trains (game code `pt`) NBSync api endpoints.
3
+ *
4
+ * Signing: a random `salt` (signed int32) goes in the path, and `hash` is
5
+ * `md5(<preimage> + <game secret salt>)` with the preimage
6
+ * `pt/<playerId>/<salt><playerAuthKey>` (variants noted per endpoint). The
7
+ * secret salt is the value extracted from `NBSync._ss`.
8
+ *
9
+ * Verification (live server + Frida DTO inspection of the game, 2026-08-26):
10
+ * - Signing is MD5, server-validated (same scheme as Tiny Tower / Pocket
11
+ * Planes; the game computes SHA-256 only for the unauthenticated `register`).
12
+ * - Response envelopes VERIFIED by reading the game's DTO classes at runtime:
13
+ * register, player_details, sync/pull (NBSyncGameSaveResponse), current_version,
14
+ * verify_device, friend/pull_game, friend/pull_meta (meta is a flat
15
+ * Dictionary<String,Object> on pt), send_item (NBSyncItemsSendResponse),
16
+ * get_items (NBSyncItemsGetResponse: success/gifts, NO `total` unlike pp).
17
+ * `get_items` was also exercised live with a burnbot.
18
+ * - pt-specific gifting: `get_gifts_pt` -> NBSyncGetPTGiftResponse with
19
+ * NBSyncGetPTGift elements, plus a gift-id flow (NBSyncGetGiftIDResponse,
20
+ * `friend/pull_meta_gift_id`). The get_gifts_pt REQUEST params are UNCONFIRMED
21
+ * (the tried `/get_gifts_pt/pt/:playerId/:salt/:hash` form was rejected), so
22
+ * that endpoint is marked accordingly.
23
+ *
24
+ * Game-specific save/meta schemas are left as `Schema.Unknown` placeholders.
25
+ *
26
+ * @since 1.0.0
27
+ * @category Endpoints
28
+ */
29
+ import { HttpApi, HttpApiEndpoint, HttpApiError, HttpApiGroup } from "effect/http-api";
30
+ import * as Schema from "effect/Schema";
31
+ /**
32
+ * A gift/item in the general item channel (get_items / send_item). Verified DTO
33
+ * NBSyncItemsGift on pt: `{gift_id, gift_to, gift_from, gift_type, item_type,
34
+ * gift_str, h}` (no `c`, unlike pp). Left open for the data-schema work.
35
+ *
36
+ * @since 1.0.0
37
+ * @category Schemas
38
+ */
39
+ export declare const Gift: Schema.Unknown;
40
+ /**
41
+ * A Pocket Trains gift (get_gifts_pt channel). Verified DTO NBSyncGetPTGift:
42
+ * `{gift_id, gift_to, gift_from, alt_id, gift_type, gift_str: int, gift_quantity:
43
+ * int, h}`. Left open for the data-schema work.
44
+ *
45
+ * @since 1.0.0
46
+ * @category Schemas
47
+ */
48
+ export declare const PTGift: Schema.Unknown;
49
+ /**
50
+ * The Pocket Trains NBSync api.
51
+ *
52
+ * @since 1.0.0
53
+ * @category Api
54
+ */
55
+ export declare const Api: HttpApi.HttpApi<"PocketTrainsApi", HttpApiGroup.HttpApiGroup<"DeviceManagementGroup", HttpApiEndpoint.HttpApiEndpoint<"DeviceNewPlayer", "GET", "/register/pt/:salt1/:salt2/:hash", Schema.toCodecStringTree<Schema.Struct<{
56
+ salt1: Schema.Int;
57
+ salt2: Schema.Int;
58
+ hash: Schema.String;
59
+ }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
60
+ readonly error: Schema.String;
61
+ }> | Schema.encodeKeys<Schema.Struct<{
62
+ readonly playerId: Schema.brand<Schema.String, "PlayerId">;
63
+ readonly playerSs: Schema.brand<Schema.RedactedFromValue<Schema.String>, "PlayerAuthKey">;
64
+ }>, {
65
+ readonly playerId: "player_id";
66
+ readonly playerSs: "player_ss";
67
+ }>>, Schema.toCodecJson<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"DevicePlayerDetails", "GET", "/player_details/pt/:playerId/:salt/:hash", Schema.toCodecStringTree<Schema.Struct<{
68
+ playerId: Schema.brand<Schema.String, "PlayerId">;
69
+ salt: Schema.Int;
70
+ hash: Schema.String;
71
+ }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
72
+ readonly error: Schema.String;
73
+ }> | Schema.Struct<{
74
+ readonly success: Schema.Literal<"Found">;
75
+ readonly player: Schema.encodeKeys<Schema.Struct<{
76
+ readonly playerId: Schema.brand<Schema.String, "PlayerId">;
77
+ readonly playerEmail: Schema.brand<Schema.RedactedFromValue<Schema.String>, "PlayerEmail">;
78
+ readonly registered: Schema.compose<Schema.BooleanFromBit, Schema.NumberFromString>;
79
+ readonly blacklisted: Schema.compose<Schema.BooleanFromBit, Schema.NumberFromString>;
80
+ readonly saveVersion: Schema.compose<Schema.Int, Schema.NumberFromString>;
81
+ readonly checksum: Schema.String;
82
+ }>, {
83
+ readonly playerId: "player_id";
84
+ readonly playerEmail: "email";
85
+ readonly checksum: "h";
86
+ }>;
87
+ }>>, Schema.toCodecJson<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"DeviceVerifyDevice", "GET", "/verify_device/pt/:playerId/:verificationCode", Schema.toCodecStringTree<Schema.Struct<{
88
+ playerId: Schema.brand<Schema.String, "PlayerId">;
89
+ verificationCode: Schema.String;
90
+ }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
91
+ readonly error: Schema.String;
92
+ }> | Schema.encodeKeys<Schema.Struct<{
93
+ readonly success: Schema.Literal<"NewDevice">;
94
+ readonly playerId: Schema.brand<Schema.String, "PlayerId">;
95
+ readonly playerAuthKey: Schema.brand<Schema.RedactedFromValue<Schema.String>, "PlayerAuthKey">;
96
+ readonly playerEmail: Schema.brand<Schema.RedactedFromValue<Schema.String>, "PlayerEmail">;
97
+ }>, {
98
+ readonly playerId: "player_id";
99
+ readonly playerAuthKey: "player_ss";
100
+ readonly playerEmail: "player_email";
101
+ }>>, Schema.toCodecJson<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never>, false> | HttpApiGroup.HttpApiGroup<"SocialGroup", HttpApiEndpoint.HttpApiEndpoint<"SocialGetGiftsPt", "GET", "/get_gifts_pt/pt/:playerId/:salt/:hash", Schema.toCodecStringTree<Schema.Struct<{
102
+ playerId: Schema.brand<Schema.String, "PlayerId">;
103
+ salt: Schema.Int;
104
+ hash: Schema.String;
105
+ }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
106
+ readonly error: Schema.String;
107
+ }> | Schema.Struct<{
108
+ readonly success: Schema.Literal<"NotFound">;
109
+ }> | Schema.Struct<{
110
+ readonly success: Schema.Literal<"Found">;
111
+ readonly gifts: Schema.$Array<Schema.Unknown>;
112
+ }>>, Schema.toCodecJson<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"SocialGetItems", "GET", "/get_items/pt/:playerId/:salt/:hash", Schema.toCodecStringTree<Schema.Struct<{
113
+ playerId: Schema.brand<Schema.String, "PlayerId">;
114
+ salt: Schema.Int;
115
+ hash: Schema.String;
116
+ }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
117
+ readonly error: Schema.String;
118
+ }> | Schema.Struct<{
119
+ readonly success: Schema.Literal<"NotFound">;
120
+ }> | Schema.Struct<{
121
+ readonly success: Schema.Literal<"Found">;
122
+ readonly gifts: Schema.$Array<Schema.Unknown>;
123
+ }>>, Schema.toCodecJson<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"SocialPullFriendGame", "GET", "/friend/pull_game/pt/:playerId/:friendId/:salt/:hash", Schema.toCodecStringTree<Schema.Struct<{
124
+ playerId: Schema.brand<Schema.String, "PlayerId">;
125
+ friendId: Schema.brand<Schema.String, "PlayerId">;
126
+ salt: Schema.Int;
127
+ hash: Schema.String;
128
+ }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
129
+ readonly error: Schema.String;
130
+ }> | Schema.Struct<{
131
+ readonly success: Schema.Literal<"NotFound">;
132
+ }> | Schema.encodeKeys<Schema.Struct<{
133
+ readonly success: Schema.Literal<"Found">;
134
+ readonly data: Schema.Uint8ArrayFromBase64;
135
+ readonly checksum: Schema.String;
136
+ readonly saveId: Schema.NumberFromString;
137
+ readonly playerId: Schema.brand<Schema.String, "PlayerId">;
138
+ }>, {
139
+ readonly checksum: "h";
140
+ readonly saveId: "id";
141
+ readonly playerId: "player_id";
142
+ }>>, Schema.toCodecJson<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"SocialPullFriendMeta", "POST", "/friend/pull_meta/pt/:playerId/:salt/:hash", Schema.toCodecStringTree<Schema.Struct<{
143
+ playerId: Schema.brand<Schema.String, "PlayerId">;
144
+ salt: Schema.Int;
145
+ hash: Schema.String;
146
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
147
+ readonly friends: Schema.brand<Schema.String, "PlayerId">;
148
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
149
+ readonly error: Schema.String;
150
+ }> | Schema.Struct<{
151
+ readonly success: Schema.Literal<"NotFound">;
152
+ }> | Schema.Struct<{
153
+ readonly success: Schema.Literal<"Found">;
154
+ readonly meta: Schema.$Record<Schema.brand<Schema.String, "PlayerId">, Schema.Unknown>;
155
+ }>>, Schema.toCodecJson<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"SocialSendItem", "POST", "/send_item/pt/:itemType/:playerId/:friendId/:salt/:hash", Schema.toCodecStringTree<Schema.Struct<{
156
+ itemType: Schema.String;
157
+ playerId: Schema.brand<Schema.String, "PlayerId">;
158
+ friendId: Schema.brand<Schema.String, "PlayerId">;
159
+ salt: Schema.Int;
160
+ hash: Schema.String;
161
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
162
+ readonly itemStr: Schema.String;
163
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
164
+ readonly error: Schema.String;
165
+ }> | Schema.Struct<{
166
+ readonly success: Schema.Literal<"Sent">;
167
+ }> | Schema.Struct<{
168
+ readonly success: Schema.Literal<"NotSent">;
169
+ }>>, Schema.toCodecJson<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never>, false> | HttpApiGroup.HttpApiGroup<"SyncManagementGroup", HttpApiEndpoint.HttpApiEndpoint<"SyncCheckForNewerSave", "GET", "/sync/current_version/pt/:playerId/:salt/:hash", Schema.toCodecStringTree<Schema.Struct<{
170
+ playerId: Schema.brand<Schema.String, "PlayerId">;
171
+ salt: Schema.Int;
172
+ hash: Schema.String;
173
+ }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
174
+ readonly error: Schema.String;
175
+ }> | Schema.Struct<{
176
+ readonly success: Schema.Literal<"NotFound">;
177
+ }> | Schema.encodeKeys<Schema.Struct<{
178
+ readonly success: Schema.Literal<"Found">;
179
+ readonly checksum: Schema.String;
180
+ readonly saveId: Schema.NumberFromString;
181
+ }>, {
182
+ readonly checksum: "h";
183
+ readonly saveId: "id";
184
+ }>>, Schema.toCodecJson<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"SyncPullSave", "GET", "/sync/pull/pt/:playerId/:salt/:hash", Schema.toCodecStringTree<Schema.Struct<{
185
+ playerId: Schema.brand<Schema.String, "PlayerId">;
186
+ salt: Schema.Int;
187
+ hash: Schema.String;
188
+ }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
189
+ readonly error: Schema.String;
190
+ }> | Schema.Struct<{
191
+ readonly success: Schema.Literal<"NotFound">;
192
+ }> | Schema.encodeKeys<Schema.Struct<{
193
+ readonly success: Schema.Literal<"Found">;
194
+ readonly data: Schema.Uint8ArrayFromBase64;
195
+ readonly checksum: Schema.String;
196
+ readonly saveId: Schema.NumberFromString;
197
+ }>, {
198
+ readonly checksum: "h";
199
+ readonly saveId: "id";
200
+ }>>, Schema.toCodecJson<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never>, false>>;
201
+ //# sourceMappingURL=Endpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Endpoints.d.ts","sourceRoot":"","sources":["../src/Endpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AA8BxC;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,gBAAiB,CAAC;AAEnC;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,gBAAiB,CAAC;AAgPrC;;;;;GAKG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4LAAuG,CAAC"}
@@ -0,0 +1,293 @@
1
+ /**
2
+ * Pocket Trains (game code `pt`) NBSync api endpoints.
3
+ *
4
+ * Signing: a random `salt` (signed int32) goes in the path, and `hash` is
5
+ * `md5(<preimage> + <game secret salt>)` with the preimage
6
+ * `pt/<playerId>/<salt><playerAuthKey>` (variants noted per endpoint). The
7
+ * secret salt is the value extracted from `NBSync._ss`.
8
+ *
9
+ * Verification (live server + Frida DTO inspection of the game, 2026-08-26):
10
+ * - Signing is MD5, server-validated (same scheme as Tiny Tower / Pocket
11
+ * Planes; the game computes SHA-256 only for the unauthenticated `register`).
12
+ * - Response envelopes VERIFIED by reading the game's DTO classes at runtime:
13
+ * register, player_details, sync/pull (NBSyncGameSaveResponse), current_version,
14
+ * verify_device, friend/pull_game, friend/pull_meta (meta is a flat
15
+ * Dictionary<String,Object> on pt), send_item (NBSyncItemsSendResponse),
16
+ * get_items (NBSyncItemsGetResponse: success/gifts, NO `total` unlike pp).
17
+ * `get_items` was also exercised live with a burnbot.
18
+ * - pt-specific gifting: `get_gifts_pt` -> NBSyncGetPTGiftResponse with
19
+ * NBSyncGetPTGift elements, plus a gift-id flow (NBSyncGetGiftIDResponse,
20
+ * `friend/pull_meta_gift_id`). The get_gifts_pt REQUEST params are UNCONFIRMED
21
+ * (the tried `/get_gifts_pt/pt/:playerId/:salt/:hash` form was rejected), so
22
+ * that endpoint is marked accordingly.
23
+ *
24
+ * Game-specific save/meta schemas are left as `Schema.Unknown` placeholders.
25
+ *
26
+ * @since 1.0.0
27
+ * @category Endpoints
28
+ */
29
+ import { HttpApi, HttpApiEndpoint, HttpApiError, HttpApiGroup } from "effect/http-api";
30
+ import * as Schema from "effect/Schema";
31
+ import * as NimblebitConfig from "@tinyburg/nimblebit-sdk/NimblebitConfig";
32
+ import * as OAuthScope from "@yielded/auth/OAuthScope";
33
+ import * as Scopes from "./Scopes.js";
34
+ /** @internal */
35
+ export const U32 = /*#__PURE__*/Schema.Int.check(/*#__PURE__*/Schema.isUint32());
36
+ /** @internal */
37
+ export const ApiErrors = [HttpApiError.Forbidden, HttpApiError.BadRequest, HttpApiError.Unauthorized, HttpApiError.InternalServerError];
38
+ /** @internal */
39
+ export const ErrorResponse = /*#__PURE__*/Schema.Struct({
40
+ error: Schema.String
41
+ });
42
+ /** @internal */
43
+ export const NotFoundResponse = /*#__PURE__*/Schema.Struct({
44
+ success: /*#__PURE__*/Schema.Literal("NotFound")
45
+ });
46
+ /** @internal */
47
+ export const SentResponse = /*#__PURE__*/Schema.Struct({
48
+ success: /*#__PURE__*/Schema.Literal("Sent")
49
+ });
50
+ /** @internal */
51
+ export const NotSentResponse = /*#__PURE__*/Schema.Struct({
52
+ success: /*#__PURE__*/Schema.Literal("NotSent")
53
+ });
54
+ /**
55
+ * A gift/item in the general item channel (get_items / send_item). Verified DTO
56
+ * NBSyncItemsGift on pt: `{gift_id, gift_to, gift_from, gift_type, item_type,
57
+ * gift_str, h}` (no `c`, unlike pp). Left open for the data-schema work.
58
+ *
59
+ * @since 1.0.0
60
+ * @category Schemas
61
+ */
62
+ export const Gift = Schema.Unknown;
63
+ /**
64
+ * A Pocket Trains gift (get_gifts_pt channel). Verified DTO NBSyncGetPTGift:
65
+ * `{gift_id, gift_to, gift_from, alt_id, gift_type, gift_str: int, gift_quantity:
66
+ * int, h}`. Left open for the data-schema work.
67
+ *
68
+ * @since 1.0.0
69
+ * @category Schemas
70
+ */
71
+ export const PTGift = Schema.Unknown;
72
+ /** @internal */
73
+ export const DeviceNewPlayerEndpoint = /*#__PURE__*/HttpApiEndpoint.get("DeviceNewPlayer", "/register/pt/:salt1/:salt2/:hash", {
74
+ params: {
75
+ salt1: U32,
76
+ salt2: U32,
77
+ hash: Schema.String
78
+ },
79
+ error: ApiErrors,
80
+ success: [ErrorResponse, /*#__PURE__*/Schema.Struct({
81
+ playerId: NimblebitConfig.PlayerIdSchema,
82
+ playerSs: NimblebitConfig.PlayerAuthKeySchema
83
+ }).pipe(/*#__PURE__*/Schema.encodeKeys({
84
+ playerId: "player_id",
85
+ playerSs: "player_ss"
86
+ }))]
87
+ });
88
+ /** @internal */
89
+ export const DevicePlayerDetailsEndpoint = /*#__PURE__*/HttpApiEndpoint.get("DevicePlayerDetails", "/player_details/pt/:playerId/:salt/:hash", {
90
+ params: {
91
+ playerId: NimblebitConfig.PlayerIdSchema,
92
+ salt: U32,
93
+ hash: Schema.String
94
+ },
95
+ error: ApiErrors,
96
+ success: [ErrorResponse, Schema.Struct({
97
+ success: Schema.Literal("Found"),
98
+ player: Schema.Struct({
99
+ playerId: NimblebitConfig.PlayerIdSchema,
100
+ playerEmail: NimblebitConfig.PlayerEmailSchema,
101
+ registered: Schema.NumberFromString.pipe(Schema.decodeTo(Schema.BooleanFromBit)),
102
+ blacklisted: Schema.NumberFromString.pipe(Schema.decodeTo(Schema.BooleanFromBit)),
103
+ saveVersion: Schema.NumberFromString.pipe(Schema.decodeTo(Schema.Int)),
104
+ checksum: Schema.String
105
+ }).pipe(Schema.encodeKeys({
106
+ playerId: "player_id",
107
+ playerEmail: "email",
108
+ checksum: "h"
109
+ }))
110
+ })]
111
+ }).annotate(OAuthScope.Required, Scopes.Device.read.player_details.required);
112
+ /** @internal */
113
+ export const DeviceVerifyDeviceEndpoint = /*#__PURE__*/HttpApiEndpoint.get("DeviceVerifyDevice", "/verify_device/pt/:playerId/:verificationCode", {
114
+ params: {
115
+ playerId: NimblebitConfig.PlayerIdSchema,
116
+ verificationCode: Schema.String
117
+ },
118
+ error: ApiErrors,
119
+ success: [ErrorResponse, Schema.Struct({
120
+ success: Schema.Literal("NewDevice"),
121
+ playerId: NimblebitConfig.PlayerIdSchema,
122
+ playerAuthKey: NimblebitConfig.PlayerAuthKeySchema,
123
+ playerEmail: NimblebitConfig.PlayerEmailSchema
124
+ }).pipe(Schema.encodeKeys({
125
+ playerId: "player_id",
126
+ playerAuthKey: "player_ss",
127
+ playerEmail: "player_email"
128
+ }))]
129
+ }).annotate(OAuthScope.Required, Scopes.Device.write.verify_device.required);
130
+ /**
131
+ * Pull the player's cloud save. VERIFIED envelope (NBSyncGameSaveResponse). No-save
132
+ * case returns `{ error: "SaveNotFound" }`. `data` is base64 pako-deflated bytes.
133
+ *
134
+ * @internal
135
+ */
136
+ export const SyncPullSaveEndpoint = /*#__PURE__*/HttpApiEndpoint.get("SyncPullSave", "/sync/pull/pt/:playerId/:salt/:hash", {
137
+ params: {
138
+ playerId: NimblebitConfig.PlayerIdSchema,
139
+ salt: U32,
140
+ hash: Schema.String
141
+ },
142
+ error: ApiErrors,
143
+ success: [ErrorResponse, NotFoundResponse, /*#__PURE__*/Schema.Struct({
144
+ success: Schema.Literal("Found"),
145
+ data: Schema.Uint8ArrayFromBase64,
146
+ checksum: Schema.String,
147
+ saveId: Schema.NumberFromString
148
+ }).pipe(/*#__PURE__*/Schema.encodeKeys({
149
+ checksum: "h",
150
+ saveId: "id"
151
+ }))]
152
+ });
153
+ /**
154
+ * VERIFIED envelope (NBSyncCurrentCheckResponse); no-save returns `{ error: "NoSave" }`.
155
+ *
156
+ * @internal
157
+ */
158
+ export const SyncCheckForNewerSaveEndpoint = /*#__PURE__*/HttpApiEndpoint.get("SyncCheckForNewerSave", "/sync/current_version/pt/:playerId/:salt/:hash", {
159
+ params: {
160
+ playerId: NimblebitConfig.PlayerIdSchema,
161
+ salt: U32,
162
+ hash: Schema.String
163
+ },
164
+ error: ApiErrors,
165
+ success: [ErrorResponse, NotFoundResponse, /*#__PURE__*/Schema.Struct({
166
+ success: Schema.Literal("Found"),
167
+ checksum: Schema.String,
168
+ saveId: Schema.NumberFromString
169
+ }).pipe(/*#__PURE__*/Schema.encodeKeys({
170
+ checksum: "h",
171
+ saveId: "id"
172
+ }))]
173
+ });
174
+ /**
175
+ * VERIFIED live: `/get_items/pt/:playerId/:salt/:hash` -> `{ success:"Found",
176
+ * gifts:[...] }` (NBSyncItemsGetResponse; no `total` on pt).
177
+ *
178
+ * @internal
179
+ */
180
+ export const SocialGetItemsEndpoint = /*#__PURE__*/HttpApiEndpoint.get("SocialGetItems", "/get_items/pt/:playerId/:salt/:hash", {
181
+ params: {
182
+ playerId: NimblebitConfig.PlayerIdSchema,
183
+ salt: U32,
184
+ hash: Schema.String
185
+ },
186
+ error: ApiErrors,
187
+ success: [ErrorResponse, NotFoundResponse, Schema.Struct({
188
+ success: Schema.Literal("Found"),
189
+ gifts: Schema.Array(Gift)
190
+ })]
191
+ }).annotate(OAuthScope.Required, Scopes.Social.read.get_items.required);
192
+ /**
193
+ * Pocket Trains gift channel. Response VERIFIED (NBSyncGetPTGiftResponse) but the
194
+ * REQUEST params are UNCONFIRMED - the `/get_gifts_pt/pt/:playerId/:salt/:hash`
195
+ * form was rejected with "Invalid Request", so pt's gift request likely needs a
196
+ * gift-id (see NBSyncGetGiftIDResponse / `friend/pull_meta_gift_id`). Path/params
197
+ * below are a placeholder to be confirmed by capturing the live request.
198
+ *
199
+ * @internal
200
+ */
201
+ export const SocialGetGiftsPtEndpoint = /*#__PURE__*/HttpApiEndpoint.get("SocialGetGiftsPt", "/get_gifts_pt/pt/:playerId/:salt/:hash", {
202
+ params: {
203
+ playerId: NimblebitConfig.PlayerIdSchema,
204
+ salt: U32,
205
+ hash: Schema.String
206
+ },
207
+ error: ApiErrors,
208
+ success: [ErrorResponse, NotFoundResponse, Schema.Struct({
209
+ success: Schema.Literal("Found"),
210
+ gifts: Schema.Array(PTGift)
211
+ })]
212
+ }).annotate(OAuthScope.Required, Scopes.Social.read.get_gifts_pt.required);
213
+ /**
214
+ * DERIVED from Tiny Tower. Sends an item to a friend. Response VERIFIED
215
+ * (NBSyncItemsSendResponse: success/error). pt also has a `/send_pt/` variant.
216
+ *
217
+ * @internal
218
+ */
219
+ export const SocialSendItemEndpoint = /*#__PURE__*/HttpApiEndpoint.post("SocialSendItem", "/send_item/pt/:itemType/:playerId/:friendId/:salt/:hash", {
220
+ params: {
221
+ itemType: Schema.String,
222
+ playerId: NimblebitConfig.PlayerIdSchema,
223
+ friendId: NimblebitConfig.PlayerIdSchema,
224
+ salt: U32,
225
+ hash: Schema.String
226
+ },
227
+ payload: Schema.Struct({
228
+ itemStr: Schema.String
229
+ }),
230
+ error: ApiErrors,
231
+ success: [ErrorResponse, SentResponse, NotSentResponse]
232
+ }).annotate(OAuthScope.Required, Scopes.Social.write.send_item.required);
233
+ /**
234
+ * VERIFIED envelope (NBSyncFriendGameSaveResponse); preimage
235
+ * `pt/<playerId>/<friendId>/<salt><playerAuthKey>`.
236
+ *
237
+ * @internal
238
+ */
239
+ export const SocialPullFriendGameEndpoint = /*#__PURE__*/HttpApiEndpoint.get("SocialPullFriendGame", "/friend/pull_game/pt/:playerId/:friendId/:salt/:hash", {
240
+ params: {
241
+ playerId: NimblebitConfig.PlayerIdSchema,
242
+ friendId: NimblebitConfig.PlayerIdSchema,
243
+ salt: U32,
244
+ hash: Schema.String
245
+ },
246
+ error: ApiErrors,
247
+ success: [ErrorResponse, NotFoundResponse, Schema.Struct({
248
+ success: Schema.Literal("Found"),
249
+ data: Schema.Uint8ArrayFromBase64,
250
+ checksum: Schema.String,
251
+ saveId: Schema.NumberFromString,
252
+ playerId: NimblebitConfig.PlayerIdSchema
253
+ }).pipe(Schema.encodeKeys({
254
+ checksum: "h",
255
+ saveId: "id",
256
+ playerId: "player_id"
257
+ }))]
258
+ }).annotate(OAuthScope.Required, Scopes.Social.read.pull_friend_game.required);
259
+ /**
260
+ * VERIFIED envelope (NBSyncFriendGameMetaResponse; `meta` is a flat
261
+ * Dictionary<String,Object> on pt). Preimage `pt/<playerId>/<salt><friendId><playerAuthKey>`.
262
+ *
263
+ * @internal
264
+ */
265
+ export const SocialPullFriendMetaEndpoint = /*#__PURE__*/HttpApiEndpoint.post("SocialPullFriendMeta", "/friend/pull_meta/pt/:playerId/:salt/:hash", {
266
+ params: {
267
+ playerId: NimblebitConfig.PlayerIdSchema,
268
+ salt: U32,
269
+ hash: Schema.String
270
+ },
271
+ payload: Schema.Struct({
272
+ friends: NimblebitConfig.PlayerIdSchema
273
+ }),
274
+ error: ApiErrors,
275
+ success: [ErrorResponse, NotFoundResponse, Schema.Struct({
276
+ success: Schema.Literal("Found"),
277
+ meta: Schema.Record(NimblebitConfig.PlayerIdSchema, Schema.Unknown)
278
+ })]
279
+ }).annotate(OAuthScope.Required, Scopes.Social.read.pull_friend_meta.required);
280
+ /** @internal */
281
+ export const DeviceManagementGroup = /*#__PURE__*/HttpApiGroup.make("DeviceManagementGroup").add(DeviceNewPlayerEndpoint).add(DevicePlayerDetailsEndpoint).add(DeviceVerifyDeviceEndpoint);
282
+ /** @internal */
283
+ export const SyncManagementGroup = /*#__PURE__*/HttpApiGroup.make("SyncManagementGroup").add(SyncPullSaveEndpoint).add(SyncCheckForNewerSaveEndpoint);
284
+ /** @internal */
285
+ export const SocialGroup = /*#__PURE__*/HttpApiGroup.make("SocialGroup").add(SocialGetItemsEndpoint).add(SocialGetGiftsPtEndpoint).add(SocialSendItemEndpoint).add(SocialPullFriendGameEndpoint).add(SocialPullFriendMetaEndpoint);
286
+ /**
287
+ * The Pocket Trains NBSync api.
288
+ *
289
+ * @since 1.0.0
290
+ * @category Api
291
+ */
292
+ export const Api = /*#__PURE__*/HttpApi.make("PocketTrainsApi").add(DeviceManagementGroup).add(SyncManagementGroup).add(SocialGroup);
293
+ //# sourceMappingURL=Endpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Endpoints.js","names":[],"sources":["../src/Endpoints.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAS,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,QAAQ,iBAAiB;AACtF,OAAO,KAAK,MAAM,MAAM,eAAe;AAEvC,OAAO,KAAK,eAAe,MAAM,yCAAyC;AAC1E,OAAO,KAAK,UAAU,MAAM,0BAA0B;AAEtD,OAAO,KAAK,MAAM,MAAM,aAAa;AAErC;A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,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC;AAE7E;AACA,OAAO,MAAM,qBAAqB,gBAAG,YAAY,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAC1E,GAAG,CAAC,uBAAuB,CAAC,CAC5B,GAAG,CAAC,2BAA2B,CAAC,CAChC,GAAG,CAAC,0BAA0B,CAAC;AAEpC;AACA,OAAO,MAAM,mBAAmB,gBAAG,YAAY,CAAC,IAAI,CAAC,qBAAqB,CAAC,CACtE,GAAG,CAAC,oBAAoB,CAAC,CACzB,GAAG,CAAC,6BAA6B,CAAC;AAEvC;AACA,OAAO,MAAM,WAAW,gBAAG,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CACtD,GAAG,CAAC,sBAAsB,CAAC,CAC3B,GAAG,CAAC,wBAAwB,CAAC,CAC7B,GAAG,CAAC,sBAAsB,CAAC,CAC3B,GAAG,CAAC,4BAA4B,CAAC,CACjC,GAAG,CAAC,4BAA4B,CAAC;AAEtC;;;;;;AAMA,OAAO,MAAM,GAAG,gBAAG,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC","ignoreList":[]}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Pocket Trains SDK: signed calls against Nimblebit's NBSync service.
3
+ *
4
+ * Signing reuses `@tinyburg/nimblebit-sdk` (`NimblebitAuth`): the game secret
5
+ * salt (from `NBSync._ss`) is provided as the auth key, and each request is
6
+ * `md5(<preimage> + <secret salt>)` with a random uint32 `salt` in the path.
7
+ * All method preimages below are the Tiny Tower formula with the `pt` game code.
8
+ *
9
+ * The methods that were exercised live against sync.nimblebit.com are marked
10
+ * VERIFIED; save-bearing / write paths follow the same pattern but were not
11
+ * exercised. Save bytes are returned raw (base64-decoded); inflating (pako) and
12
+ * parsing into a save schema is left to the caller.
13
+ *
14
+ * @since 1.0.0
15
+ * @category SDK
16
+ */
17
+ import type * as Schema from "effect/Schema";
18
+ import * as Effect from "effect/Effect";
19
+ import { HttpClient } from "effect/http";
20
+ import * as Redacted from "effect/Redacted";
21
+ import { NimblebitAuth } from "@tinyburg/nimblebit-sdk";
22
+ /**
23
+ * Requests a new player ("burnbot") from the Nimblebit servers. VERIFIED.
24
+ *
25
+ * @since 1.0.0
26
+ * @category SDK
27
+ */
28
+ export declare const device_newPlayer: Effect.Effect<{
29
+ readonly playerId: string & import("effect/Brand").Brand<"PlayerId">;
30
+ readonly playerSs: Redacted.Redacted<string> & import("effect/Brand").Brand<"PlayerAuthKey">;
31
+ }, import("effect/http-api/HttpApiError").BadRequest | import("effect/http-api/HttpApiError").Forbidden | import("effect/http/HttpClientError").HttpClientError | import("effect/http-api/HttpApiError").InternalServerError | import("@tinyburg/nimblebit-sdk/internal/Error").NimblebitError | import("effect/PlatformError").PlatformError | Schema.SchemaError | import("effect/http-api/HttpApiError").Unauthorized, HttpClient.HttpClient | NimblebitAuth.NimblebitAuth>;
32
+ /**
33
+ * Retrieves player details. VERIFIED.
34
+ *
35
+ * @since 1.0.0
36
+ * @category SDK
37
+ */
38
+ export declare const device_playerDetails: (args_0: {
39
+ readonly playerAuthKey: Redacted.Redacted<string> & import("effect/Brand").Brand<"PlayerAuthKey">;
40
+ readonly playerId: string & import("effect/Brand").Brand<"PlayerId">;
41
+ }) => Effect.Effect<{
42
+ readonly playerId: string & import("effect/Brand").Brand<"PlayerId">;
43
+ readonly playerEmail: Redacted.Redacted<string> & import("effect/Brand").Brand<"PlayerEmail">;
44
+ readonly registered: boolean;
45
+ readonly blacklisted: boolean;
46
+ readonly saveVersion: number;
47
+ readonly checksum: string;
48
+ }, import("effect/http-api/HttpApiError").BadRequest | import("effect/http-api/HttpApiError").Forbidden | import("effect/http/HttpClientError").HttpClientError | import("effect/http-api/HttpApiError").InternalServerError | import("@tinyburg/nimblebit-sdk/internal/Error").NimblebitError | import("effect/PlatformError").PlatformError | Schema.SchemaError | import("effect/http-api/HttpApiError").Unauthorized, HttpClient.HttpClient | NimblebitAuth.NimblebitAuth>;
49
+ /**
50
+ * Pulls the player's cloud save. Returns raw base64-decoded bytes (inflate +
51
+ * parse separately). Success envelope DERIVED from Tiny Tower.
52
+ *
53
+ * @since 1.0.0
54
+ * @category SDK
55
+ */
56
+ export declare const sync_pullSave: (args_0: {
57
+ readonly playerAuthKey: Redacted.Redacted<string> & import("effect/Brand").Brand<"PlayerAuthKey">;
58
+ readonly playerId: string & import("effect/Brand").Brand<"PlayerId">;
59
+ }) => Effect.Effect<{
60
+ readonly success: "NotFound";
61
+ } | {
62
+ readonly success: "Found";
63
+ readonly data: Uint8Array<ArrayBufferLike>;
64
+ readonly checksum: string;
65
+ readonly saveId: number;
66
+ }, import("effect/http-api/HttpApiError").BadRequest | import("effect/http-api/HttpApiError").Forbidden | import("effect/http/HttpClientError").HttpClientError | import("effect/http-api/HttpApiError").InternalServerError | import("@tinyburg/nimblebit-sdk/internal/Error").NimblebitError | import("effect/PlatformError").PlatformError | Schema.SchemaError | import("effect/http-api/HttpApiError").Unauthorized, HttpClient.HttpClient | NimblebitAuth.NimblebitAuth>;
67
+ /**
68
+ * Lists items (parts/gifts) waiting for the player. VERIFIED
69
+ * (`/get_items/pt/...` -> `{ success:"Found", gifts:[...] }`, no total).
70
+ *
71
+ * @since 1.0.0
72
+ * @category SDK
73
+ */
74
+ export declare const social_getItems: (args_0: {
75
+ readonly playerAuthKey: Redacted.Redacted<string> & import("effect/Brand").Brand<"PlayerAuthKey">;
76
+ readonly playerId: string & import("effect/Brand").Brand<"PlayerId">;
77
+ }) => Effect.Effect<{
78
+ readonly success: "NotFound";
79
+ } | {
80
+ readonly success: "Found";
81
+ readonly gifts: readonly unknown[];
82
+ }, import("effect/http-api/HttpApiError").BadRequest | import("effect/http-api/HttpApiError").Forbidden | import("effect/http/HttpClientError").HttpClientError | import("effect/http-api/HttpApiError").InternalServerError | import("@tinyburg/nimblebit-sdk/internal/Error").NimblebitError | import("effect/PlatformError").PlatformError | Schema.SchemaError | import("effect/http-api/HttpApiError").Unauthorized, HttpClient.HttpClient | NimblebitAuth.NimblebitAuth>;
83
+ //# sourceMappingURL=PocketTrains.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PocketTrains.d.ts","sourceRoot":"","sources":["../src/PocketTrains.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,UAAU,EAAqB,MAAM,aAAa,CAAC;AAE5D,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAI5C,OAAO,EAAE,aAAa,EAAkB,MAAM,yBAAyB,CAAC;AAIxE;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;8cA6B3B,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;8cA+B/B,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;8cA+BxB,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;;;;;;;;8cA+B1B,CAAC"}