Skip to content

Commit 8f19697

Browse files
committed
release v2.0.0
1 parent 22555e1 commit 8f19697

File tree

8 files changed

+169
-143
lines changed

8 files changed

+169
-143
lines changed

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ const { WxCrypto } = require('node-wxcrypto')
4444
/**
4545
* class WxCrypto
4646
*
47-
* @param {string} token token
48-
* @param {string} aesKey 43位
49-
* @param {string} appID appID
47+
* @param {string} token 消息校验Token,开发者在代替公众号或小程序接收到消息时,用此Token来校验消息。
48+
* @param {string} aesKey 消息加解密Key,在代替公众号或小程序收发消息过程中使用。必须是长度为43位的字符串,只能是字母和数字。
49+
* @param {string} appID 小程序appID
5050
* @param {object} options Options
5151
* @return {Object} WxCrypto instance
5252
*/
@@ -67,7 +67,20 @@ const data = await wxCrypto.decrypt(encrypt, timestamp, nonce, options)
6767
2. import 引入
6868

6969
```js
70-
import { WxCrypto } from 'node-wxcrypto'
70+
import {
71+
type BuildXMLOptions,
72+
type ParserXMLOptions,
73+
WxCrypto,
74+
aes256Decrypt,
75+
aes256Encrypt,
76+
buildXML,
77+
buildXMLSync,
78+
parseXML,
79+
parseXMLSync,
80+
sha1
81+
} from 'node-wxcrypto'
82+
83+
const data = await wxCrypto.decrypt(encrypt, timestamp, nonce, options)
7184
```
7285

7386
### 使用配置

docs/README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ const { WxCrypto } = require('node-wxcrypto')
4646
/**
4747
* class WxCrypto
4848
*
49-
* @param {string} token token
50-
* @param {string} aesKey 43位
51-
* @param {string} appID appID
49+
* @param {string} token 消息校验Token,开发者在代替公众号或小程序接收到消息时,用此Token来校验消息。
50+
* @param {string} aesKey 消息加解密Key,在代替公众号或小程序收发消息过程中使用。必须是长度为43位的字符串,只能是字母和数字。
51+
* @param {string} appID 小程序appID
5252
* @param {object} options Options
5353
* @return {Object} WxCrypto instance
5454
*/
@@ -69,7 +69,20 @@ const data = await wxCrypto.decrypt(encrypt, timestamp, nonce, options)
6969
2. import 引入
7070

7171
```js
72-
import { WxCrypto } from 'node-wxcrypto'
72+
import {
73+
type BuildXMLOptions,
74+
type ParserXMLOptions,
75+
WxCrypto,
76+
aes256Decrypt,
77+
aes256Encrypt,
78+
buildXML,
79+
buildXMLSync,
80+
parseXML,
81+
parseXMLSync,
82+
sha1
83+
} from 'node-wxcrypto'
84+
85+
const data = await wxCrypto.decrypt(encrypt, timestamp, nonce, options)
7386
```
7487

7588
### 使用配置

docs/classes/WxCrypto.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Class: WxCrypto
44

5-
微信消息加解密 nodejs 版本
5+
微信消息加解密nodejs版本
66

77
**`Example`**
88

@@ -43,16 +43,16 @@ var [err, decryptedXML] = wx.decrypt(signature, timestamp, nonce, encrypted);
4343

4444
#### Parameters
4545

46-
| Name | Type |
47-
| :--------------- | :------------------------------------ |
48-
| `token` | `string` |
49-
| `encodingAESKey` | `string` |
50-
| `appID` | `string` |
51-
| `options` | [`Options`](../interfaces/Options.md) |
46+
| Name | Type |
47+
| :------ | :------ |
48+
| `token` | `string` |
49+
| `encodingAESKey` | `string` |
50+
| `appID` | `string` |
51+
| `options` | [`Options`](../interfaces/Options.md) |
5252

5353
#### Defined in
5454

