@efffrida/gplayapi 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/GooglePlayApi.d.ts +28 -29
- package/dist/GooglePlayApi.d.ts.map +1 -1
- package/dist/GooglePlayApi.js +77 -74
- package/dist/GooglePlayApi.js.map +1 -1
- package/dist/internal/auth.js +7 -8
- package/dist/internal/auth.js.map +1 -1
- package/dist/internal/device.js +52 -30
- package/dist/internal/device.js.map +1 -1
- package/dist/internal/http.js +36 -31
- package/dist/internal/http.js.map +1 -1
- package/package.json +6 -15
- package/src/GooglePlayApi.ts +177 -115
- package/src/internal/auth.ts +31 -47
- package/src/internal/device.ts +78 -37
- package/src/internal/http.ts +39 -33
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.js","names":["FileSystem","
|
|
1
|
+
{"version":3,"file":"device.js","names":["Effect","FileSystem","Path","Schema","SchemaGetter","SchemaTransformation","internalAuth","StringArrayFromString","suspend","splitter","split","separator","joiner","transform","arr","join","make","encode","decode","String","pipe","decodeTo","Array","BooleanFromString","Literals","Boolean","str","bool","AndroidDevice","Class","UserReadableName","NumberFromString","CellOperator","Client","Features","HasFiveWayNavigation","HasHardKeyboard","Keyboard","Locales","Navigation","Platforms","Roaming","ScreenLayout","SharedLibraries","SimCountry","optional","SimOperator","TimeZone","TouchScreen","authHeadersCache","undefined","fromPropertiesFile","fnUntraced","file","decodeDevice","decodeUnknownEffect","decodePropertiesFile","decodeEffect","Record","splitKeyValue","keyValueSeparator","fileSystem","content","readFileString","properties","EmbeddedPixel7a","flatMap","path","fromFileUrl","URL","import","meta","url","userAgent","deviceProperties","api","versionCode","sdk","device","hardware","product","platformVersionRelease","model","buildId","isWideScreen","supportedAbis","devicePropertiesString","Object","entries","map","k","v","authHeaders","gen","self"],"sources":["../../src/internal/device.ts"],"sourcesContent":[null],"mappings":"AAIA,OAAO,KAAKA,MAAM,MAAM,eAAe;AACvC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AAI,CAAC3C,gBAAgB,GAAG2C,WAAW;MACnC,OAAO,IAAI,CAAC3C,gBAAgB;IAChC;EACJ,CAAC,CAAC","ignoreList":[]}
|
package/dist/internal/http.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import * as Protobuf from "@bufbuild/protobuf";
|
|
2
|
-
import * as HttpClientError from "@effect/platform/HttpClientError";
|
|
3
|
-
import * as HttpClientRequest from "@effect/platform/HttpClientRequest";
|
|
4
|
-
import * as HttpClientResponse from "@effect/platform/HttpClientResponse";
|
|
5
1
|
import * as Effect from "effect/Effect";
|
|
6
2
|
import * as Function from "effect/Function";
|
|
7
3
|
import * as Predicate from "effect/Predicate";
|
|
4
|
+
import * as HttpClientError from "effect/unstable/http/HttpClientError";
|
|
5
|
+
import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest";
|
|
6
|
+
import * as HttpClientResponse from "effect/unstable/http/HttpClientResponse";
|
|
7
|
+
import * as Protobuf from "@bufbuild/protobuf";
|
|
8
8
|
import { ResponseWrapperSchema } from "../generated/GooglePlay_pb.js";
|
|
9
9
|
/** @internal */
|
|
10
10
|
export const encodeRequest = /*#__PURE__*/Function.dual(
|
|
11
11
|
// Data first if the first argument is an http request
|
|
12
|
-
arguments_ =>
|
|
12
|
+
arguments_ => HttpClientRequest.isHttpClientRequest(arguments_[0]),
|
|
13
13
|
/*#__PURE__*/
|
|
14
14
|
// Body implementation
|
|
15
15
|
Effect.fn("encodeRequest")(function* (request, description, body, options) {
|
|
@@ -19,11 +19,12 @@ Effect.fn("encodeRequest")(function* (request, description, body, options) {
|
|
|
19
19
|
try: () => Protobuf.toBinary(description, Protobuf.create(description, body), options ?? {
|
|
20
20
|
writeUnknownFields: true
|
|
21
21
|
}),
|
|
22
|
-
catch: cause => new HttpClientError.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
catch: cause => new HttpClientError.HttpClientError({
|
|
23
|
+
reason: new HttpClientError.EncodeError({
|
|
24
|
+
description: `Could not encode message of type ${messageType}`,
|
|
25
|
+
request,
|
|
26
|
+
cause
|
|
27
|
+
})
|
|
27
28
|
})
|
|
28
29
|
});
|
|
29
30
|
const applyBody = HttpClientRequest.bodyUint8Array(bytes, "application/x-protobuf");
|
|
@@ -43,20 +44,22 @@ Effect.fn("decodeResponse")(function* (response, protobufDescription, options) {
|
|
|
43
44
|
try: () => Protobuf.fromBinary(protobufDescription, new Uint8Array(arrayBuffer), options ?? {
|
|
44
45
|
readUnknownFields: true
|
|
45
46
|
}),
|
|
46
|
-
catch: cause => new HttpClientError.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
catch: cause => new HttpClientError.HttpClientError({
|
|
48
|
+
reason: new HttpClientError.DecodeError({
|
|
49
|
+
description: `Could not decode message of type ${messageType}`,
|
|
50
|
+
request: response.request,
|
|
51
|
+
response,
|
|
52
|
+
cause
|
|
53
|
+
})
|
|
52
54
|
})
|
|
53
55
|
});
|
|
54
56
|
if (Predicate.isUndefined(message)) {
|
|
55
|
-
return yield* new HttpClientError.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
return yield* new HttpClientError.HttpClientError({
|
|
58
|
+
reason: new HttpClientError.DecodeError({
|
|
59
|
+
description: `Message of type ${messageType} is missing`,
|
|
60
|
+
request: response.request,
|
|
61
|
+
response
|
|
62
|
+
})
|
|
60
63
|
});
|
|
61
64
|
}
|
|
62
65
|
return message;
|
|
@@ -70,20 +73,22 @@ arguments_ => Predicate.hasProperty(arguments_[0], HttpClientResponse.TypeId),
|
|
|
70
73
|
Effect.fn("decodeResponse")(function* (response, extractPayload, options) {
|
|
71
74
|
const responseWrapper = yield* decodeResponse(response, ResponseWrapperSchema, options);
|
|
72
75
|
if (Predicate.isNotUndefined(responseWrapper.commands?.displayErrorMessage)) {
|
|
73
|
-
return yield* new HttpClientError.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
return yield* new HttpClientError.HttpClientError({
|
|
77
|
+
reason: new HttpClientError.DecodeError({
|
|
78
|
+
description: responseWrapper.commands.displayErrorMessage,
|
|
79
|
+
request: response.request,
|
|
80
|
+
response
|
|
81
|
+
})
|
|
78
82
|
});
|
|
79
83
|
}
|
|
80
84
|
const extracted = responseWrapper.payload?.[extractPayload];
|
|
81
85
|
if (Predicate.isUndefined(extracted)) {
|
|
82
|
-
return yield* new HttpClientError.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
return yield* new HttpClientError.HttpClientError({
|
|
87
|
+
reason: new HttpClientError.DecodeError({
|
|
88
|
+
description: `ResponseWrapper has no payload of type ${extractPayload}`,
|
|
89
|
+
request: response.request,
|
|
90
|
+
response
|
|
91
|
+
})
|
|
87
92
|
});
|
|
88
93
|
}
|
|
89
94
|
return extracted;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","names":["
|
|
1
|
+
{"version":3,"file":"http.js","names":["Effect","Function","Predicate","HttpClientError","HttpClientRequest","HttpClientResponse","Protobuf","ResponseWrapperSchema","encodeRequest","dual","arguments_","isHttpClientRequest","fn","request","description","body","options","messageType","name","annotateCurrentSpan","bytes","try","toBinary","create","writeUnknownFields","catch","cause","reason","EncodeError","applyBody","bodyUint8Array","decodeResponse","hasProperty","TypeId","response","protobufDescription","arrayBuffer","message","fromBinary","Uint8Array","readUnknownFields","DecodeError","isUndefined","decodeResponseFromResponseWrapper","extractPayload","responseWrapper","isNotUndefined","commands","displayErrorMessage","extracted","payload"],"sources":["../../src/internal/http.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,QAAQ,MAAM,iBAAiB;AAC3C,OAAO,KAAKC,SAAS,MAAM,kBAAkB;AAC7C,OAAO,KAAKC,eAAe,MAAM,sCAAsC;AACvE,OAAO,KAAKC,iBAAiB,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AAS,CAAC8B,WAAW,CAACtB,UAAU,CAAC,CAAC,CAAC,EAAEL,kBAAkB,CAAC4B,MAAM,CAAC;AAAA;AAE3F;AACAjC,MAAM,CAACY,EAAE,CAAC,gBAAgB,CAAC,CAAC,WAMxBsB,QAA+C,EAC/CU,cAA8B,EAC9B5B,OAAyD;EAGzD,MAAM6B,eAAe,GAAG,OAAOd,cAAc,CAACG,QAAQ,EAAE3B,qBAAqB,EAAES,OAAO,CAAC;EAEvF,IAAId,SAAS,CAAC4C,cAAc,CAACD,eAAe,CAACE,QAAQ,EAAEC,mBAAmB,CAAC,EAAE;IACzE,OAAO,OAAO,IAAI7C,eAAe,CAACA,eAAe,CAAC;MAC9CwB,MAAM,EAAE,IAAIxB,eAAe,CAACsC,WAAW,CAAC;QACpC3B,WAAW,EAAE+B,eAAe,CAACE,QAAQ,CAACC,mBAAmB;QACzDnC,OAAO,EAAEqB,QAAQ,CAACrB,OAAO;QACzBqB;OACH;KACJ,CAAC;EACN;EAEA,MAAMe,SAAS,GAAGJ,eAAe,CAACK,OAAO,GAAGN,cAAc,CAAC;EAC3D,IAAI1C,SAAS,CAACwC,WAAW,CAACO,SAAS,CAAC,EAAE;IAClC,OAAO,OAAO,IAAI9C,eAAe,CAACA,eAAe,CAAC;MAC9CwB,MAAM,EAAE,IAAIxB,eAAe,CAACsC,WAAW,CAAC;QACpC3B,WAAW,EAAE,0CAA0C8B,cAAc,EAAE;QACvE/B,OAAO,EAAEqB,QAAQ,CAACrB,OAAO;QACzBqB;OACH;KACJ,CAAC;EACN;EAEA,OAAOe,SAAgB;AAC3B,CAAC,CAAC,CACL","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@efffrida/gplayapi",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Google play api",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"effect-ts",
|
|
@@ -37,26 +37,17 @@
|
|
|
37
37
|
"access": "public",
|
|
38
38
|
"provenance": true
|
|
39
39
|
},
|
|
40
|
-
"dependencies": {
|
|
41
|
-
"properties-file": "5.0.4"
|
|
42
|
-
},
|
|
43
40
|
"devDependencies": {
|
|
44
41
|
"@bufbuild/buf": "1.69.0",
|
|
45
42
|
"@bufbuild/protobuf": "2.12.0",
|
|
46
|
-
"@effect/
|
|
47
|
-
"@
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"@effect/rpc": "0.75.1",
|
|
51
|
-
"@effect/sql": "0.51.1",
|
|
52
|
-
"@effect/workflow": "0.18.1",
|
|
53
|
-
"@types/node": "25.7.0",
|
|
54
|
-
"effect": "3.21.2"
|
|
43
|
+
"@effect/platform-node": "4.0.0-beta.66",
|
|
44
|
+
"@types/node": "25.9.0",
|
|
45
|
+
"effect": "4.0.0-beta.66",
|
|
46
|
+
"ioredis": "5.10.1"
|
|
55
47
|
},
|
|
56
48
|
"peerDependencies": {
|
|
57
49
|
"@bufbuild/protobuf": "2.12.0",
|
|
58
|
-
"
|
|
59
|
-
"effect": "3.21.2"
|
|
50
|
+
"effect": "4.0.0-beta.66"
|
|
60
51
|
},
|
|
61
52
|
"tags": [
|
|
62
53
|
"frida.re",
|
package/src/GooglePlayApi.ts
CHANGED
|
@@ -5,129 +5,189 @@
|
|
|
5
5
|
* @since 1.0.0
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type * as PlatformError from "
|
|
9
|
-
import type * as
|
|
8
|
+
import type * as PlatformError from "effect/PlatformError";
|
|
9
|
+
import type * as Schema from "effect/Schema";
|
|
10
10
|
import type * as Scope from "effect/Scope";
|
|
11
|
+
import type * as HttpClientError from "effect/unstable/http/HttpClientError";
|
|
11
12
|
|
|
12
|
-
import * as FetchHttpClient from "@effect/platform/FetchHttpClient";
|
|
13
|
-
import * as FileSystem from "@effect/platform/FileSystem";
|
|
14
|
-
import * as HttpClient from "@effect/platform/HttpClient";
|
|
15
|
-
import * as HttpClientRequest from "@effect/platform/HttpClientRequest";
|
|
16
|
-
import * as HttpClientResponse from "@effect/platform/HttpClientResponse";
|
|
17
13
|
import * as Array from "effect/Array";
|
|
18
14
|
import * as Effect from "effect/Effect";
|
|
15
|
+
import * as FileSystem from "effect/FileSystem";
|
|
19
16
|
import * as Function from "effect/Function";
|
|
20
|
-
import * as Layer from "effect/Layer";
|
|
21
|
-
import * as Sink from "effect/Sink";
|
|
22
17
|
import * as Stream from "effect/Stream";
|
|
23
|
-
import * as
|
|
18
|
+
import * as HttpClient from "effect/unstable/http/HttpClient";
|
|
19
|
+
import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest";
|
|
20
|
+
import * as HttpClientResponse from "effect/unstable/http/HttpClientResponse";
|
|
21
|
+
|
|
22
|
+
import type { AndroidDevice } from "./internal/device.ts";
|
|
24
23
|
|
|
25
24
|
import {
|
|
26
25
|
BulkDetailsRequestSchema,
|
|
27
26
|
type BulkDetailsResponse,
|
|
28
27
|
type BuyResponse,
|
|
28
|
+
type DeliveryResponse,
|
|
29
29
|
type DetailsResponse,
|
|
30
30
|
} from "./generated/GooglePlay_pb.ts";
|
|
31
|
-
import { makeHttpClient } from "./internal/auth.ts";
|
|
32
|
-
import { Device } from "./internal/device.ts";
|
|
33
31
|
import { decodeResponseFromResponseWrapper, encodeRequest } from "./internal/http.ts";
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
* @since 1.0.0
|
|
38
|
-
* @category Auth
|
|
39
|
-
*/
|
|
40
|
-
makeHttpClient,
|
|
41
|
-
} from "./internal/auth.ts";
|
|
33
|
+
/** @internal */
|
|
34
|
+
const fdfeBase = "https://android.clients.google.com/fdfe";
|
|
42
35
|
|
|
43
36
|
export {
|
|
44
37
|
/**
|
|
45
38
|
* @since 1.0.0
|
|
46
39
|
* @category Device
|
|
47
40
|
*/
|
|
48
|
-
|
|
41
|
+
AndroidDevice,
|
|
49
42
|
} from "./internal/device.ts";
|
|
50
43
|
|
|
51
|
-
/**
|
|
52
|
-
* @since 1.0.0
|
|
53
|
-
* @category Auth
|
|
54
|
-
*/
|
|
55
|
-
export const defaultHttpClient = Function.pipe(
|
|
56
|
-
Device.fromPropertiesFile(url.fileURLToPath(new URL("../devices/arm64_xxhdpi.properties", import.meta.url))),
|
|
57
|
-
Effect.map(makeHttpClient),
|
|
58
|
-
Layer.unwrapEffect,
|
|
59
|
-
Layer.provide(FetchHttpClient.layer)
|
|
60
|
-
);
|
|
61
|
-
|
|
62
44
|
/**
|
|
63
45
|
* @since 1.0.0
|
|
64
46
|
* @category API
|
|
65
47
|
*/
|
|
66
|
-
export const details =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
48
|
+
export const details = Function.dual<
|
|
49
|
+
(
|
|
50
|
+
device: AndroidDevice
|
|
51
|
+
) => (
|
|
52
|
+
bundleIdentifier: string
|
|
53
|
+
) => Effect.Effect<DetailsResponse, HttpClientError.HttpClientError | Schema.SchemaError, HttpClient.HttpClient>,
|
|
54
|
+
(
|
|
55
|
+
bundleIdentifier: string,
|
|
56
|
+
device: AndroidDevice
|
|
57
|
+
) => Effect.Effect<DetailsResponse, HttpClientError.HttpClientError | Schema.SchemaError, HttpClient.HttpClient>
|
|
58
|
+
>(
|
|
59
|
+
2,
|
|
60
|
+
Effect.fnUntraced(function* (bundleIdentifier: string, device: AndroidDevice) {
|
|
61
|
+
const decoderDetailsResponse = decodeResponseFromResponseWrapper("detailsResponse");
|
|
62
|
+
const httpRequest = HttpClientRequest.get("/details", {
|
|
63
|
+
urlParams: { doc: bundleIdentifier },
|
|
64
|
+
headers: yield* device.authHeaders,
|
|
65
|
+
}).pipe(HttpClientRequest.prependUrl(fdfeBase));
|
|
66
|
+
|
|
67
|
+
const httpResponse = yield* HttpClient.execute(httpRequest);
|
|
68
|
+
const pbResponse = yield* decoderDetailsResponse(httpResponse);
|
|
69
|
+
return pbResponse;
|
|
70
|
+
})
|
|
71
|
+
);
|
|
73
72
|
|
|
74
73
|
/**
|
|
75
74
|
* @since 1.0.0
|
|
76
75
|
* @category API
|
|
77
76
|
*/
|
|
78
|
-
export const bulkDetails =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
export const bulkDetails = Function.dual<
|
|
78
|
+
(
|
|
79
|
+
device: AndroidDevice
|
|
80
|
+
) => (
|
|
81
|
+
bundleIdentifier: string
|
|
82
|
+
) => Effect.Effect<
|
|
83
|
+
BulkDetailsResponse,
|
|
84
|
+
HttpClientError.HttpClientError | Schema.SchemaError,
|
|
85
|
+
HttpClient.HttpClient
|
|
86
|
+
>,
|
|
87
|
+
(
|
|
88
|
+
bundleIdentifier: string,
|
|
89
|
+
device: AndroidDevice
|
|
90
|
+
) => Effect.Effect<BulkDetailsResponse, HttpClientError.HttpClientError | Schema.SchemaError, HttpClient.HttpClient>
|
|
91
|
+
>(
|
|
92
|
+
2,
|
|
93
|
+
Effect.fnUntraced(function* (bundleIdentifier: string, device: AndroidDevice) {
|
|
94
|
+
const decoderBulkDetailsResponse = decodeResponseFromResponseWrapper("bulkDetailsResponse");
|
|
95
|
+
const encoderBulkDetailsRequest = encodeRequest(BulkDetailsRequestSchema, {
|
|
84
96
|
includeDetails: true,
|
|
85
97
|
includeChildDocs: true,
|
|
86
98
|
DocId: [bundleIdentifier],
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const httpRequest = HttpClientRequest.post("/bulkDetails", {
|
|
102
|
+
headers: yield* device.authHeaders,
|
|
103
|
+
}).pipe(HttpClientRequest.prependUrl(fdfeBase));
|
|
104
|
+
|
|
105
|
+
const pbRequest = yield* encoderBulkDetailsRequest(httpRequest);
|
|
106
|
+
const httpResponse = yield* HttpClient.execute(pbRequest);
|
|
107
|
+
const pbResponse = yield* decoderBulkDetailsResponse(httpResponse);
|
|
108
|
+
return pbResponse;
|
|
109
|
+
})
|
|
110
|
+
);
|
|
91
111
|
|
|
92
112
|
/**
|
|
93
113
|
* @since 1.0.0
|
|
94
114
|
* @category API
|
|
95
115
|
*/
|
|
96
|
-
export const purchase =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
certificateHash?: string
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
116
|
+
export const purchase = Function.dual<
|
|
117
|
+
(
|
|
118
|
+
device: AndroidDevice
|
|
119
|
+
) => (
|
|
120
|
+
bundleIdentifier: string,
|
|
121
|
+
options: { offerType: number; versionCode: number | bigint; certificateHash?: string }
|
|
122
|
+
) => Effect.Effect<BuyResponse, HttpClientError.HttpClientError | Schema.SchemaError, HttpClient.HttpClient>,
|
|
123
|
+
(
|
|
124
|
+
bundleIdentifier: string,
|
|
125
|
+
options: { offerType: number; versionCode: number | bigint; certificateHash?: string },
|
|
126
|
+
device: AndroidDevice
|
|
127
|
+
) => Effect.Effect<BuyResponse, HttpClientError.HttpClientError | Schema.SchemaError, HttpClient.HttpClient>
|
|
128
|
+
>(
|
|
129
|
+
3,
|
|
130
|
+
Effect.fnUntraced(function* (
|
|
131
|
+
bundleIdentifier: string,
|
|
132
|
+
options: { offerType: number; versionCode: number | bigint; certificateHash?: string },
|
|
133
|
+
device: AndroidDevice
|
|
134
|
+
) {
|
|
135
|
+
const decoderBuyResponse = decodeResponseFromResponseWrapper("buyResponse");
|
|
136
|
+
const httpRequest = HttpClientRequest.post("/purchase", {
|
|
137
|
+
headers: yield* device.authHeaders,
|
|
106
138
|
urlParams: {
|
|
107
139
|
doc: bundleIdentifier,
|
|
108
140
|
ch: options.certificateHash ?? "",
|
|
109
141
|
ot: options.offerType.toString(),
|
|
110
142
|
vc: options.versionCode.toString(),
|
|
111
143
|
},
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
|
|
144
|
+
}).pipe(HttpClientRequest.prependUrl(fdfeBase));
|
|
145
|
+
|
|
146
|
+
const httpResponse = yield* HttpClient.execute(httpRequest);
|
|
147
|
+
const pbResponse = yield* decoderBuyResponse(httpResponse);
|
|
148
|
+
return pbResponse;
|
|
149
|
+
})
|
|
150
|
+
);
|
|
115
151
|
|
|
116
152
|
/**
|
|
117
153
|
* @since 1.0.0
|
|
118
154
|
* @category API
|
|
119
155
|
*/
|
|
120
|
-
export const delivery =
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
Effect.
|
|
130
|
-
|
|
156
|
+
export const delivery = Function.dual<
|
|
157
|
+
(device: AndroidDevice) => (
|
|
158
|
+
bundleIdentifier: string,
|
|
159
|
+
options: {
|
|
160
|
+
offerType: number;
|
|
161
|
+
deliveryToken: string;
|
|
162
|
+
versionCode: number | bigint;
|
|
163
|
+
certificateHash?: string | undefined;
|
|
164
|
+
}
|
|
165
|
+
) => Effect.Effect<DeliveryResponse, HttpClientError.HttpClientError | Schema.SchemaError, HttpClient.HttpClient>,
|
|
166
|
+
(
|
|
167
|
+
bundleIdentifier: string,
|
|
168
|
+
options: {
|
|
169
|
+
offerType: number;
|
|
170
|
+
deliveryToken: string;
|
|
171
|
+
versionCode: number | bigint;
|
|
172
|
+
certificateHash?: string | undefined;
|
|
173
|
+
},
|
|
174
|
+
device: AndroidDevice
|
|
175
|
+
) => Effect.Effect<DeliveryResponse, HttpClientError.HttpClientError | Schema.SchemaError, HttpClient.HttpClient>
|
|
176
|
+
>(
|
|
177
|
+
3,
|
|
178
|
+
Effect.fnUntraced(function* (
|
|
179
|
+
bundleIdentifier: string,
|
|
180
|
+
options: {
|
|
181
|
+
offerType: number;
|
|
182
|
+
deliveryToken: string;
|
|
183
|
+
versionCode: number | bigint;
|
|
184
|
+
certificateHash?: string | undefined;
|
|
185
|
+
},
|
|
186
|
+
device: AndroidDevice
|
|
187
|
+
) {
|
|
188
|
+
const decoderDeliveryResponse = decodeResponseFromResponseWrapper("deliveryResponse");
|
|
189
|
+
const httpRequest = HttpClientRequest.get("/delivery", {
|
|
190
|
+
headers: yield* device.authHeaders,
|
|
131
191
|
urlParams: {
|
|
132
192
|
doc: bundleIdentifier,
|
|
133
193
|
dtok: options.deliveryToken,
|
|
@@ -135,34 +195,41 @@ export const delivery = (
|
|
|
135
195
|
ot: options.offerType.toString(),
|
|
136
196
|
vc: options.versionCode.toString(),
|
|
137
197
|
},
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
|
|
198
|
+
}).pipe(HttpClientRequest.prependUrl(fdfeBase));
|
|
199
|
+
|
|
200
|
+
const httpResponse = yield* HttpClient.execute(httpRequest);
|
|
201
|
+
const pbResponse = yield* decoderDeliveryResponse(httpResponse);
|
|
202
|
+
return pbResponse;
|
|
203
|
+
})
|
|
204
|
+
);
|
|
141
205
|
|
|
142
206
|
/**
|
|
143
207
|
* @since 1.0.0
|
|
144
208
|
* @category API
|
|
145
209
|
*/
|
|
146
|
-
export const download = Effect.fnUntraced(function* (
|
|
210
|
+
export const download = Effect.fnUntraced(function* (
|
|
211
|
+
device: AndroidDevice,
|
|
212
|
+
bundleIdentifier: string
|
|
213
|
+
): Effect.fn.Return<
|
|
147
214
|
Array.NonEmptyReadonlyArray<{
|
|
148
215
|
url: string;
|
|
149
216
|
name: string;
|
|
150
217
|
file: string;
|
|
151
|
-
size:
|
|
218
|
+
size: bigint;
|
|
152
219
|
integrity: { sha1: string } | { sha256: string };
|
|
153
220
|
}>,
|
|
154
|
-
PlatformError.PlatformError | HttpClientError.HttpClientError,
|
|
221
|
+
PlatformError.PlatformError | HttpClientError.HttpClientError | Schema.SchemaError,
|
|
155
222
|
HttpClient.HttpClient | FileSystem.FileSystem | Scope.Scope
|
|
156
223
|
> {
|
|
157
224
|
const fileSystem = yield* FileSystem.FileSystem;
|
|
158
225
|
|
|
159
|
-
const { item } = yield* details(bundleIdentifier);
|
|
160
|
-
const { encodedDeliveryToken } = yield* purchase(bundleIdentifier, {
|
|
226
|
+
const { item } = yield* details(device)(bundleIdentifier);
|
|
227
|
+
const { encodedDeliveryToken } = yield* purchase(device)(bundleIdentifier, {
|
|
161
228
|
offerType: item?.offer[0].offerType ?? 1,
|
|
162
229
|
versionCode: item?.details?.appDetails?.versionCode ?? 0,
|
|
163
230
|
});
|
|
164
231
|
|
|
165
|
-
const deliveryResult = yield* delivery(bundleIdentifier, {
|
|
232
|
+
const deliveryResult = yield* delivery(device)(bundleIdentifier, {
|
|
166
233
|
deliveryToken: encodedDeliveryToken,
|
|
167
234
|
offerType: item?.offer[0].offerType ?? 1,
|
|
168
235
|
versionCode: item?.details?.appDetails?.versionCode ?? 0,
|
|
@@ -170,36 +237,31 @@ export const download = Effect.fnUntraced(function* (bundleIdentifier: string):
|
|
|
170
237
|
|
|
171
238
|
const mainDeliveryData = deliveryResult?.appDeliveryData;
|
|
172
239
|
if (mainDeliveryData === undefined) {
|
|
173
|
-
return yield* Effect.
|
|
240
|
+
return yield* Effect.die("No delivery data available");
|
|
174
241
|
}
|
|
175
242
|
|
|
176
|
-
const
|
|
177
|
-
algorithm: "SHA-1" | "SHA-256" | "SHA-384" | "SHA-512"
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
.
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
243
|
+
const digest =
|
|
244
|
+
(algorithm: "SHA-1" | "SHA-256" | "SHA-384" | "SHA-512") =>
|
|
245
|
+
<E, R>(stream: Stream.Stream<Uint8Array, E, R>): Effect.Effect<string, E, R> =>
|
|
246
|
+
stream.pipe(
|
|
247
|
+
Stream.mkUint8Array,
|
|
248
|
+
Effect.flatMap((buffer) =>
|
|
249
|
+
Effect.promise(() => crypto.subtle.digest(algorithm, buffer as BufferSource))
|
|
250
|
+
),
|
|
251
|
+
Effect.map((digestBuffer) =>
|
|
252
|
+
Array.fromIterable(new Uint8Array(digestBuffer))
|
|
253
|
+
.map((b) => b.toString(16).padStart(2, "0"))
|
|
254
|
+
.join("")
|
|
255
|
+
)
|
|
188
256
|
);
|
|
189
257
|
|
|
190
|
-
return Sink.mapEffect(
|
|
191
|
-
Sink.foldLeft(Buffer.alloc(0), (acc, chunk: Uint8Array) => Buffer.concat([acc, chunk])),
|
|
192
|
-
digestToHex
|
|
193
|
-
);
|
|
194
|
-
};
|
|
195
|
-
|
|
196
258
|
const main = Effect.gen(function* () {
|
|
197
259
|
const file = yield* fileSystem.makeTempFileScoped({ suffix: ".apk" });
|
|
198
260
|
const integrity = Buffer.from(mainDeliveryData.sha256, "base64url").toString("hex");
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
261
|
+
const downloadedIntegrity = yield* HttpClient.get(mainDeliveryData.downloadUrl).pipe(
|
|
262
|
+
HttpClientResponse.stream,
|
|
263
|
+
Stream.tapSink(fileSystem.sink(file)),
|
|
264
|
+
digest("SHA-256")
|
|
203
265
|
);
|
|
204
266
|
|
|
205
267
|
yield* Effect.logDebug(
|
|
@@ -207,7 +269,7 @@ export const download = Effect.fnUntraced(function* (bundleIdentifier: string):
|
|
|
207
269
|
);
|
|
208
270
|
|
|
209
271
|
if (downloadedIntegrity !== integrity) {
|
|
210
|
-
return yield* Effect.
|
|
272
|
+
return yield* Effect.die(
|
|
211
273
|
`Downloaded main APK integrity mismatch: expected ${integrity}, got ${downloadedIntegrity}`
|
|
212
274
|
);
|
|
213
275
|
}
|
|
@@ -225,10 +287,10 @@ export const download = Effect.fnUntraced(function* (bundleIdentifier: string):
|
|
|
225
287
|
Effect.gen(function* () {
|
|
226
288
|
const file = yield* fileSystem.makeTempFileScoped({ suffix: ".apk" });
|
|
227
289
|
const integrity = Buffer.from(split.sha256, "base64url").toString("hex");
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
290
|
+
const downloadedIntegrity = yield* HttpClient.get(split.downloadUrl).pipe(
|
|
291
|
+
HttpClientResponse.stream,
|
|
292
|
+
Stream.tapSink(fileSystem.sink(file)),
|
|
293
|
+
digest("SHA-256")
|
|
232
294
|
);
|
|
233
295
|
|
|
234
296
|
yield* Effect.logDebug(
|
|
@@ -236,7 +298,7 @@ export const download = Effect.fnUntraced(function* (bundleIdentifier: string):
|
|
|
236
298
|
);
|
|
237
299
|
|
|
238
300
|
if (downloadedIntegrity !== integrity) {
|
|
239
|
-
return yield* Effect.
|
|
301
|
+
return yield* Effect.die(
|
|
240
302
|
`Downloaded split ${split.name} integrity mismatch: expected ${integrity}, got ${downloadedIntegrity}`
|
|
241
303
|
);
|
|
242
304
|
}
|
|
@@ -257,10 +319,10 @@ export const download = Effect.fnUntraced(function* (bundleIdentifier: string):
|
|
|
257
319
|
const name = `${typeStr}.${expansion.versionCode}.${bundleIdentifier}.obb`;
|
|
258
320
|
const file = yield* fileSystem.makeTempFileScoped({ suffix: ".obb" });
|
|
259
321
|
const integrity = Buffer.from(expansion.sha1, "base64url").toString("hex");
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
322
|
+
const downloadedIntegrity = yield* HttpClient.get(expansion.downloadUrl).pipe(
|
|
323
|
+
HttpClientResponse.stream,
|
|
324
|
+
Stream.tapSink(fileSystem.sink(file)),
|
|
325
|
+
digest("SHA-1")
|
|
264
326
|
);
|
|
265
327
|
|
|
266
328
|
yield* Effect.logDebug(
|
|
@@ -268,7 +330,7 @@ export const download = Effect.fnUntraced(function* (bundleIdentifier: string):
|
|
|
268
330
|
);
|
|
269
331
|
|
|
270
332
|
if (downloadedIntegrity !== integrity) {
|
|
271
|
-
return yield* Effect.
|
|
333
|
+
return yield* Effect.die(
|
|
272
334
|
`Downloaded expansion file ${name} integrity mismatch: expected ${integrity}, got ${downloadedIntegrity}`
|
|
273
335
|
);
|
|
274
336
|
}
|