@iflyrpa/actions 1.2.22 → 1.2.24

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/types.d.ts CHANGED
@@ -9,7 +9,6 @@ export interface ActiomCommonParams {
9
9
  cookies: Partial<CookiesSetDetails>[];
10
10
  actionType?: "mockApi" | "rpa";
11
11
  readonly articleId?: string;
12
- readonly saveType?: string;
13
12
  }
14
13
  export declare namespace Weixin {
15
14
  interface FansCount {
@@ -1,48 +1,32 @@
1
1
  /**
2
- * 小红书加密参数逆向,代码来自:https://github.com/Cloxl/xhshow
2
+ * 小红书请求客户端封装
3
3
  */
4
- export declare class XsEncrypt {
5
- private words;
6
- private keyBytes;
7
- private iv;
4
+ export declare class Xhshow {
5
+ private cryptoProcessor;
6
+ constructor();
8
7
  /**
9
- * 根据传入的url生成MD5摘要
10
- *
11
- * @param {string} url - API的url
12
- * @returns {string} MD5摘要
8
+ * 构建内容字符串(用于MD5计算和签名生成)
13
9
  */
14
- encryptMD5(url: string): Promise<string>;
10
+ private buildContentString;
15
11
  /**
16
- * 根据传入的text生成AES加密后的内容,并将其转为base64编码
17
- *
18
- * @param {string} text - 需要加密的字符串
19
- * @returns {string} 加密后的base64编码字符串
12
+ * 从内容字符串生成d值(MD5哈希)
20
13
  */
21
- encryptText(text: string): Promise<string>;
14
+ private generateDValue;
22
15
  /**
23
- * 把加密后的payload转为16进制
24
- *
25
- * @param {string} encodedData - 加密后的payload(Base64编码)
26
- * @returns {string} 十六进制字符串
16
+ * 构建签名
27
17
  */
28
- base64ToHex(encodedData: string): Promise<string>;
18
+ private buildSignature;
29
19
  /**
30
- * 把小红书加密参数payload转16进制 再使用base64编码
31
- *
32
- * @param {string} payload - 要加密处理的payload内容
33
- * @param {string} platform - 登录平台
34
- * @returns {string} 加密后并进行base64编码的字符串
20
+ * 生成请求签名(支持GET和POST)
35
21
  */
36
- encryptPayload(payload: string, platform: string): Promise<string>;
22
+ signXs(method: 'GET' | 'POST', uri: string, a1Value: string, xsecAppid?: string, payload?: Record<string, any> | null): string;
37
23
  /**
38
- * 将传入的参数加密为小红书的xs
39
- * Args: url: API请求的URL
40
- * a1: 签名参数a1
41
- * ts: 时间戳
42
- * platform: 登录平台 默认为xhs-pc-web
43
- * Returns:
44
- * 最终的加密签名字符串,前缀为“XYW_”
24
+ * 生成GET请求签名(便捷方法)
45
25
  */
46
- encryptXs(url: string, a1: string, ts: string, platform?: string): Promise<string>;
47
- dumps(...rest: Parameters<typeof JSON.stringify>): string;
26
+ signXsGet(uri: string, a1Value: string, xsecAppid?: string, params?: Record<string, any> | null): string;
27
+ /**
28
+ * 生成POST请求签名(便捷方法)
29
+ */
30
+ signXsPost(uri: string, a1Value: string, xsecAppid?: string, payload?: Record<string, any> | null): string;
48
31
  }
32
+ export default Xhshow;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iflyrpa/actions",
3
- "version": "1.2.22",
3
+ "version": "1.2.24",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  "form-data": "^4.0.1",
17
17
  "htmlparser2": "^9.1.0",
18
18
  "mime-types": "^2.1.35",
19
- "@iflyrpa/share": "0.0.12"
19
+ "@iflyrpa/share": "0.0.13"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@rslib/core": "^0.4.1",