55-
[src/index.ts:48](https://github.com/saqqdy/node-wxcrypto/blob/82369d0/src/index.ts#L48)
55+
[src/index.ts:48](https://github.com/saqqdy/node-wxcrypto/blob/22555e1/src/index.ts#L48)
5656

5757
## Properties
5858

@@ -62,47 +62,47 @@ var [err, decryptedXML] = wx.decrypt(signature, timestamp, nonce, encrypted);
6262

6363
#### Defined in
6464

65-
[src/index.ts:46](https://github.com/saqqdy/node-wxcrypto/blob/82369d0/src/index.ts#L46)
65+
[src/index.ts:46](https://github.com/saqqdy/node-wxcrypto/blob/22555e1/src/index.ts#L46)
6666

67-
---
67+
___
6868

6969
### iv
7070

7171
**iv**: `Buffer`
7272

7373
#### Defined in
7474

75-
[src/index.ts:45](https://github.com/saqqdy/node-wxcrypto/blob/82369d0/src/index.ts#L45)
75+
[src/index.ts:45](https://github.com/saqqdy/node-wxcrypto/blob/22555e1/src/index.ts#L45)
7676

77-
---
77+
___
7878

7979
### key
8080

8181
**key**: `Buffer`
8282

8383
#### Defined in
8484

85-
[src/index.ts:44](https://github.com/saqqdy/node-wxcrypto/blob/82369d0/src/index.ts#L44)
85+
[src/index.ts:44](https://github.com/saqqdy/node-wxcrypto/blob/22555e1/src/index.ts#L44)
8686

87-
---
87+
___
8888

8989
### options
9090

9191
**options**: [`Options`](../interfaces/Options.md)
9292

9393
#### Defined in
9494

95-
[src/index.ts:47](https://github.com/saqqdy/node-wxcrypto/blob/82369d0/src/index.ts#L47)
95+
[src/index.ts:47](https://github.com/saqqdy/node-wxcrypto/blob/22555e1/src/index.ts#L47)
9696

97-
---
97+
___
9898

9999
### token
100100

101101
**token**: `string`
102102

103103
#### Defined in
104104

105-
[src/index.ts:43](https://github.com/saqqdy/node-wxcrypto/blob/82369d0/src/index.ts#L43)
105+
[src/index.ts:43](https://github.com/saqqdy/node-wxcrypto/blob/22555e1/src/index.ts#L43)
106106

107107
## Methods
108108

@@ -114,12 +114,12 @@ decrypt
114114

115115
#### Parameters
116116

117-
| Name | Type | Description |
118-
| :---------- | :------------------------------------ | :--------------------------------------------------- |
119-
| `data` | `string` | encrypt string, eg. oVMc1Y6qP86YfAa.../QGgk503Q68Q== |
120-
| `timestamp` | `string` \| `number` | timestamp |
121-
| `nonce` | `string` \| `number` | nonce |
122-
| `options` | [`Options`](../interfaces/Options.md) | options |
117+
| Name | Type | Description |
118+
| :------ | :------ | :------ |
119+
| `data` | `string` | encrypt string, eg. oVMc1Y6qP86YfAa.../QGgk503Q68Q== |
120+
| `timestamp` | `string` \| `number` | timestamp |
121+
| `nonce` | `string` \| `number` | nonce |
122+
| `options` | [`Options`](../interfaces/Options.md) | options |
123123

124124
#### Returns
125125

@@ -129,9 +129,9 @@ xml - xmData, eg. { ComponentVerifyTicket: 'xxxx', ..., AppId: 'xxxx' }
129129

130130
#### Defined in
131131

132-
[src/index.ts:135](https://github.com/saqqdy/node-wxcrypto/blob/82369d0/src/index.ts#L135)
132+
[src/index.ts:135](https://github.com/saqqdy/node-wxcrypto/blob/22555e1/src/index.ts#L135)
133133

134-
---
134+
___
135135

136136
### encrypt
137137

@@ -142,10 +142,10 @@ Base64Encode(AES256Encrypt[RandomString(16B) + ContentLength(4B) + Content + app
142142

143143
#### Parameters
144144

145-
| Name | Type | Description |
146-
| :-------- | :------------------------------------ | :------------------------------------------------------------------------- |
147-
| `data` | `Record`<`string`, `unknown`\> | xml data String, eg. { ComponentVerifyTicket: 'xxxx', ..., AppId: 'xxxx' } |
148-
| `options` | [`Options`](../interfaces/Options.md) | options |
145+
| Name | Type | Description |
146+
| :------ | :------ | :------ |
147+
| `data` | `Record`<`string`, `unknown`\> | xml data String, eg. { ComponentVerifyTicket: 'xxxx', ..., AppId: 'xxxx' } |
148+
| `options` | [`Options`](../interfaces/Options.md) | options |
149149

150150
#### Returns
151151

@@ -155,9 +155,9 @@ encrypt - encrypt string, eg. oVMc1Y6qP86YfAa.../QGgk503Q68Q==
155155

156156
#### Defined in
157157

158-
[src/index.ts:103](https://github.com/saqqdy/node-wxcrypto/blob/82369d0/src/index.ts#L103)
158+
[src/index.ts:103](https://github.com/saqqdy/node-wxcrypto/blob/22555e1/src/index.ts#L103)
159159

160-
---
160+
___
161161

162162
### mergeXmlOptions
163163

@@ -167,9 +167,9 @@ mergeXmlOptions
167167

168168
#### Parameters
169169

170-
| Name | Type | Description |
171-
| :-------- | :------------------------------------ | :---------- |
172-
| `options` | [`Options`](../interfaces/Options.md) | options |
170+
| Name | Type | Description |
171+
| :------ | :------ | :------ |
172+
| `options` | [`Options`](../interfaces/Options.md) | options |
173173

174174
#### Returns
175175

@@ -179,4 +179,4 @@ xml - xmData, eg. { ComponentVerifyTicket: 'xxxx', ..., AppId: 'xxxx' }
179179

180180
#### Defined in
181181

182-
[src/index.ts:79](https://github.com/saqqdy/node-wxcrypto/blob/82369d0/src/index.ts#L79)
182+
[src/index.ts:79](https://github.com/saqqdy/node-wxcrypto/blob/22555e1/src/index.ts#L79)

docs/interfaces/BuildXMLOptions.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ BuilderOptions.allowSurrogateChars
3636

3737
node_modules/.pnpm/@types+xml2js@0.4.11/node_modules/@types/xml2js/index.d.ts:90
3838

39-
---
39+
___
4040

4141
### attrkey
4242

@@ -50,7 +50,7 @@ BuilderOptions.attrkey
5050

5151
node_modules/.pnpm/@types+xml2js@0.4.11/node_modules/@types/xml2js/index.d.ts:83
5252

53-
---
53+
___
5454

5555
### cdata
5656

@@ -62,9 +62,9 @@ BuilderOptions.cdata
6262

6363
#### Defined in
6464

65-
[src/xml.ts:13](https://github.com/saqqdy/node-wxcrypto/blob/82369d0/src/xml.ts#L13)
65+
[src/xml.ts:13](https://github.com/saqqdy/node-wxcrypto/blob/22555e1/src/xml.ts#L13)
6666

67-
---
67+
___
6868

6969
### charkey
7070

@@ -78,7 +78,7 @@ BuilderOptions.charkey
7878

7979
node_modules/.pnpm/@types+xml2js@0.4.11/node_modules/@types/xml2js/index.d.ts:84
8080

81-
---
81+
___
8282

8383
### doctype
8484

@@ -92,7 +92,7 @@ BuilderOptions.doctype
9292

9393
node_modules/.pnpm/@types+xml2js@0.4.11/node_modules/@types/xml2js/index.d.ts:88
9494

95-
---
95+
___
9696

9797
### headless
9898

@@ -104,9 +104,9 @@ BuilderOptions.headless
104104

105105
#### Defined in
106106

107-
[src/xml.ts:14](https://github.com/saqqdy/node-wxcrypto/blob/82369d0/src/xml.ts#L14)
107+
[src/xml.ts:14](https://github.com/saqqdy/node-wxcrypto/blob/22555e1/src/xml.ts#L14)
108108

109-
---
109+
___
110110

111111
### renderOpts
112112

@@ -120,7 +120,7 @@ BuilderOptions.renderOpts
120120

121121
node_modules/.pnpm/@types+xml2js@0.4.11/node_modules/@types/xml2js/index.d.ts:86
122122

123-
---
123+
___
124124

125125
### rootName
126126

@@ -132,9 +132,9 @@ BuilderOptions.rootName
132132

133133
#### Defined in
134134

135-
[src/xml.ts:15](https://github.com/saqqdy/node-wxcrypto/blob/82369d0/src/xml.ts#L15)
135+
[src/xml.ts:15](https://github.com/saqqdy/node-wxcrypto/blob/22555e1/src/xml.ts#L15)
136136

137-
---
137+
___
138138

139139
### xmldec
140140

docs/interfaces/Options.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@
1818

1919
#### Defined in
2020

21-
[src/index.ts:20](https://github.com/saqqdy/node-wxcrypto/blob/82369d0/src/index.ts#L20)
21+
[src/index.ts:20](https://github.com/saqqdy/node-wxcrypto/blob/22555e1/src/index.ts#L20)
2222

23-
---
23+
___
2424

2525
### normalizeTags
2626

2727
`Optional` **normalizeTags**: `boolean`
2828

2929
#### Defined in
3030

31-
[src/index.ts:18](https://github.com/saqqdy/node-wxcrypto/blob/82369d0/src/index.ts#L18)
31+
[src/index.ts:18](https://github.com/saqqdy/node-wxcrypto/blob/22555e1/src/index.ts#L18)
3232

33-
---
33+
___
3434

3535
### xmlOptions
3636

3737
`Optional` **xmlOptions**: `ParserOptions`
3838

3939
#### Defined in
4040

41-
[src/index.ts:22](https://github.com/saqqdy/node-wxcrypto/blob/82369d0/src/index.ts#L22)
41+
[src/index.ts:22](https://github.com/saqqdy/node-wxcrypto/blob/22555e1/src/index.ts#L22)

docs/interfaces/withXMLProp.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
## Type parameters
66

77
| Name |
8-
| :--- |
9-
| `T` |
8+
| :------ |
9+
| `T` |
1010

1111
## Table of contents
1212

@@ -22,4 +22,4 @@
2222

2323
#### Defined in
2424

25-
[src/index.ts:26](https://github.com/saqqdy/node-wxcrypto/blob/82369d0/src/index.ts#L26)
25+
[src/index.ts:26](https://github.com/saqqdy/node-wxcrypto/blob/22555e1/src/index.ts#L26)

0 commit comments

Comments
 (0)