@ikenxuan/amagi 7.0.0-beta.3 → 7.0.0-beta.5
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/default/index.cjs +1 -1
- package/dist/default/index.d.ts +1 -1
- package/dist/default/index.mjs +1 -1
- package/dist/exports/compat.cjs +1 -1
- package/dist/exports/compat.d.ts +7022 -127
- package/dist/exports/compat.mjs +1 -1
- package/dist/exports/signing.d.ts +58 -58
- package/dist/{index-CySQMTrB.d.ts → index-TDTBTnNP.d.ts} +11677 -258
- package/dist/{src-bG9knrUJ.cjs → src-DixrwqqA.cjs} +251 -231
- package/dist/{src-B9Len1oc.mjs → src-blqLvYiW.mjs} +251 -231
- package/package.json +6 -13
- package/dist/exports/chalk.cjs +0 -9
- package/dist/exports/chalk.d.ts +0 -1
- package/dist/exports/chalk.mjs +0 -2
package/dist/exports/compat.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as unwrap, A as douyinFetcher, B as xiaohongshuSign, C as ValidationError, Ct as parseDmSegMobileReply, D as createBoundKuaishouFetcher, E as xiaohongshuFetcher, F as bilibiliFetcher, G as createDouyinRoutes, H as createKuaishouRoutes, I as createBoundBilibiliFetcher, J as bilibiliUtils, K as passport_exports, L as createClient, M as requestPassportQrcode, N as sendPassportVerifyCode, O as kuaishouFetcher, P as validatePassportVerifyCode, Q as isSuccess, R as xiaohongshuUtils, S as ApiError, St as emitNetworkRetry, T as createBoundXiaohongshuFetcher, Tt as bv2av, U as kuaishouSign, V as kuaishouUtils, W as douyinUtils, X as AmagiThrownError, Y as createBilibiliRoutes, Z as isFailure, _ as validateBilibiliParams, _t as emitLogError, a as AdditionalType, at as wbi_sign, b as validateXiaohongshuParams, bt as emitLogWarn, c as createAmagiClient, ct as fetchResponse, d as assertValidBilibiliParams, dt as emitApiError, et as AMAGI_BUS_EVENT_NAMES, f as assertValidDouyinParams, ft as emitApiSuccess, g as createSuccessResponse, gt as emitLogDebug, h as createErrorResponse, ht as emitLog, i as DynamicType, it as qtparam, j as checkPassportQrcode, k as createBoundDouyinFetcher, l as kuaishouApiUrls, lt as isNetworkErrorResult, m as assertValidXiaohongshuParams, mt as emitHttpResponse, n as CreateApp, nt as KUAISHOU_PC_CAPTCHA_RESULT, o as MajorType, ot as bilibiliApiUrls, p as assertValidKuaishouParams, pt as emitHttpRequest, q as douyinSign, r as amagi, rt as parseKuaishouCaptcha, s as CommentType, st as fetchData, tt as KUAISHOU_H5_CAPTCHA_RESULT, u as douyinApiUrls, ut as amagiEvents, v as validateDouyinParams, vt as emitLogInfo, w as handleError, wt as av2bv, x as xiaohongshuApiUrls, xt as emitNetworkError, y as validateKuaishouParams, yt as emitLogMark, z as createXiaohongshuRoutes } from "../src-
|
|
1
|
+
import { $ as unwrap, A as douyinFetcher, B as xiaohongshuSign, C as ValidationError, Ct as parseDmSegMobileReply, D as createBoundKuaishouFetcher, E as xiaohongshuFetcher, F as bilibiliFetcher, G as createDouyinRoutes, H as createKuaishouRoutes, I as createBoundBilibiliFetcher, J as bilibiliUtils, K as passport_exports, L as createClient, M as requestPassportQrcode, N as sendPassportVerifyCode, O as kuaishouFetcher, P as validatePassportVerifyCode, Q as isSuccess, R as xiaohongshuUtils, S as ApiError, St as emitNetworkRetry, T as createBoundXiaohongshuFetcher, Tt as bv2av, U as kuaishouSign, V as kuaishouUtils, W as douyinUtils, X as AmagiThrownError, Y as createBilibiliRoutes, Z as isFailure, _ as validateBilibiliParams, _t as emitLogError, a as AdditionalType, at as wbi_sign, b as validateXiaohongshuParams, bt as emitLogWarn, c as createAmagiClient, ct as fetchResponse, d as assertValidBilibiliParams, dt as emitApiError, et as AMAGI_BUS_EVENT_NAMES, f as assertValidDouyinParams, ft as emitApiSuccess, g as createSuccessResponse, gt as emitLogDebug, h as createErrorResponse, ht as emitLog, i as DynamicType, it as qtparam, j as checkPassportQrcode, k as createBoundDouyinFetcher, l as kuaishouApiUrls, lt as isNetworkErrorResult, m as assertValidXiaohongshuParams, mt as emitHttpResponse, n as CreateApp, nt as KUAISHOU_PC_CAPTCHA_RESULT, o as MajorType, ot as bilibiliApiUrls, p as assertValidKuaishouParams, pt as emitHttpRequest, q as douyinSign, r as amagi, rt as parseKuaishouCaptcha, s as CommentType, st as fetchData, tt as KUAISHOU_H5_CAPTCHA_RESULT, u as douyinApiUrls, ut as amagiEvents, v as validateDouyinParams, vt as emitLogInfo, w as handleError, wt as av2bv, x as xiaohongshuApiUrls, xt as emitNetworkError, y as validateKuaishouParams, yt as emitLogMark, z as createXiaohongshuRoutes } from "../src-blqLvYiW.mjs";
|
|
2
2
|
//#region src/exports/compat.ts
|
|
3
3
|
/** 模块级只执行一次的迁移提示(不刷屏) */
|
|
4
4
|
emitLogWarn("[@ikenxuan/amagi/compat] 你正在使用 v6 兼容入口;v7 迁移说明见 https://github.com/ikenxuan/amagi (v8 将移除 compat)");
|
|
@@ -39,30 +39,30 @@
|
|
|
39
39
|
* 就是一个把柄——{@link HEADER_NOISE_BANDS} 与 {@link tripwireNoise} 就是为此存在。
|
|
40
40
|
*/
|
|
41
41
|
/** bdms.js 携带的五张字母表中,本文件用得到的两张:`s4` 编码成品签名,`s3` 编码进入第三条摘要的 UA */
|
|
42
|
-
declare const ALPHABETS: {
|
|
42
|
+
export declare const ALPHABETS: {
|
|
43
43
|
readonly s3: 'ckdp1h4ZKsUB80/Mfvw36XIgR25+WQAlEi7NLboqYTOPuzmFjJnryx9HVGDaStCe';
|
|
44
44
|
readonly s4: 'Dkdpgh2ZmsQB80/MfvV36XI1R45-WUAlEixNLwoqYTOPuzKFjJnry79HbGcaStCe';
|
|
45
45
|
};
|
|
46
46
|
/** 摘要前拼在 query 与 body 后面的盐值。实测值,不是猜的——见文件头 */
|
|
47
|
-
declare const SALT = "dhzx";
|
|
47
|
+
export declare const SALT = "dhzx";
|
|
48
48
|
/** header 携带的两个明文字节,是这套格式最接近魔数的东西,也是 {@link structureError} 的第一道检查 */
|
|
49
|
-
declare const HEADER_MAGIC: readonly number[];
|
|
49
|
+
export declare const HEADER_MAGIC: readonly number[];
|
|
50
50
|
/** `"1.0.1.19-fix.01"` 被 SDK 解析后的版本块,实测解码结果 */
|
|
51
|
-
declare const SDK_VERSION: readonly number[];
|
|
51
|
+
export declare const SDK_VERSION: readonly number[];
|
|
52
52
|
/** 单字节,且是全部的密钥。密文不是教科书 RC4,见 {@link rc4} */
|
|
53
|
-
declare const PAYLOAD_KEY = 211;
|
|
53
|
+
export declare const PAYLOAD_KEY = 211;
|
|
54
54
|
/** `2024-07-24T16:00:00Z`,有一个字段从此刻起数「两周」 */
|
|
55
|
-
declare const FORTNIGHT_EPOCH_MS = 1721836800000;
|
|
55
|
+
export declare const FORTNIGHT_EPOCH_MS = 1721836800000;
|
|
56
56
|
/** 抖音 Web 自己的标识,不是我们能选的:它同时出现在签名里和 query 里,两边不一致就是最廉价的把柄 */
|
|
57
|
-
declare const PAGE_ID = 6241;
|
|
58
|
-
declare const AID = 6383;
|
|
57
|
+
export declare const PAGE_ID = 6241;
|
|
58
|
+
export declare const AID = 6383;
|
|
59
59
|
/**
|
|
60
60
|
* 五十个标量字段在 body 里的排列顺序。
|
|
61
61
|
*
|
|
62
62
|
* 不是密码,只是一个固定置换;写成字面量而不是算出来,是因为字节码里就是这样,
|
|
63
63
|
* 而且照着真实捕获核对的人希望看到和解码器打印的同一个顺序。
|
|
64
64
|
*/
|
|
65
|
-
declare const FIELD_ORDER: readonly string[];
|
|
65
|
+
export declare const FIELD_ORDER: readonly string[];
|
|
66
66
|
/** 一条摘要链:三个槽位名、两个直接写入的摘要下标、一个金丝雀三元组 */
|
|
67
67
|
interface DigestChain {
|
|
68
68
|
readonly slots: readonly [string, string, string];
|
|
@@ -78,16 +78,16 @@ interface DigestChain {
|
|
|
78
78
|
* body / UA 就是这份签名封住的那一个,又远不足以把哈希倒推回去。把它们报成
|
|
79
79
|
* 「query 本身」的解码器是在编造;拿候选值去校验的解码器才在说真话。
|
|
80
80
|
*/
|
|
81
|
-
declare const DIGEST_CHAINS: Readonly<Record<'query' | 'body' | 'user_agent', DigestChain>>;
|
|
81
|
+
export declare const DIGEST_CHAINS: Readonly<Record<'query' | 'body' | 'user_agent', DigestChain>>;
|
|
82
82
|
/** 未被插桩的真实页面回报的环境值:六个探针加一个反机器人位集 */
|
|
83
|
-
declare const ENV_FLAGS = 1;
|
|
84
|
-
declare const DETECT_FLAGS = 14;
|
|
83
|
+
export declare const ENV_FLAGS = 1;
|
|
84
|
+
export declare const DETECT_FLAGS = 14;
|
|
85
85
|
/** `window.onwheelx._Ax` 存在且被冻结——SDK 给自己装上再冻住的状态。12 表示被人解锁、11 表示缺失,两者都是抖音能打分的特征 */
|
|
86
|
-
declare const TRIPWIRE_LOCKED = 3;
|
|
86
|
+
export declare const TRIPWIRE_LOCKED = 3;
|
|
87
87
|
/** `fn149` 给每页签名计数器分桶。6 表示「本页签名少于 140 次」,浏览器一生中大部分时间都在这里 */
|
|
88
|
-
declare const CALL_BUCKET = 6;
|
|
88
|
+
export declare const CALL_BUCKET = 6;
|
|
89
89
|
/** 1080p 上的 Chrome。指纹里没有屏幕尺寸时用它——**一个可信的常量好过随机值**,随请求变的几何本身就是特征 */
|
|
90
|
-
declare const DEFAULT_BROWSER_INFO = "1920|947|1920|1032|1920|1032|1920|1080|Win32";
|
|
90
|
+
export declare const DEFAULT_BROWSER_INFO = "1920|947|1920|1032|1920|1032|1920|1080|Win32";
|
|
91
91
|
/**
|
|
92
92
|
* 按九个字段拼出签名会逐字携带的 `navigator`/`screen` 串。
|
|
93
93
|
*
|
|
@@ -95,7 +95,7 @@ declare const DEFAULT_BROWSER_INFO = "1920|947|1920|1032|1920|1032|1920|1080|Win
|
|
|
95
95
|
* @param parts - 九个字段,顺序同 SDK 自己的对象字面量
|
|
96
96
|
* @returns 以 `|` 连接的几何串
|
|
97
97
|
*/
|
|
98
|
-
declare const buildBrowserInfo: (parts: {
|
|
98
|
+
export declare const buildBrowserInfo: (parts: {
|
|
99
99
|
innerWidth: number;
|
|
100
100
|
innerHeight: number;
|
|
101
101
|
outerWidth: number;
|
|
@@ -116,7 +116,7 @@ declare const buildBrowserInfo: (parts: {
|
|
|
116
116
|
* @param platform - `navigator.platform`
|
|
117
117
|
* @returns 九字段几何串
|
|
118
118
|
*/
|
|
119
|
-
declare const browserInfoFromScreen: (width: number, height: number, platform: string) => string;
|
|
119
|
+
export declare const browserInfoFromScreen: (width: number, height: number, platform: string) => string;
|
|
120
120
|
/**
|
|
121
121
|
* SDK 的 RC4 —— 但它不是 RC4。
|
|
122
122
|
*
|
|
@@ -129,21 +129,21 @@ declare const browserInfoFromScreen: (width: number, height: number, platform: s
|
|
|
129
129
|
* @param data - 待处理数据
|
|
130
130
|
* @returns 与输入等长的结果
|
|
131
131
|
*/
|
|
132
|
-
declare const rc4: (key: readonly number[], data: readonly number[]) => number[];
|
|
132
|
+
export declare const rc4: (key: readonly number[], data: readonly number[]) => number[];
|
|
133
133
|
/**
|
|
134
134
|
* 按 SDK 的字母表做 base64,补位是字面量 `=`。
|
|
135
135
|
* @param data - 待编码字节
|
|
136
136
|
* @param alphabet - `s3` 或 `s4`
|
|
137
137
|
* @returns base64 文本
|
|
138
138
|
*/
|
|
139
|
-
declare const encodeBase64: (data: readonly number[], alphabet?: keyof typeof ALPHABETS) => string;
|
|
139
|
+
export declare const encodeBase64: (data: readonly number[], alphabet?: keyof typeof ALPHABETS) => string;
|
|
140
140
|
/**
|
|
141
141
|
* {@link encodeBase64} 的逆。遇到非本表字符时抛错。
|
|
142
142
|
* @param text - base64 文本
|
|
143
143
|
* @param alphabet - `s3` 或 `s4`
|
|
144
144
|
* @returns 解出的字节
|
|
145
145
|
*/
|
|
146
|
-
declare const decodeBase64: (text: string, alphabet?: keyof typeof ALPHABETS) => number[];
|
|
146
|
+
export declare const decodeBase64: (text: string, alphabet?: keyof typeof ALPHABETS) => number[];
|
|
147
147
|
/**
|
|
148
148
|
* 一个 JS 字符串被 SDK 转成字节的方式——**不是 UTF-8**。
|
|
149
149
|
*
|
|
@@ -157,7 +157,7 @@ declare const decodeBase64: (text: string, alphabet?: keyof typeof ALPHABETS) =>
|
|
|
157
157
|
* @param text - 待转换文本
|
|
158
158
|
* @returns 按 JS 码元语义切出的字节
|
|
159
159
|
*/
|
|
160
|
-
declare const jsBytes: (text: string) => number[];
|
|
160
|
+
export declare const jsBytes: (text: string) => number[];
|
|
161
161
|
/**
|
|
162
162
|
* 摘要里从 `offset` 起第一个不等于 `sentinel` 的字节。
|
|
163
163
|
*
|
|
@@ -169,7 +169,7 @@ declare const jsBytes: (text: string) => number[];
|
|
|
169
169
|
* @param fallback - 全被保留时的兜底
|
|
170
170
|
* @returns 该槽位的字节
|
|
171
171
|
*/
|
|
172
|
-
declare const canary: (digest: readonly number[], offset: number, sentinel: number, fallback: number) => number;
|
|
172
|
+
export declare const canary: (digest: readonly number[], offset: number, sentinel: number, fallback: number) => number;
|
|
173
173
|
/**
|
|
174
174
|
* `SM3(SM3(text + salt))`,32 个整数。
|
|
175
175
|
*
|
|
@@ -179,13 +179,13 @@ declare const canary: (digest: readonly number[], offset: number, sentinel: numb
|
|
|
179
179
|
* @param salt - 拼接的盐值
|
|
180
180
|
* @returns 摘要
|
|
181
181
|
*/
|
|
182
|
-
declare const digestWith: (text: string, salt: string) => number[];
|
|
182
|
+
export declare const digestWith: (text: string, salt: string) => number[];
|
|
183
183
|
/**
|
|
184
184
|
* `SM3(SM3(text + SALT))`,32 个整数。
|
|
185
185
|
* @param text - 待摘要文本
|
|
186
186
|
* @returns 摘要
|
|
187
187
|
*/
|
|
188
|
-
declare const digestOf: (text: string) => number[];
|
|
188
|
+
export declare const digestOf: (text: string) => number[];
|
|
189
189
|
/**
|
|
190
190
|
* 第三条链:把 UA 过一遍非标准 RC4、base64,再摘要**一次**。
|
|
191
191
|
*
|
|
@@ -202,7 +202,7 @@ declare const digestOf: (text: string) => number[];
|
|
|
202
202
|
* @param flags - 环境探针值,默认取本模块的常量
|
|
203
203
|
* @returns 摘要
|
|
204
204
|
*/
|
|
205
|
-
declare const userAgentDigest: (userAgent: string, flags?: {
|
|
205
|
+
export declare const userAgentDigest: (userAgent: string, flags?: {
|
|
206
206
|
envFlags?: number;
|
|
207
207
|
detectFlags?: number;
|
|
208
208
|
}) => number[];
|
|
@@ -212,9 +212,9 @@ declare const userAgentDigest: (userAgent: string, flags?: {
|
|
|
212
212
|
* @param digest - 该链自己的摘要
|
|
213
213
|
* @returns 三个字节
|
|
214
214
|
*/
|
|
215
|
-
declare const chainBytes: (chain: DigestChain, digest: readonly number[]) => [number, number, number];
|
|
215
|
+
export declare const chainBytes: (chain: DigestChain, digest: readonly number[]) => [number, number, number];
|
|
216
216
|
/** {@link maskPair} 的逆:把每个字节的载荷半边取回来 */
|
|
217
|
-
declare const unmaskPair: (carrier: readonly number[]) => [number, number];
|
|
217
|
+
export declare const unmaskPair: (carrier: readonly number[]) => [number, number];
|
|
218
218
|
/** {@link ABogus} 的构造参数 */
|
|
219
219
|
interface ABogusOptions {
|
|
220
220
|
/** 九字段几何串,默认 {@link DEFAULT_BROWSER_INFO}。传 {@link browserInfoFromScreen} 的产物可以让它与身份一致 */
|
|
@@ -245,7 +245,7 @@ interface ABogusSignOptions {
|
|
|
245
245
|
* 除配置外无状态、也很便宜,所以「一个身份一个实例」是自然的生命周期。
|
|
246
246
|
* `rng` 存在的意义是让测试能钉住噪声——它产出什么,签名都是对的。
|
|
247
247
|
*/
|
|
248
|
-
declare class ABogus {
|
|
248
|
+
export declare class ABogus {
|
|
249
249
|
private readonly userAgent;
|
|
250
250
|
private readonly browserInfo;
|
|
251
251
|
private readonly pageId;
|
|
@@ -269,7 +269,7 @@ declare class ABogus {
|
|
|
269
269
|
* @param problem - {@link structureError} 的返回
|
|
270
270
|
* @returns 是否属于格式性失败
|
|
271
271
|
*/
|
|
272
|
-
declare const isDecodeProblem: (problem: string | null | undefined) => boolean;
|
|
272
|
+
export declare const isDecodeProblem: (problem: string | null | undefined) => boolean;
|
|
273
273
|
/** {@link decode} 的结果 */
|
|
274
274
|
interface DecodedABogus {
|
|
275
275
|
headerMagic: [number, number];
|
|
@@ -300,7 +300,7 @@ interface DecodedABogus {
|
|
|
300
300
|
* @param alphabet - 字母表,默认 `s4`
|
|
301
301
|
* @returns 问题标识或 `null`
|
|
302
302
|
*/
|
|
303
|
-
declare const structureError: (value: string, alphabet?: keyof typeof ALPHABETS) => string | null;
|
|
303
|
+
export declare const structureError: (value: string, alphabet?: keyof typeof ALPHABETS) => string | null;
|
|
304
304
|
/**
|
|
305
305
|
* 把一份 `a_bogus` 拆开。用于诊断与测试,不用于签名。
|
|
306
306
|
*
|
|
@@ -310,7 +310,7 @@ declare const structureError: (value: string, alphabet?: keyof typeof ALPHABETS)
|
|
|
310
310
|
* @param alphabet - 字母表,默认 `s4`
|
|
311
311
|
* @returns 可还原的字段
|
|
312
312
|
*/
|
|
313
|
-
declare const decode: (value: string, alphabet?: keyof typeof ALPHABETS) => DecodedABogus;
|
|
313
|
+
export declare const decode: (value: string, alphabet?: keyof typeof ALPHABETS) => DecodedABogus;
|
|
314
314
|
//#endregion
|
|
315
315
|
//#region src/platforms/douyin/sign/decode.d.ts
|
|
316
316
|
/**
|
|
@@ -348,7 +348,7 @@ declare const decode: (value: string, alphabet?: keyof typeof ALPHABETS) => Deco
|
|
|
348
348
|
* 这里没有任何东西用于签名。它只跑在调用方已经持有的值上,不碰网络、不消耗身份。
|
|
349
349
|
*/
|
|
350
350
|
/** 字段是什么。控制台按它上色,调用方也可以对它分支 */
|
|
351
|
-
declare const KIND: {
|
|
351
|
+
export declare const KIND: {
|
|
352
352
|
/** 从载荷里直接读出,就是签名者放进去的东西 */
|
|
353
353
|
readonly PLAIN: 'plain';
|
|
354
354
|
/** 一个时钟,同时给出原始数字与 ISO-8601 时刻 */
|
|
@@ -363,14 +363,14 @@ declare const KIND: {
|
|
|
363
363
|
readonly OPAQUE: 'opaque';
|
|
364
364
|
};
|
|
365
365
|
/** 一个参数底下为什么没有明文 */
|
|
366
|
-
declare const REASON: {
|
|
366
|
+
export declare const REASON: {
|
|
367
367
|
readonly MALFORMED: 'malformed';
|
|
368
368
|
readonly NOT_COMPUTED: 'not_computed';
|
|
369
369
|
readonly ONE_WAY: 'one_way';
|
|
370
370
|
readonly UNKNOWN_PARAMETER: 'unknown_parameter';
|
|
371
371
|
};
|
|
372
372
|
/** 候选输入是不是签名封住的那一个 */
|
|
373
|
-
declare const CHECK: {
|
|
373
|
+
export declare const CHECK: {
|
|
374
374
|
readonly MATCH: 'match';
|
|
375
375
|
readonly DIFFERS: 'differs';
|
|
376
376
|
readonly NOT_SUPPLIED: 'not_supplied';
|
|
@@ -417,7 +417,7 @@ interface ABogusCandidates {
|
|
|
417
417
|
* @param candidates - 候选的 query / body / User-Agent,给哪个校验哪个
|
|
418
418
|
* @returns 拆解结果;格式不合法时 `recovered` 为 `false` 并给出 `reason`
|
|
419
419
|
*/
|
|
420
|
-
declare const decodeABogus: (value: string, candidates?: ABogusCandidates) => Decoded;
|
|
420
|
+
export declare const decodeABogus: (value: string, candidates?: ABogusCandidates) => Decoded;
|
|
421
421
|
/** 一次盐值判定的结果 */
|
|
422
422
|
interface SaltDiagnosis {
|
|
423
423
|
/** 命中的候选盐值;都不命中时为 `null` */
|
|
@@ -448,7 +448,7 @@ interface SaltDiagnosis {
|
|
|
448
448
|
* @param salts - 待测的盐值候选
|
|
449
449
|
* @returns 判定结果
|
|
450
450
|
*/
|
|
451
|
-
declare const diagnoseSalt: (value: string, query: string, salts?: readonly string[]) => SaltDiagnosis;
|
|
451
|
+
export declare const diagnoseSalt: (value: string, query: string, salts?: readonly string[]) => SaltDiagnosis;
|
|
452
452
|
/**
|
|
453
453
|
* 只按形状猜一个值是什么参数。用于调用方不知道自己在看什么的时候。
|
|
454
454
|
*
|
|
@@ -456,7 +456,7 @@ declare const diagnoseSalt: (value: string, query: string, salts?: readonly stri
|
|
|
456
456
|
* @param value - 待识别的值
|
|
457
457
|
* @returns 参数名或 `null`
|
|
458
458
|
*/
|
|
459
|
-
declare const identify: (value: string) => string | null;
|
|
459
|
+
export declare const identify: (value: string) => string | null;
|
|
460
460
|
/** 一次 query 重建的结果 */
|
|
461
461
|
interface SignedQueryRecovery {
|
|
462
462
|
/** 重建出的、签名所覆盖的那条 query */
|
|
@@ -483,7 +483,7 @@ interface SignedQueryRecovery {
|
|
|
483
483
|
* @param salts - 待搜的盐值候选
|
|
484
484
|
* @returns 命中结果;没有任何组合命中时返回 `null`
|
|
485
485
|
*/
|
|
486
|
-
declare const recoverSignedQuery: (signature: string, url: string, salts?: readonly string[]) => SignedQueryRecovery | null;
|
|
486
|
+
export declare const recoverSignedQuery: (signature: string, url: string, salts?: readonly string[]) => SignedQueryRecovery | null;
|
|
487
487
|
/**
|
|
488
488
|
* 从一条已签名的 URL 里重建出签名覆盖的那条 query(不再搜索,按固定规则摘参数)。
|
|
489
489
|
*
|
|
@@ -493,7 +493,7 @@ declare const recoverSignedQuery: (signature: string, url: string, salts?: reado
|
|
|
493
493
|
* @param url - 已签名的完整 URL
|
|
494
494
|
* @returns 摘掉 `a_bogus` / `timestamp` / `x-secsdk-web-signature` 之后的 query
|
|
495
495
|
*/
|
|
496
|
-
declare const signedQueryOf: (url: string) => string;
|
|
496
|
+
export declare const signedQueryOf: (url: string) => string;
|
|
497
497
|
/**
|
|
498
498
|
* 拆开一条 URL 上所有认得出的签名参数。
|
|
499
499
|
*
|
|
@@ -503,7 +503,7 @@ declare const signedQueryOf: (url: string) => string;
|
|
|
503
503
|
* @param options - 可选的 User-Agent、显式 query 与盐值候选
|
|
504
504
|
* @returns 每个参数一条拆解结果
|
|
505
505
|
*/
|
|
506
|
-
declare const decodeUrl: (url: string, options?: {
|
|
506
|
+
export declare const decodeUrl: (url: string, options?: {
|
|
507
507
|
userAgent?: string;
|
|
508
508
|
body?: string;
|
|
509
509
|
query?: string;
|
|
@@ -532,15 +532,15 @@ declare const decodeUrl: (url: string, options?: {
|
|
|
532
532
|
* 摘要字节输出与 Python 逐字节一致。
|
|
533
533
|
*/
|
|
534
534
|
/** SM3 初始向量 */
|
|
535
|
-
declare const SM3_IV: readonly number[];
|
|
535
|
+
export declare const SM3_IV: readonly number[];
|
|
536
536
|
/**
|
|
537
537
|
* 计算 SM3 摘要。
|
|
538
538
|
* @param message - 待摘要的字节
|
|
539
539
|
* @returns 32 字节摘要
|
|
540
540
|
*/
|
|
541
|
-
declare const sm3Hash: (message: readonly number[]) => number[];
|
|
541
|
+
export declare const sm3Hash: (message: readonly number[]) => number[];
|
|
542
542
|
/** 摘要的十六进制形式,便于与公开测试向量对照 */
|
|
543
|
-
declare const sm3Hexdigest: (message: readonly number[]) => string;
|
|
543
|
+
export declare const sm3Hexdigest: (message: readonly number[]) => string;
|
|
544
544
|
/**
|
|
545
545
|
* 摘要为 32 个整数的数组,与 a_bogus 内部各处取字节的方式对齐。
|
|
546
546
|
*
|
|
@@ -550,7 +550,7 @@ declare const sm3Hexdigest: (message: readonly number[]) => string;
|
|
|
550
550
|
* @param data - 字符串、字节数组或整数数组
|
|
551
551
|
* @returns 32 个 0..255 的整数
|
|
552
552
|
*/
|
|
553
|
-
declare const sm3ToArray: (data: string | readonly number[] | Uint8Array) => number[];
|
|
553
|
+
export declare const sm3ToArray: (data: string | readonly number[] | Uint8Array) => number[];
|
|
554
554
|
//#endregion
|
|
555
555
|
//#region src/platforms/douyin/sign/tokens.d.ts
|
|
556
556
|
/**
|
|
@@ -581,11 +581,11 @@ type Rng = () => number;
|
|
|
581
581
|
* 假的 msToken 唯一要像真的地方就是形状。抄错表就毁在这上面:
|
|
582
582
|
* 一个永远不含 `j`、中间还夹着 `=` 的 token,形状不对。
|
|
583
583
|
*/
|
|
584
|
-
declare const MS_TOKEN_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-";
|
|
584
|
+
export declare const MS_TOKEN_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-";
|
|
585
585
|
/** 抖音假 msToken 的长度(`==` 后缀之前那一段) */
|
|
586
|
-
declare const DOUYIN_MS_TOKEN_LENGTH = 126;
|
|
586
|
+
export declare const DOUYIN_MS_TOKEN_LENGTH = 126;
|
|
587
587
|
/** 真 msToken 回包的长度,不在其中说明接口变了形,值不该信 */
|
|
588
|
-
declare const DOUYIN_MS_TOKEN_SIZES: readonly number[];
|
|
588
|
+
export declare const DOUYIN_MS_TOKEN_SIZES: readonly number[];
|
|
589
589
|
/** {@link genFalseMsToken} 的注入点 */
|
|
590
590
|
interface FalseMsTokenOptions {
|
|
591
591
|
/** 随机源,默认 `Math.random` */
|
|
@@ -603,11 +603,11 @@ interface FalseMsTokenOptions {
|
|
|
603
603
|
* @param options - `rng` / `suffix` 注入点
|
|
604
604
|
* @returns `length` 个字符表内字符 + `suffix`
|
|
605
605
|
*/
|
|
606
|
-
declare const genFalseMsToken: (length?: number, options?: FalseMsTokenOptions) => string;
|
|
606
|
+
export declare const genFalseMsToken: (length?: number, options?: FalseMsTokenOptions) => string;
|
|
607
607
|
/** `verify_fp` / `s_v_web_id` 随机半段用的字符表(62 个:数字 + 大小写字母) */
|
|
608
|
-
declare const VERIFY_FP_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
608
|
+
export declare const VERIFY_FP_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
609
609
|
/** 尾巴总长度 */
|
|
610
|
-
declare const VERIFY_FP_LENGTH = 36;
|
|
610
|
+
export declare const VERIFY_FP_LENGTH = 36;
|
|
611
611
|
/**
|
|
612
612
|
* 36 进制转换(照抄 Python 的 `_to_base36`,不用 `Number#toString(36)`)。
|
|
613
613
|
*
|
|
@@ -617,7 +617,7 @@ declare const VERIFY_FP_LENGTH = 36;
|
|
|
617
617
|
* @param value - 非负整数
|
|
618
618
|
* @returns 36 进制小写字符串
|
|
619
619
|
*/
|
|
620
|
-
declare const toBase36: (value: number) => string;
|
|
620
|
+
export declare const toBase36: (value: number) => string;
|
|
621
621
|
/** {@link genVerifyFp} / {@link genSVWebId} 的注入点 */
|
|
622
622
|
interface VerifyFpOptions {
|
|
623
623
|
/** 毫秒时间戳,默认 `Date.now()` */
|
|
@@ -638,14 +638,14 @@ interface VerifyFpOptions {
|
|
|
638
638
|
* @param options - `nowMs` / `rng` 注入点
|
|
639
639
|
* @returns 可直接当作 `verifyFp` / `s_v_web_id` cookie 的值
|
|
640
640
|
*/
|
|
641
|
-
declare const genVerifyFp: (options?: VerifyFpOptions) => string;
|
|
641
|
+
export declare const genVerifyFp: (options?: VerifyFpOptions) => string;
|
|
642
642
|
/**
|
|
643
643
|
* `s_v_web_id` 与 `verify_fp` 同形状、同算法,只是 cookie 名不同。
|
|
644
644
|
*
|
|
645
645
|
* @param options - `nowMs` / `rng` 注入点
|
|
646
646
|
* @returns 与 {@link genVerifyFp} 同构的值
|
|
647
647
|
*/
|
|
648
|
-
declare const genSVWebId: (options?: VerifyFpOptions) => string;
|
|
648
|
+
export declare const genSVWebId: (options?: VerifyFpOptions) => string;
|
|
649
649
|
/**
|
|
650
650
|
* 换真 msToken 的上报接口要的全部输入。
|
|
651
651
|
*
|
|
@@ -671,16 +671,16 @@ interface MsTokenSpec {
|
|
|
671
671
|
* @param timestampMs - 客户端时间戳(`tspFromClient`),默认 `Date.now()`
|
|
672
672
|
* @returns 请求体字符串
|
|
673
673
|
*/
|
|
674
|
-
declare const msTokenPayload: (spec: MsTokenSpec, timestampMs?: number) => string;
|
|
674
|
+
export declare const msTokenPayload: (spec: MsTokenSpec, timestampMs?: number) => string;
|
|
675
675
|
/** 注册 ttwid 的一次性 POST 要用的东西 */
|
|
676
676
|
interface TtwidSpec {
|
|
677
677
|
url: string;
|
|
678
678
|
data: string;
|
|
679
679
|
}
|
|
680
680
|
/** ttwid 注册接口(两个平台同域,只有 body 不同) */
|
|
681
|
-
declare const TTWID_REGISTER_URL = "https://ttwid.bytedance.com/ttwid/union/register/";
|
|
681
|
+
export declare const TTWID_REGISTER_URL = "https://ttwid.bytedance.com/ttwid/union/register/";
|
|
682
682
|
/** 抖音访客 ttwid 的注册体,不含任何凭证 */
|
|
683
|
-
declare const DOUYIN_TTWID_PAYLOAD: {
|
|
683
|
+
export declare const DOUYIN_TTWID_PAYLOAD: {
|
|
684
684
|
readonly region: 'cn';
|
|
685
685
|
readonly aid: 1768;
|
|
686
686
|
readonly needFid: false;
|
|
@@ -693,6 +693,6 @@ declare const DOUYIN_TTWID_PAYLOAD: {
|
|
|
693
693
|
readonly union: true;
|
|
694
694
|
};
|
|
695
695
|
/** 抖音访客 ttwid 注册:`POST {url}`,body 用 `data` */
|
|
696
|
-
declare const DOUYIN_TTWID: TtwidSpec;
|
|
696
|
+
export declare const DOUYIN_TTWID: TtwidSpec;
|
|
697
697
|
//#endregion
|
|
698
|
-
export {
|
|
698
|
+
export type { ABogusCandidates, ABogusOptions, ABogusSignOptions, Check, Decoded, DecodedABogus, DigestChain, Field, MsTokenSpec, SaltDiagnosis, SignedQueryRecovery, TtwidSpec, VerifyFpOptions };
|