@yunzhanghu/sdk-nodejs 1.0.1 → 1.0.2

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
@@ -93,7 +93,8 @@ const client = new yunzhanghu.InvoiceClient({
93
93
  private_key: process.env.PRIVATE_KEY,
94
94
  // 云账户公钥,登录云账户综合服务平台,选择“业务中心 > 业务管理 > 对接信息”获取
95
95
  yzh_public_key: process.env.YZH_PUBLIC_KEY,
96
- // 签名方式
96
+ // 签名方式,登录云账户综合服务平台,选择“业务中心 > 业务管理 > 对接信息”获取
97
+ // 签名方式为 RSA,参数固定为:rsa
97
98
  sign_type: process.env.SIGN_TYPE,
98
99
  })
99
100
 
@@ -23,8 +23,8 @@ MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDe4ipz4/EGFZphz2rYy8T2hdCL
23
23
  *
24
24
  QqP7lt6FdvzGxehaHwIDAQAB
25
25
  -----END PUBLIC KEY-----`,
26
- // 签名方式,登录云账户综合服务平台,选择“业务中心 > 业务管理 > 对接信息”获取,默认为 RSA 签名方式。
27
- // rsa:RSA 签名方式 sha256:HMAC 签名方式
26
+ // 签名方式,登录云账户综合服务平台,选择“业务中心 > 业务管理 > 对接信息”获取
27
+ // 签名方式为 RSA,参数固定为:rsa
28
28
  sign_type: "rsa",
29
29
  }
30
30
  module.exports = config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yunzhanghu/sdk-nodejs",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "云账户 SDK for Node.js",
5
5
  "main": "yzh/index.js",
6
6
  "scripts": {
@@ -26,7 +26,7 @@ export class YZHClient {
26
26
  * @param {string} des3_key 3DES Key
27
27
  * @param {string} private_key 平台企业私钥
28
28
  * @param {string} yzh_public_key 云账户公钥
29
- * @param {string} sign_type 签名方式"rsa" | "sha256"
29
+ * @param {string} sign_type 签名算法,支持 RSA、HMAC,枚举分别为 rsa、sha256
30
30
  * @param {string} base_url 可选,默认为 https://api-service.yunzhanghu.com/
31
31
  */
32
32
  constructor(conf: {
@@ -144,7 +144,7 @@ export class YZHClient {
144
144
  }
145
145
 
146
146
  /**
147
- * 生成签名(RSA-SHA256)
147
+ * 生成签名(RSA 签名算法)
148
148
  * @param {string} data 经过加密后的具体数据
149
149
  * @param {string} mess 自定义随机字符串,用于签名
150
150
  * @param {string} timestamp 时间戳,精确到秒
@@ -163,7 +163,7 @@ export class YZHClient {
163
163
  }
164
164
 
165
165
  /**
166
- * 生成签名(HmacSHA256)
166
+ * 生成签名(HMAC 签名算法)
167
167
  * @param {string} data 经过加密后的具体数据
168
168
  * @param {string} mess 自定义随机字符串,用于签名
169
169
  * @param {string} timestamp 时间戳,精确到秒
@@ -185,7 +185,7 @@ export class YZHClient {
185
185
  * @param {string} data 经过加密后的具体数据
186
186
  * @param {string} mess 自定义随机字符串,用于签名
187
187
  * @param {string} timestamp 时间戳,精确到秒
188
- * @param {string} sign_type 签名方式
188
+ * @param {string} sign_type 签名算法,支持 RSA、HMAC,枚举分别为 rsa、sha256
189
189
  * @returns {string} 签名内容
190
190
  */
191
191
  private sign = (data: string, mess: string, timestamp: string) => {
@@ -17,7 +17,7 @@ export declare class YZHClient {
17
17
  * @param {string} des3_key 3DES Key
18
18
  * @param {string} private_key 平台企业私钥
19
19
  * @param {string} yzh_public_key 云账户公钥
20
- * @param {string} sign_type 签名方式"rsa" | "sha256"
20
+ * @param {string} sign_type 签名算法,支持 RSA、HMAC,枚举分别为 rsa、sha256
21
21
  * @param {string} base_url 可选,默认为 https://api-service.yunzhanghu.com/
22
22
  */
23
23
  constructor(conf: {
@@ -41,7 +41,7 @@ export declare class YZHClient {
41
41
  */
42
42
  private generatorRequestParams;
43
43
  /**
44
- * 生成签名(RSA-SHA256)
44
+ * 生成签名(RSA 签名算法)
45
45
  * @param {string} data 经过加密后的具体数据
46
46
  * @param {string} mess 自定义随机字符串,用于签名
47
47
  * @param {string} timestamp 时间戳,精确到秒
@@ -49,7 +49,7 @@ export declare class YZHClient {
49
49
  */
50
50
  private signRSASHA256;
51
51
  /**
52
- * 生成签名(HmacSHA256)
52
+ * 生成签名(HMAC 签名算法)
53
53
  * @param {string} data 经过加密后的具体数据
54
54
  * @param {string} mess 自定义随机字符串,用于签名
55
55
  * @param {string} timestamp 时间戳,精确到秒
@@ -61,7 +61,7 @@ export declare class YZHClient {
61
61
  * @param {string} data 经过加密后的具体数据
62
62
  * @param {string} mess 自定义随机字符串,用于签名
63
63
  * @param {string} timestamp 时间戳,精确到秒
64
- * @param {string} sign_type 签名方式
64
+ * @param {string} sign_type 签名算法,支持 RSA、HMAC,枚举分别为 rsa、sha256
65
65
  * @returns {string} 签名内容
66
66
  */
67
67
  private sign;
@@ -15,12 +15,12 @@ class YZHClient {
15
15
  * @param {string} des3_key 3DES Key
16
16
  * @param {string} private_key 平台企业私钥
17
17
  * @param {string} yzh_public_key 云账户公钥
18
- * @param {string} sign_type 签名方式"rsa" | "sha256"
18
+ * @param {string} sign_type 签名算法,支持 RSA、HMAC,枚举分别为 rsa、sha256
19
19
  * @param {string} base_url 可选,默认为 https://api-service.yunzhanghu.com/
20
20
  */
21
21
  constructor(conf) {
22
22
  /**
23
- * 生成签名(RSA-SHA256)
23
+ * 生成签名(RSA 签名算法)
24
24
  * @param {string} data 经过加密后的具体数据
25
25
  * @param {string} mess 自定义随机字符串,用于签名
26
26
  * @param {string} timestamp 时间戳,精确到秒
@@ -39,7 +39,7 @@ class YZHClient {
39
39
  }
40
40
  };
41
41
  /**
42
- * 生成签名(HmacSHA256)
42
+ * 生成签名(HMAC 签名算法)
43
43
  * @param {string} data 经过加密后的具体数据
44
44
  * @param {string} mess 自定义随机字符串,用于签名
45
45
  * @param {string} timestamp 时间戳,精确到秒
@@ -61,7 +61,7 @@ class YZHClient {
61
61
  * @param {string} data 经过加密后的具体数据
62
62
  * @param {string} mess 自定义随机字符串,用于签名
63
63
  * @param {string} timestamp 时间戳,精确到秒
64
- * @param {string} sign_type 签名方式
64
+ * @param {string} sign_type 签名算法,支持 RSA、HMAC,枚举分别为 rsa、sha256
65
65
  * @returns {string} 签名内容
66
66
  */
67
67
  this.sign = (data, mess, timestamp) => {
@@ -74,7 +74,7 @@ class YZHClient {
74
74
  return this.signHmacSHA256(data, mess, timestamp);
75
75
  }
76
76
  default:
77
- throw new yzhSDKHttpException_1.default(`sign_type 类型不存在`);
77
+ throw new yzhSDKHttpException_1.default(`sign_type类型不存在`);
78
78
  }
79
79
  }
80
80
  catch (err) {