@tinyburg/pocket-planes-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/LICENSE +674 -0
- package/README.md +8 -2
- package/dist/Endpoints.d.ts +239 -0
- package/dist/Endpoints.d.ts.map +1 -0
- package/dist/Endpoints.js +383 -0
- package/dist/Endpoints.js.map +1 -0
- package/dist/PocketPlanes.d.ts +115 -0
- package/dist/PocketPlanes.d.ts.map +1 -0
- package/dist/PocketPlanes.js +246 -0
- package/dist/PocketPlanes.js.map +1 -0
- package/dist/Scopes.d.ts +78 -0
- package/dist/Scopes.d.ts.map +1 -0
- package/dist/Scopes.js +83 -0
- package/dist/Scopes.js.map +1 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +70 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -3
- package/src/Endpoints.ts +407 -0
- package/src/PocketPlanes.ts +264 -0
- package/src/Scopes.ts +92 -0
- package/src/index.ts +72 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pocket Planes 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 `pp` 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 visits (bitizen/plane exchanges) waiting for the player. VERIFIED.
|
|
69
|
+
*
|
|
70
|
+
* @since 1.0.0
|
|
71
|
+
* @category SDK
|
|
72
|
+
*/
|
|
73
|
+
export declare const social_getVisits: (args_0: {
|
|
74
|
+
readonly playerAuthKey: Redacted.Redacted<string> & import("effect/Brand").Brand<"PlayerAuthKey">;
|
|
75
|
+
readonly playerId: string & import("effect/Brand").Brand<"PlayerId">;
|
|
76
|
+
}) => Effect.Effect<{
|
|
77
|
+
readonly success: "NotFound";
|
|
78
|
+
} | {
|
|
79
|
+
readonly success: "Found";
|
|
80
|
+
readonly gifts: readonly unknown[];
|
|
81
|
+
readonly total: number;
|
|
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
|
+
/**
|
|
84
|
+
* Lists gifts waiting for the player. VERIFIED.
|
|
85
|
+
*
|
|
86
|
+
* @since 1.0.0
|
|
87
|
+
* @category SDK
|
|
88
|
+
*/
|
|
89
|
+
export declare const social_getGifts: (args_0: {
|
|
90
|
+
readonly playerAuthKey: Redacted.Redacted<string> & import("effect/Brand").Brand<"PlayerAuthKey">;
|
|
91
|
+
readonly playerId: string & import("effect/Brand").Brand<"PlayerId">;
|
|
92
|
+
}) => Effect.Effect<{
|
|
93
|
+
readonly success: "NotFound";
|
|
94
|
+
} | {
|
|
95
|
+
readonly success: "Found";
|
|
96
|
+
readonly gifts: readonly unknown[];
|
|
97
|
+
readonly total: number;
|
|
98
|
+
}, 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>;
|
|
99
|
+
/**
|
|
100
|
+
* Lists item requests waiting for the player (Pocket Planes specific;
|
|
101
|
+
* `{ success, gifts }` with no `total`). VERIFIED.
|
|
102
|
+
*
|
|
103
|
+
* @since 1.0.0
|
|
104
|
+
* @category SDK
|
|
105
|
+
*/
|
|
106
|
+
export declare const social_requestItems: (args_0: {
|
|
107
|
+
readonly playerAuthKey: Redacted.Redacted<string> & import("effect/Brand").Brand<"PlayerAuthKey">;
|
|
108
|
+
readonly playerId: string & import("effect/Brand").Brand<"PlayerId">;
|
|
109
|
+
}) => Effect.Effect<{
|
|
110
|
+
readonly success: "NotFound";
|
|
111
|
+
} | {
|
|
112
|
+
readonly success: "Found";
|
|
113
|
+
readonly gifts: readonly unknown[];
|
|
114
|
+
}, 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>;
|
|
115
|
+
//# sourceMappingURL=PocketPlanes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PocketPlanes.d.ts","sourceRoot":"","sources":["../src/PocketPlanes.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;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;8cA+B3B,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,eAAe;;;;;;;;;8cA+B1B,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;8cA+B9B,CAAC"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pocket Planes 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 `pp` 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 * as Effect from "effect/Effect";
|
|
18
|
+
import * as Function from "effect/Function";
|
|
19
|
+
import { HttpClient, HttpClientRequest } from "effect/http";
|
|
20
|
+
import { HttpApiClient } from "effect/http-api";
|
|
21
|
+
import * as Redacted from "effect/Redacted";
|
|
22
|
+
import { NimblebitAuth, NimblebitError } from "@tinyburg/nimblebit-sdk";
|
|
23
|
+
import * as Endpoints from "./Endpoints.js";
|
|
24
|
+
/**
|
|
25
|
+
* Requests a new player ("burnbot") from the Nimblebit servers. VERIFIED.
|
|
26
|
+
*
|
|
27
|
+
* @since 1.0.0
|
|
28
|
+
* @category SDK
|
|
29
|
+
*/
|
|
30
|
+
export const device_newPlayer = /*#__PURE__*/Effect.gen(function* () {
|
|
31
|
+
const nimblebitAuth = yield* NimblebitAuth.NimblebitAuth;
|
|
32
|
+
const httpClient = yield* HttpClient.HttpClient;
|
|
33
|
+
const maybeAddBearerToken = nimblebitAuth.host !== "https://sync.nimblebit.com" ? HttpClientRequest.bearerToken(nimblebitAuth.authKey) : Function.identity;
|
|
34
|
+
const endpoint = yield* HttpApiClient.endpoint(Endpoints.Api, {
|
|
35
|
+
baseUrl: nimblebitAuth.host,
|
|
36
|
+
group: "DeviceManagementGroup",
|
|
37
|
+
endpoint: "DeviceNewPlayer",
|
|
38
|
+
httpClient: HttpClient.mapRequest(httpClient, maybeAddBearerToken)
|
|
39
|
+
});
|
|
40
|
+
const salt1 = yield* nimblebitAuth.salt;
|
|
41
|
+
const salt2 = yield* nimblebitAuth.salt;
|
|
42
|
+
const hash = yield* nimblebitAuth.sign(`pp/${salt1}/${salt2}`);
|
|
43
|
+
const response = yield* endpoint({
|
|
44
|
+
params: {
|
|
45
|
+
salt1,
|
|
46
|
+
salt2,
|
|
47
|
+
hash
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
if ("error" in response) {
|
|
51
|
+
return yield* new NimblebitError.NimblebitError({
|
|
52
|
+
method: "DeviceNewPlayer",
|
|
53
|
+
module: "DeviceManagementGroup",
|
|
54
|
+
cause: response.error
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return response;
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* Retrieves player details. VERIFIED.
|
|
61
|
+
*
|
|
62
|
+
* @since 1.0.0
|
|
63
|
+
* @category SDK
|
|
64
|
+
*/
|
|
65
|
+
export const device_playerDetails = /*#__PURE__*/Effect.fn("device_playerDetails")(function* ({
|
|
66
|
+
playerAuthKey,
|
|
67
|
+
playerId
|
|
68
|
+
}) {
|
|
69
|
+
const nimblebitAuth = yield* NimblebitAuth.NimblebitAuth;
|
|
70
|
+
const httpClient = yield* HttpClient.HttpClient;
|
|
71
|
+
const maybeAddBearerToken = nimblebitAuth.host !== "https://sync.nimblebit.com" ? HttpClientRequest.bearerToken(nimblebitAuth.authKey) : Function.identity;
|
|
72
|
+
const endpoint = yield* HttpApiClient.endpoint(Endpoints.Api, {
|
|
73
|
+
baseUrl: nimblebitAuth.host,
|
|
74
|
+
group: "DeviceManagementGroup",
|
|
75
|
+
endpoint: "DevicePlayerDetails",
|
|
76
|
+
httpClient: HttpClient.mapRequest(httpClient, maybeAddBearerToken)
|
|
77
|
+
});
|
|
78
|
+
const salt = yield* nimblebitAuth.salt;
|
|
79
|
+
const hash = yield* nimblebitAuth.sign(`pp/${playerId}/${salt}${Redacted.value(playerAuthKey)}`);
|
|
80
|
+
const response = yield* endpoint({
|
|
81
|
+
params: {
|
|
82
|
+
playerId,
|
|
83
|
+
salt,
|
|
84
|
+
hash
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
if ("error" in response) {
|
|
88
|
+
return yield* new NimblebitError.NimblebitError({
|
|
89
|
+
method: "DevicePlayerDetails",
|
|
90
|
+
module: "DeviceManagementGroup",
|
|
91
|
+
cause: response.error
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return response.player;
|
|
95
|
+
});
|
|
96
|
+
/**
|
|
97
|
+
* Pulls the player's cloud save. Returns raw base64-decoded bytes (inflate +
|
|
98
|
+
* parse separately). Success envelope DERIVED from Tiny Tower.
|
|
99
|
+
*
|
|
100
|
+
* @since 1.0.0
|
|
101
|
+
* @category SDK
|
|
102
|
+
*/
|
|
103
|
+
export const sync_pullSave = /*#__PURE__*/Effect.fn("sync_pullSave")(function* ({
|
|
104
|
+
playerAuthKey,
|
|
105
|
+
playerId
|
|
106
|
+
}) {
|
|
107
|
+
const nimblebitAuth = yield* NimblebitAuth.NimblebitAuth;
|
|
108
|
+
const httpClient = yield* HttpClient.HttpClient;
|
|
109
|
+
const maybeAddBearerToken = nimblebitAuth.host !== "https://sync.nimblebit.com" ? HttpClientRequest.bearerToken(nimblebitAuth.authKey) : Function.identity;
|
|
110
|
+
const endpoint = yield* HttpApiClient.endpoint(Endpoints.Api, {
|
|
111
|
+
baseUrl: nimblebitAuth.host,
|
|
112
|
+
group: "SyncManagementGroup",
|
|
113
|
+
endpoint: "SyncPullSave",
|
|
114
|
+
httpClient: HttpClient.mapRequest(httpClient, maybeAddBearerToken)
|
|
115
|
+
});
|
|
116
|
+
const salt = yield* nimblebitAuth.salt;
|
|
117
|
+
const hash = yield* nimblebitAuth.sign(`pp/${playerId}/${salt}${Redacted.value(playerAuthKey)}`);
|
|
118
|
+
const response = yield* endpoint({
|
|
119
|
+
params: {
|
|
120
|
+
playerId,
|
|
121
|
+
salt,
|
|
122
|
+
hash
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
if ("error" in response) {
|
|
126
|
+
return yield* new NimblebitError.NimblebitError({
|
|
127
|
+
method: "SyncPullSave",
|
|
128
|
+
module: "SyncManagementGroup",
|
|
129
|
+
cause: response.error
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return response;
|
|
133
|
+
});
|
|
134
|
+
/**
|
|
135
|
+
* Lists visits (bitizen/plane exchanges) waiting for the player. VERIFIED.
|
|
136
|
+
*
|
|
137
|
+
* @since 1.0.0
|
|
138
|
+
* @category SDK
|
|
139
|
+
*/
|
|
140
|
+
export const social_getVisits = /*#__PURE__*/Effect.fn("social_getVisits")(function* ({
|
|
141
|
+
playerAuthKey,
|
|
142
|
+
playerId
|
|
143
|
+
}) {
|
|
144
|
+
const nimblebitAuth = yield* NimblebitAuth.NimblebitAuth;
|
|
145
|
+
const httpClient = yield* HttpClient.HttpClient;
|
|
146
|
+
const maybeAddBearerToken = nimblebitAuth.host !== "https://sync.nimblebit.com" ? HttpClientRequest.bearerToken(nimblebitAuth.authKey) : Function.identity;
|
|
147
|
+
const endpoint = yield* HttpApiClient.endpoint(Endpoints.Api, {
|
|
148
|
+
baseUrl: nimblebitAuth.host,
|
|
149
|
+
group: "SocialGroup",
|
|
150
|
+
endpoint: "SocialGetVisits",
|
|
151
|
+
httpClient: HttpClient.mapRequest(httpClient, maybeAddBearerToken)
|
|
152
|
+
});
|
|
153
|
+
const salt = yield* nimblebitAuth.salt;
|
|
154
|
+
const hash = yield* nimblebitAuth.sign(`pp/${playerId}/${salt}${Redacted.value(playerAuthKey)}`);
|
|
155
|
+
const response = yield* endpoint({
|
|
156
|
+
params: {
|
|
157
|
+
playerId,
|
|
158
|
+
salt,
|
|
159
|
+
hash
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
if ("error" in response) {
|
|
163
|
+
return yield* new NimblebitError.NimblebitError({
|
|
164
|
+
method: "SocialGetVisits",
|
|
165
|
+
module: "SocialGroup",
|
|
166
|
+
cause: response.error
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return response;
|
|
170
|
+
});
|
|
171
|
+
/**
|
|
172
|
+
* Lists gifts waiting for the player. VERIFIED.
|
|
173
|
+
*
|
|
174
|
+
* @since 1.0.0
|
|
175
|
+
* @category SDK
|
|
176
|
+
*/
|
|
177
|
+
export const social_getGifts = /*#__PURE__*/Effect.fn("social_getGifts")(function* ({
|
|
178
|
+
playerAuthKey,
|
|
179
|
+
playerId
|
|
180
|
+
}) {
|
|
181
|
+
const nimblebitAuth = yield* NimblebitAuth.NimblebitAuth;
|
|
182
|
+
const httpClient = yield* HttpClient.HttpClient;
|
|
183
|
+
const maybeAddBearerToken = nimblebitAuth.host !== "https://sync.nimblebit.com" ? HttpClientRequest.bearerToken(nimblebitAuth.authKey) : Function.identity;
|
|
184
|
+
const endpoint = yield* HttpApiClient.endpoint(Endpoints.Api, {
|
|
185
|
+
baseUrl: nimblebitAuth.host,
|
|
186
|
+
group: "SocialGroup",
|
|
187
|
+
endpoint: "SocialGetGifts",
|
|
188
|
+
httpClient: HttpClient.mapRequest(httpClient, maybeAddBearerToken)
|
|
189
|
+
});
|
|
190
|
+
const salt = yield* nimblebitAuth.salt;
|
|
191
|
+
const hash = yield* nimblebitAuth.sign(`pp/${playerId}/${salt}${Redacted.value(playerAuthKey)}`);
|
|
192
|
+
const response = yield* endpoint({
|
|
193
|
+
params: {
|
|
194
|
+
playerId,
|
|
195
|
+
salt,
|
|
196
|
+
hash
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
if ("error" in response) {
|
|
200
|
+
return yield* new NimblebitError.NimblebitError({
|
|
201
|
+
method: "SocialGetGifts",
|
|
202
|
+
module: "SocialGroup",
|
|
203
|
+
cause: response.error
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
return response;
|
|
207
|
+
});
|
|
208
|
+
/**
|
|
209
|
+
* Lists item requests waiting for the player (Pocket Planes specific;
|
|
210
|
+
* `{ success, gifts }` with no `total`). VERIFIED.
|
|
211
|
+
*
|
|
212
|
+
* @since 1.0.0
|
|
213
|
+
* @category SDK
|
|
214
|
+
*/
|
|
215
|
+
export const social_requestItems = /*#__PURE__*/Effect.fn("social_requestItems")(function* ({
|
|
216
|
+
playerAuthKey,
|
|
217
|
+
playerId
|
|
218
|
+
}) {
|
|
219
|
+
const nimblebitAuth = yield* NimblebitAuth.NimblebitAuth;
|
|
220
|
+
const httpClient = yield* HttpClient.HttpClient;
|
|
221
|
+
const maybeAddBearerToken = nimblebitAuth.host !== "https://sync.nimblebit.com" ? HttpClientRequest.bearerToken(nimblebitAuth.authKey) : Function.identity;
|
|
222
|
+
const endpoint = yield* HttpApiClient.endpoint(Endpoints.Api, {
|
|
223
|
+
baseUrl: nimblebitAuth.host,
|
|
224
|
+
group: "SocialGroup",
|
|
225
|
+
endpoint: "SocialRequestItems",
|
|
226
|
+
httpClient: HttpClient.mapRequest(httpClient, maybeAddBearerToken)
|
|
227
|
+
});
|
|
228
|
+
const salt = yield* nimblebitAuth.salt;
|
|
229
|
+
const hash = yield* nimblebitAuth.sign(`pp/${playerId}/${salt}${Redacted.value(playerAuthKey)}`);
|
|
230
|
+
const response = yield* endpoint({
|
|
231
|
+
params: {
|
|
232
|
+
playerId,
|
|
233
|
+
salt,
|
|
234
|
+
hash
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
if ("error" in response) {
|
|
238
|
+
return yield* new NimblebitError.NimblebitError({
|
|
239
|
+
method: "SocialRequestItems",
|
|
240
|
+
module: "SocialGroup",
|
|
241
|
+
cause: response.error
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
return response;
|
|
245
|
+
});
|
|
246
|
+
//# sourceMappingURL=PocketPlanes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PocketPlanes.js","names":[],"sources":["../src/PocketPlanes.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;AAmBA,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,OAAO,KAAK,QAAQ,MAAM,iBAAiB;AAC3C,SAAS,UAAU,EAAE,iBAAiB,QAAQ,aAAa;AAC3D,SAAS,aAAa,QAAQ,iBAAiB;AAC/C,OAAO,KAAK,QAAQ,MAAM,iBAAiB;AAI3C,SAAS,aAAa,EAAE,cAAc,QAAQ,yBAAyB;AAEvE,OAAO,KAAK,SAAS,MAAM,gBAAgB;AAE3C;;;;;;AAMA,OAAO,MAAM,gBAAgB,gBAAG,MAAM,CAAC,GAAG,CAAC,aAAS;EAChD,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,aAAa;EACxD,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,UAAU;EAE/C,MAAM,mBAAmB,GACrB,aAAa,CAAC,IAAI,KAAK,4BAA4B,GAC7C,iBAAiB,CAAC,WAAW,CAAC,aAAa,CAAC,OAAO,CAAC,GACpD,QAAQ,CAAC,QAAQ;EAE3B,MAAM,QAAQ,GAAG,OAAO,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE;IAC1D,OAAO,EAAE,aAAa,CAAC,IAAI;IAC3B,KAAK,EA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O,IAAI,QAAQ,EAAE;IACrB,OAAO,OAAO,IAAI,cAAc,CAAC,cAAc,CAAC;MAC5C,MAAM,EAAE,oBAAoB;MAC5B,MAAM,EAAE,aAAa;MACrB,KAAK,EAAE,QAAQ,CAAC;KACnB,CAAC;EACN;EACA,OAAO,QAAQ;AACnB,CAAC,CAAC","ignoreList":[]}
|
package/dist/Scopes.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scopes the Pocket Planes api is guarded by, as a game-rooted tree, built with
|
|
3
|
+
* `@tinyburg/nimblebit-sdk`'s `defineGame`. Only the endpoints this sdk defines
|
|
4
|
+
* are covered; areas without both a read and a write side are left out until
|
|
5
|
+
* their endpoints exist.
|
|
6
|
+
*
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
* @category Scopes
|
|
9
|
+
*/
|
|
10
|
+
import { type Game, type ScopeDescription } from "@tinyburg/nimblebit-sdk/NimblebitScopes";
|
|
11
|
+
/**
|
|
12
|
+
* @since 1.0.0
|
|
13
|
+
* @category Games
|
|
14
|
+
*/
|
|
15
|
+
export declare const PocketPlanes: Game & {
|
|
16
|
+
readonly areas: {
|
|
17
|
+
readonly device: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Area & {
|
|
18
|
+
readonly read: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Branch & {
|
|
19
|
+
readonly player_details: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
20
|
+
};
|
|
21
|
+
readonly write: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Branch & {
|
|
22
|
+
readonly register_email: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
23
|
+
readonly verify_device: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
readonly social: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Area & {
|
|
27
|
+
readonly read: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Branch & {
|
|
28
|
+
readonly get_gifts: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
29
|
+
readonly get_visits: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
30
|
+
readonly pull_friend_game: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
31
|
+
readonly pull_friend_meta: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
32
|
+
readonly request_items: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
33
|
+
};
|
|
34
|
+
readonly write: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Branch & {
|
|
35
|
+
readonly receive_item: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
36
|
+
readonly send_item: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* The game's areas, by name, for annotating endpoints.
|
|
43
|
+
*
|
|
44
|
+
* @since 1.0.0
|
|
45
|
+
* @category Areas
|
|
46
|
+
*/
|
|
47
|
+
export declare const Device: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Area & {
|
|
48
|
+
readonly read: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Branch & {
|
|
49
|
+
readonly player_details: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
50
|
+
};
|
|
51
|
+
readonly write: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Branch & {
|
|
52
|
+
readonly register_email: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
53
|
+
readonly verify_device: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
54
|
+
};
|
|
55
|
+
}, Social: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Area & {
|
|
56
|
+
readonly read: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Branch & {
|
|
57
|
+
readonly get_gifts: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
58
|
+
readonly get_visits: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
59
|
+
readonly pull_friend_game: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
60
|
+
readonly pull_friend_meta: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
61
|
+
readonly request_items: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
62
|
+
};
|
|
63
|
+
readonly write: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Branch & {
|
|
64
|
+
readonly receive_item: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
65
|
+
readonly send_item: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* @since 1.0.0
|
|
70
|
+
* @category Tree
|
|
71
|
+
*/
|
|
72
|
+
export declare const Games: ReadonlyArray<Game>;
|
|
73
|
+
/**
|
|
74
|
+
* @since 1.0.0
|
|
75
|
+
* @category Tree
|
|
76
|
+
*/
|
|
77
|
+
export declare const all: () => ReadonlyArray<ScopeDescription>;
|
|
78
|
+
//# sourceMappingURL=Scopes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Scopes.d.ts","sourceRoot":"","sources":["../src/Scopes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,gBAAgB,EAAc,MAAM,yCAAyC,CAAC;AAEvG;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;CA2CvB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAgB,MAAM;;;;;;;;GAAU,MAAM;;;;;;;;;;;;CAAuB,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,aAAa,CAAC,IAAI,CAAkB,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,GAAG,QAAO,aAAa,CAAC,gBAAgB,CAY/C,CAAC"}
|
package/dist/Scopes.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scopes the Pocket Planes api is guarded by, as a game-rooted tree, built with
|
|
3
|
+
* `@tinyburg/nimblebit-sdk`'s `defineGame`. Only the endpoints this sdk defines
|
|
4
|
+
* are covered; areas without both a read and a write side are left out until
|
|
5
|
+
* their endpoints exist.
|
|
6
|
+
*
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
* @category Scopes
|
|
9
|
+
*/
|
|
10
|
+
import { defineGame } from "@tinyburg/nimblebit-sdk/NimblebitScopes";
|
|
11
|
+
/**
|
|
12
|
+
* @since 1.0.0
|
|
13
|
+
* @category Games
|
|
14
|
+
*/
|
|
15
|
+
export const PocketPlanes = /*#__PURE__*/defineGame({
|
|
16
|
+
name: "pocketplanes",
|
|
17
|
+
description: "Pocket Planes",
|
|
18
|
+
read: {
|
|
19
|
+
description: "Everything in Pocket Planes that only looks"
|
|
20
|
+
},
|
|
21
|
+
write: {
|
|
22
|
+
description: "Everything in Pocket Planes that changes a player's game"
|
|
23
|
+
},
|
|
24
|
+
areas: {
|
|
25
|
+
device: {
|
|
26
|
+
description: "Player accounts and their devices",
|
|
27
|
+
read: {
|
|
28
|
+
description: "Look up player accounts",
|
|
29
|
+
leaves: {
|
|
30
|
+
player_details: "Look up a player's public profile details"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
write: {
|
|
34
|
+
description: "Change a player's account or devices",
|
|
35
|
+
leaves: {
|
|
36
|
+
register_email: "Attach an email address to a player",
|
|
37
|
+
verify_device: "Complete a device verification code"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
social: {
|
|
42
|
+
description: "Gifts, visits and friends",
|
|
43
|
+
read: {
|
|
44
|
+
description: "See gifts, visits and friends' games",
|
|
45
|
+
leaves: {
|
|
46
|
+
get_visits: "See who has visited a player",
|
|
47
|
+
get_gifts: "See the gifts waiting for a player",
|
|
48
|
+
request_items: "See the item requests waiting for a player",
|
|
49
|
+
pull_friend_meta: "Fetch metadata about a player's friends",
|
|
50
|
+
pull_friend_game: "Download a friend's game data"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
write: {
|
|
54
|
+
description: "Send and accept gifts and items",
|
|
55
|
+
leaves: {
|
|
56
|
+
send_item: "Send items to another player",
|
|
57
|
+
receive_item: "Accept an item on a player's behalf"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* The game's areas, by name, for annotating endpoints.
|
|
65
|
+
*
|
|
66
|
+
* @since 1.0.0
|
|
67
|
+
* @category Areas
|
|
68
|
+
*/
|
|
69
|
+
export const {
|
|
70
|
+
device: Device,
|
|
71
|
+
social: Social
|
|
72
|
+
} = PocketPlanes.areas;
|
|
73
|
+
/**
|
|
74
|
+
* @since 1.0.0
|
|
75
|
+
* @category Tree
|
|
76
|
+
*/
|
|
77
|
+
export const Games = [PocketPlanes];
|
|
78
|
+
/**
|
|
79
|
+
* @since 1.0.0
|
|
80
|
+
* @category Tree
|
|
81
|
+
*/
|
|
82
|
+
export const all = () => Games.flatMap(game => [game, game.read, game.write, ...Object.values(game.areas).flatMap(area => [area, area.read, ...area.read.children, area.write, ...area.write.children])]);
|
|
83
|
+
//# sourceMappingURL=Scopes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Scopes.js","names":[],"sources":["../src/Scopes.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;AAUA,SAA2C,UAAU,QAAQ,yCAAyC;AAEtG;;;;AAIA,OAAO,MAAM,YAAY,gBAAG,UAAU,CAAC;EACnC,IAAI,EAAE,cAAc;EACpB,WAAW,EAAE,eAAe;EAC5B,I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AAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CACzB,CAAC,CACL,CAAC","ignoreList":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Pocket Planes (game code `pp`) NBSync api endpoints.
|
|
6
|
+
*
|
|
7
|
+
* Signing: a random `salt` (signed int32 - the game emits negatives too) goes
|
|
8
|
+
* in the path, and `hash` is `md5(<preimage> + <game secret salt>)` where the
|
|
9
|
+
* preimage is `pp/<playerId>/<salt><playerAuthKey>` (variants noted per
|
|
10
|
+
* endpoint). The secret salt is the value extracted from `NBSync._ss`.
|
|
11
|
+
*
|
|
12
|
+
* Verification (against the live server + Frida inspection of the game,
|
|
13
|
+
* 2026-08-26):
|
|
14
|
+
* - Signing is MD5, VERIFIED server-side: `player_details` accepts the MD5 hash
|
|
15
|
+
* and rejects a garbage hash, no hash, and a SHA-256 hash. (The game itself
|
|
16
|
+
* computes SHA-256 in `NBSync.genHash` for the unauthenticated `register`
|
|
17
|
+
* call, which the server also accepts via MD5 - so it does not affect the
|
|
18
|
+
* authenticated endpoints this SDK signs.)
|
|
19
|
+
* - Response envelopes VERIFIED by reading the game's DTO classes at runtime
|
|
20
|
+
* (immune to the metadata obfuscation): register (NBSyncRegisterResponse),
|
|
21
|
+
* player_details (NBSyncPlayerDetailsResponse), sync/pull
|
|
22
|
+
* (NBSyncGameSaveResponse: success/h/id/data), current_version
|
|
23
|
+
* (NBSyncCurrentCheckResponse), verify_device (NBSyncVerifyCodeResponse:
|
|
24
|
+
* success/player_id/player_ss/player_email - no photo/nickname on pp),
|
|
25
|
+
* get_visits/get_gifts (NBSyncItemsGetResponse), send_item
|
|
26
|
+
* (NBSyncItemsSendResponse), receive_item (NBSyncItemsReceiveResponse: also
|
|
27
|
+
* carries an `id`), friend/pull_game (NBSyncFriendGameSaveResponse),
|
|
28
|
+
* friend/pull_meta (NBSyncFriendGameMetaResponse). register/player_details/
|
|
29
|
+
* get_visits/get_gifts/request_items were also exercised live with a burnbot.
|
|
30
|
+
* - Still open: pp appears to have NO snapshots (`sync/current_snapshots`
|
|
31
|
+
* returns Invalid Request), so `pull_snapshot` here is unconfirmed and may
|
|
32
|
+
* not exist. register_email is DERIVED from Tiny Tower.
|
|
33
|
+
*
|
|
34
|
+
* Game-specific payload/item schemas (the `gifts` element - real shape is
|
|
35
|
+
* NBSyncItemsGift {gift_id, gift_to, gift_from, gift_type, item_type, gift_str,
|
|
36
|
+
* h, c} - friend meta, save push meta) are `Schema.Unknown` placeholders for
|
|
37
|
+
* the data-schema work.
|
|
38
|
+
*
|
|
39
|
+
* @since 1.0.0
|
|
40
|
+
* @category Endpoints
|
|
41
|
+
*/
|
|
42
|
+
export * as Endpoints from "./Endpoints.ts";
|
|
43
|
+
/**
|
|
44
|
+
* Pocket Planes SDK: signed calls against Nimblebit's NBSync service.
|
|
45
|
+
*
|
|
46
|
+
* Signing reuses `@tinyburg/nimblebit-sdk` (`NimblebitAuth`): the game secret
|
|
47
|
+
* salt (from `NBSync._ss`) is provided as the auth key, and each request is
|
|
48
|
+
* `md5(<preimage> + <secret salt>)` with a random uint32 `salt` in the path.
|
|
49
|
+
* All method preimages below are the Tiny Tower formula with the `pp` game code.
|
|
50
|
+
*
|
|
51
|
+
* The methods that were exercised live against sync.nimblebit.com are marked
|
|
52
|
+
* VERIFIED; save-bearing / write paths follow the same pattern but were not
|
|
53
|
+
* exercised. Save bytes are returned raw (base64-decoded); inflating (pako) and
|
|
54
|
+
* parsing into a save schema is left to the caller.
|
|
55
|
+
*
|
|
56
|
+
* @since 1.0.0
|
|
57
|
+
* @category SDK
|
|
58
|
+
*/
|
|
59
|
+
export * as PocketPlanes from "./PocketPlanes.ts";
|
|
60
|
+
/**
|
|
61
|
+
* The scopes the Pocket Planes api is guarded by, as a game-rooted tree, built with
|
|
62
|
+
* `@tinyburg/nimblebit-sdk`'s `defineGame`. Only the endpoints this sdk defines
|
|
63
|
+
* are covered; areas without both a read and a write side are left out until
|
|
64
|
+
* their endpoints exist.
|
|
65
|
+
*
|
|
66
|
+
* @since 1.0.0
|
|
67
|
+
* @category Scopes
|
|
68
|
+
*/
|
|
69
|
+
export * as Scopes from "./Scopes.ts";
|
|
70
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AAEjD;;;;;;;;GAQG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA"}
|