node-easywechat 3.7.0 → 3.7.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/CHANGELOG.md +8 -0
- package/README.md +7 -3
- package/dist/Channel/Application.js +1 -1
- package/dist/Core/Cache/FileCache.js +46 -63
- package/dist/Core/Contracts/AccessTokenInterface.js +2 -15
- package/dist/Core/Contracts/CacheInterface.js +4 -21
- package/dist/Core/Contracts/RefreshableAccessTokenInterface.js +1 -12
- package/dist/Core/Contracts/ServerInterface.js +1 -12
- package/dist/Core/Http/ServerRequest.js +34 -49
- package/dist/Core/HttpClient/AccessTokenAwareClient.js +6 -17
- package/dist/Core/HttpClient/Contracts/HttpClientInterface.js +1 -12
- package/dist/Core/HttpClient/HttpClient.js +74 -85
- package/dist/Core/HttpClient/HttpClientResponse.js +35 -50
- package/dist/Core/HttpClient/Mixins/HttpClientMethodsMixin.js +34 -59
- package/dist/Core/HttpClient/Mixins/PresetMixin.js +8 -11
- package/dist/Core/Message.js +20 -31
- package/dist/Core/Mixins/DecryptMessageMixin.js +13 -24
- package/dist/Core/Mixins/HandlersMixin.js +18 -31
- package/dist/Core/Mixins/ResponseMessageMixin.js +31 -44
- package/dist/Core/Support/Utils.js +8 -19
- package/dist/MiniApp/Application.js +1 -1
- package/dist/MiniApp/Utils.js +13 -24
- package/dist/OfficialAccount/AccessToken.js +42 -59
- package/dist/OfficialAccount/Application.js +1 -1
- package/dist/OfficialAccount/JsApiTicket.js +31 -44
- package/dist/OfficialAccount/Server.d.ts +6 -0
- package/dist/OfficialAccount/Server.js +39 -42
- package/dist/OfficialAccount/Utils.js +6 -17
- package/dist/OpenPlatform/Application.js +62 -86
- package/dist/OpenPlatform/Authorizer/MiniApp/Utils.js +14 -25
- package/dist/OpenPlatform/AuthorizerAccessToken.js +6 -19
- package/dist/OpenPlatform/ComponentAccessToken.js +27 -42
- package/dist/OpenPlatform/Server.d.ts +1 -1
- package/dist/OpenPlatform/Server.js +34 -56
- package/dist/OpenPlatform/VerifyTicket.js +14 -27
- package/dist/OpenWork/Application.js +61 -84
- package/dist/OpenWork/AuthorizerAccessToken.js +32 -47
- package/dist/OpenWork/JsApiTicket.js +64 -81
- package/dist/OpenWork/ProviderAccessToken.js +26 -41
- package/dist/OpenWork/Server.js +54 -95
- package/dist/OpenWork/SuiteAccessToken.js +27 -42
- package/dist/OpenWork/SuiteTicket.js +14 -27
- package/dist/Pay/Application.js +1 -2
- package/dist/Pay/Client.js +63 -77
- package/dist/Pay/LegacySignature.js +2 -3
- package/dist/Pay/Merchant.js +36 -52
- package/dist/Pay/Server.js +55 -70
- package/dist/Pay/Utils.js +13 -26
- package/dist/Pay/Validator.js +28 -39
- package/dist/Work/AccessToken.js +26 -41
- package/dist/Work/Application.js +21 -32
- package/dist/Work/JsApiTicket.js +60 -77
- package/dist/Work/Server.js +51 -87
- package/dist/Work/Utils.js +12 -25
- package/package.json +1 -1
- package/tsconfig.json +2 -2
package/dist/MiniApp/Utils.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -23,22 +14,20 @@ class Utils {
|
|
|
23
14
|
* @param code
|
|
24
15
|
* @returns
|
|
25
16
|
*/
|
|
26
|
-
codeToSession(code) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
grant_type: 'authorization_code',
|
|
35
|
-
}
|
|
36
|
-
})).toObject();
|
|
37
|
-
if (!response['openid']) {
|
|
38
|
-
throw new Error(`code2Session error: ${JSON.stringify(response)}`);
|
|
17
|
+
async codeToSession(code) {
|
|
18
|
+
let client = this.app.getHttpClient();
|
|
19
|
+
let response = await (await client.request('GET', '/sns/jscode2session', {
|
|
20
|
+
params: {
|
|
21
|
+
appid: this.app.getAccount().getAppId(),
|
|
22
|
+
secret: this.app.getAccount().getSecret(),
|
|
23
|
+
js_code: code,
|
|
24
|
+
grant_type: 'authorization_code',
|
|
39
25
|
}
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
})).toObject();
|
|
27
|
+
if (!response['openid']) {
|
|
28
|
+
throw new Error(`code2Session error: ${JSON.stringify(response)}`);
|
|
29
|
+
}
|
|
30
|
+
return response;
|
|
42
31
|
}
|
|
43
32
|
/**
|
|
44
33
|
* 数据解密
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -49,24 +40,20 @@ class AccessToken {
|
|
|
49
40
|
this.key = key;
|
|
50
41
|
return this;
|
|
51
42
|
}
|
|
52
|
-
getToken() {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return this.refresh();
|
|
62
|
-
});
|
|
43
|
+
async getToken() {
|
|
44
|
+
let token = '';
|
|
45
|
+
if (this.cache) {
|
|
46
|
+
token = await this.cache.get(this.getKey());
|
|
47
|
+
}
|
|
48
|
+
if (!!token && typeof token === 'string') {
|
|
49
|
+
return token;
|
|
50
|
+
}
|
|
51
|
+
return this.refresh();
|
|
63
52
|
}
|
|
64
|
-
toQuery() {
|
|
65
|
-
return
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
};
|
|
69
|
-
});
|
|
53
|
+
async toQuery() {
|
|
54
|
+
return {
|
|
55
|
+
access_token: await this.getToken(),
|
|
56
|
+
};
|
|
70
57
|
}
|
|
71
58
|
refresh() {
|
|
72
59
|
return this.stable ? this.getStableAccessToken() : this.getAccessToken();
|
|
@@ -75,45 +62,41 @@ class AccessToken {
|
|
|
75
62
|
* 获取稳定版接口调用凭据
|
|
76
63
|
* @param forceRefresh 是否强制刷新,默认:false
|
|
77
64
|
*/
|
|
78
|
-
getStableAccessToken() {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
force_refresh: forceRefresh,
|
|
86
|
-
}
|
|
87
|
-
})).toObject();
|
|
88
|
-
if (!response['access_token']) {
|
|
89
|
-
throw new Error('Failed to get stable access_token: ' + JSON.stringify(response));
|
|
90
|
-
}
|
|
91
|
-
if (this.cache) {
|
|
92
|
-
yield this.cache.set(this.getKey(), response['access_token'], parseInt(response['expires_in']));
|
|
65
|
+
async getStableAccessToken(forceRefresh = false) {
|
|
66
|
+
let response = (await this.httpClient.request('post', 'cgi-bin/stable_token', {
|
|
67
|
+
json: {
|
|
68
|
+
grant_type: 'client_credential',
|
|
69
|
+
appid: this.appId,
|
|
70
|
+
secret: this.secret,
|
|
71
|
+
force_refresh: forceRefresh,
|
|
93
72
|
}
|
|
94
|
-
|
|
95
|
-
|
|
73
|
+
})).toObject();
|
|
74
|
+
if (!response['access_token']) {
|
|
75
|
+
throw new Error('Failed to get stable access_token: ' + JSON.stringify(response));
|
|
76
|
+
}
|
|
77
|
+
if (this.cache) {
|
|
78
|
+
await this.cache.set(this.getKey(), response['access_token'], parseInt(response['expires_in']));
|
|
79
|
+
}
|
|
80
|
+
return response['access_token'];
|
|
96
81
|
}
|
|
97
82
|
/**
|
|
98
83
|
* 获取接口调用凭据
|
|
99
84
|
*/
|
|
100
|
-
getAccessToken() {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
secret: this.secret,
|
|
107
|
-
}
|
|
108
|
-
})).toObject();
|
|
109
|
-
if (!response['access_token']) {
|
|
110
|
-
throw new Error('Failed to get access_token: ' + JSON.stringify(response));
|
|
111
|
-
}
|
|
112
|
-
if (this.cache) {
|
|
113
|
-
yield this.cache.set(this.getKey(), response['access_token'], parseInt(response['expires_in']));
|
|
85
|
+
async getAccessToken() {
|
|
86
|
+
let response = (await this.httpClient.request('get', 'cgi-bin/token', {
|
|
87
|
+
params: {
|
|
88
|
+
grant_type: 'client_credential',
|
|
89
|
+
appid: this.appId,
|
|
90
|
+
secret: this.secret,
|
|
114
91
|
}
|
|
115
|
-
|
|
116
|
-
|
|
92
|
+
})).toObject();
|
|
93
|
+
if (!response['access_token']) {
|
|
94
|
+
throw new Error('Failed to get access_token: ' + JSON.stringify(response));
|
|
95
|
+
}
|
|
96
|
+
if (this.cache) {
|
|
97
|
+
await this.cache.set(this.getKey(), response['access_token'], parseInt(response['expires_in']));
|
|
98
|
+
}
|
|
99
|
+
return response['access_token'];
|
|
117
100
|
}
|
|
118
101
|
}
|
|
119
102
|
module.exports = AccessToken;
|
|
@@ -156,7 +156,7 @@ class Application {
|
|
|
156
156
|
return this.utils;
|
|
157
157
|
}
|
|
158
158
|
createClient() {
|
|
159
|
-
return (new AccessTokenAwareClient_1.default(this.getHttpClient(), this.getAccessToken(), (response) =>
|
|
159
|
+
return (new AccessTokenAwareClient_1.default(this.getHttpClient(), this.getAccessToken(), (response) => response.toObject()['errcode'] ?? 0, this.getConfig().get('http.throw', true)))
|
|
160
160
|
.setPresets(this.getConfig().all());
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -28,29 +19,27 @@ class JsApiTicket extends AccessToken_1.default {
|
|
|
28
19
|
* 获取签名凭证jsapi_ticket
|
|
29
20
|
* @returns
|
|
30
21
|
*/
|
|
31
|
-
getTicket() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
type: 'jsapi',
|
|
44
|
-
}
|
|
45
|
-
})).toObject();
|
|
46
|
-
if (!response['ticket']) {
|
|
47
|
-
throw new Error('Failed to get jssdk_ticket: ' + JSON.stringify(response));
|
|
48
|
-
}
|
|
49
|
-
if (this.cache) {
|
|
50
|
-
yield this.cache.set(key, response['ticket'], parseInt(response['expires_in']));
|
|
22
|
+
async getTicket() {
|
|
23
|
+
let key = this.getKey();
|
|
24
|
+
let ticket = '';
|
|
25
|
+
if (this.cache) {
|
|
26
|
+
ticket = await this.cache.get(key);
|
|
27
|
+
}
|
|
28
|
+
if (!!ticket && typeof ticket === 'string') {
|
|
29
|
+
return ticket;
|
|
30
|
+
}
|
|
31
|
+
let response = (await this.httpClient.request('get', '/cgi-bin/ticket/getticket', {
|
|
32
|
+
params: {
|
|
33
|
+
type: 'jsapi',
|
|
51
34
|
}
|
|
52
|
-
|
|
53
|
-
|
|
35
|
+
})).toObject();
|
|
36
|
+
if (!response['ticket']) {
|
|
37
|
+
throw new Error('Failed to get jssdk_ticket: ' + JSON.stringify(response));
|
|
38
|
+
}
|
|
39
|
+
if (this.cache) {
|
|
40
|
+
await this.cache.set(key, response['ticket'], parseInt(response['expires_in']));
|
|
41
|
+
}
|
|
42
|
+
return response['ticket'];
|
|
54
43
|
}
|
|
55
44
|
/**
|
|
56
45
|
* 获取签名配置
|
|
@@ -59,19 +48,17 @@ class JsApiTicket extends AccessToken_1.default {
|
|
|
59
48
|
* @param timestamp 时间长,默认:当前时间
|
|
60
49
|
* @returns
|
|
61
50
|
*/
|
|
62
|
-
configSignature(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
};
|
|
74
|
-
});
|
|
51
|
+
async configSignature(url, nonce = null, timestamp = null) {
|
|
52
|
+
nonce = nonce || (0, Utils_1.randomString)(10);
|
|
53
|
+
timestamp = timestamp || (0, Utils_1.getTimestamp)();
|
|
54
|
+
let ticket = await this.getTicket();
|
|
55
|
+
return {
|
|
56
|
+
url,
|
|
57
|
+
nonceStr: nonce,
|
|
58
|
+
timestamp,
|
|
59
|
+
appId: this.appId,
|
|
60
|
+
signature: this.getTicketSignature(ticket, nonce, timestamp, url),
|
|
61
|
+
};
|
|
75
62
|
}
|
|
76
63
|
getTicketSignature(ticket, nonce, timestamp, url) {
|
|
77
64
|
return (0, Utils_1.createHash)(`jsapi_ticket=${ticket}&noncestr=${nonce}×tamp=${timestamp}&url=${url}`, 'sha1');
|
|
@@ -34,6 +34,12 @@ declare class Server extends ServerInterface {
|
|
|
34
34
|
*/
|
|
35
35
|
getRequestMessage(request?: ServerRequestInterface): Promise<Message>;
|
|
36
36
|
protected decryptRequestMessage(query: Record<string, any>): ServerHandlerClosure<Message>;
|
|
37
|
+
/**
|
|
38
|
+
* 获取解密后的消息
|
|
39
|
+
* @param request 未设置该参数时,则从当前服务端收到的请求中获取
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
getDecryptedMessage(request?: ServerRequestInterface): Promise<import("../Core/Message")>;
|
|
37
43
|
}
|
|
38
44
|
interface Server {
|
|
39
45
|
/**
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -24,26 +15,24 @@ class Server extends ServerInterface_1.default {
|
|
|
24
15
|
* 服务端消息处理
|
|
25
16
|
* @returns
|
|
26
17
|
*/
|
|
27
|
-
serve() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return response;
|
|
46
|
-
});
|
|
18
|
+
async serve() {
|
|
19
|
+
let query = this.request.getQueryParams();
|
|
20
|
+
let echostr = query['echostr'] || '';
|
|
21
|
+
if (!!echostr) {
|
|
22
|
+
return new Response_1.default(200, { 'Content-Type': 'text/html' }, echostr);
|
|
23
|
+
}
|
|
24
|
+
let message = await this.getRequestMessage(this.request);
|
|
25
|
+
if (this.encryptor && query['msg_signature']) {
|
|
26
|
+
this.prepend(this.decryptRequestMessage(query));
|
|
27
|
+
}
|
|
28
|
+
let response = await this.handle(new Response_1.default(200, {}, 'success'), message);
|
|
29
|
+
if (!(response instanceof Response_1.default)) {
|
|
30
|
+
const contentType = this.request.getHeader('content-type');
|
|
31
|
+
const contentBody = this.request.getBody().toString();
|
|
32
|
+
const isXml = (contentType && contentType.indexOf('xml') > -1) || contentBody.substring(0, 1) === '<';
|
|
33
|
+
response = await this.transformToReply(response, message, this.encryptor, isXml);
|
|
34
|
+
}
|
|
35
|
+
return response;
|
|
47
36
|
}
|
|
48
37
|
/**
|
|
49
38
|
* 添加普通消息处理器
|
|
@@ -52,10 +41,8 @@ class Server extends ServerInterface_1.default {
|
|
|
52
41
|
* @returns
|
|
53
42
|
*/
|
|
54
43
|
addMessageListener(type, handler) {
|
|
55
|
-
return this.withHandler(function (message, next) {
|
|
56
|
-
return
|
|
57
|
-
return message.MsgType === type ? handler(message, next) : next(message);
|
|
58
|
-
});
|
|
44
|
+
return this.withHandler(async function (message, next) {
|
|
45
|
+
return message.MsgType === type ? handler(message, next) : next(message);
|
|
59
46
|
});
|
|
60
47
|
}
|
|
61
48
|
/**
|
|
@@ -65,10 +52,8 @@ class Server extends ServerInterface_1.default {
|
|
|
65
52
|
* @returns
|
|
66
53
|
*/
|
|
67
54
|
addEventListener(event, handler) {
|
|
68
|
-
return this.withHandler(function (message, next) {
|
|
69
|
-
return
|
|
70
|
-
return message.Event === event ? handler(message, next) : next(message);
|
|
71
|
-
});
|
|
55
|
+
return this.withHandler(async function (message, next) {
|
|
56
|
+
return message.Event === event ? handler(message, next) : next(message);
|
|
72
57
|
});
|
|
73
58
|
}
|
|
74
59
|
/**
|
|
@@ -80,12 +65,24 @@ class Server extends ServerInterface_1.default {
|
|
|
80
65
|
return Message_1.default.createFromRequest(request || this.request);
|
|
81
66
|
}
|
|
82
67
|
decryptRequestMessage(query) {
|
|
83
|
-
return (message, next) =>
|
|
84
|
-
|
|
85
|
-
return null;
|
|
86
|
-
yield this.decryptMessage(message, this.encryptor, query['msg_signature'] || '', query['timestamp'] || '', query['nonce'] || '');
|
|
68
|
+
return async (message, next) => {
|
|
69
|
+
message = await this.decryptMessage(message, this.encryptor, query['msg_signature'] || '', query['timestamp'] || '', query['nonce'] || '');
|
|
87
70
|
return next(message);
|
|
88
|
-
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* 获取解密后的消息
|
|
75
|
+
* @param request 未设置该参数时,则从当前服务端收到的请求中获取
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
78
|
+
async getDecryptedMessage(request = null) {
|
|
79
|
+
request = request ?? this.request;
|
|
80
|
+
let message = await this.getRequestMessage(request);
|
|
81
|
+
let query = request.getQueryParams();
|
|
82
|
+
if (!this.encryptor || !query['msg_signature']) {
|
|
83
|
+
return message;
|
|
84
|
+
}
|
|
85
|
+
return await this.decryptMessage(message, this.encryptor, query['msg_signature'] ?? '', query['timestamp'] ?? '', query['nonce'] ?? '');
|
|
89
86
|
}
|
|
90
87
|
}
|
|
91
88
|
;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -24,14 +15,12 @@ class Utils {
|
|
|
24
15
|
* @param debug 是否开启调试模式,默认:false
|
|
25
16
|
* @returns
|
|
26
17
|
*/
|
|
27
|
-
buildJsSdkConfig(
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, yield this.app.getTicket().configSignature(url));
|
|
34
|
-
});
|
|
18
|
+
async buildJsSdkConfig(url, jsApiList = [], openTagList = [], debug = false) {
|
|
19
|
+
return (0, merge_1.default)({
|
|
20
|
+
jsApiList,
|
|
21
|
+
openTagList,
|
|
22
|
+
debug,
|
|
23
|
+
}, await this.app.getTicket().configSignature(url));
|
|
35
24
|
}
|
|
36
25
|
}
|
|
37
26
|
;
|