@tmsfe/tms-core 0.0.157 → 0.0.158
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/package.json
CHANGED
|
@@ -149,6 +149,7 @@ const eccUtil = {
|
|
|
149
149
|
return eccUtil._privateKeyInfo;
|
|
150
150
|
},
|
|
151
151
|
// 解析gwCode
|
|
152
|
+
/* eslint-disable complexity */
|
|
152
153
|
resolveGwCode: async (codeStr: string): Promise<{ retry: boolean, success: boolean }> => {
|
|
153
154
|
if (!codeStr) return { retry: false, success: true };
|
|
154
155
|
const code = parseInt(codeStr, 10);
|
|
@@ -176,6 +177,7 @@ const eccUtil = {
|
|
|
176
177
|
return { retry: false, success: true };
|
|
177
178
|
}
|
|
178
179
|
},
|
|
180
|
+
/* eslint-enable complexity */
|
|
179
181
|
execEncrypt: (input: string, ignoreNull = false): BaseResp<{
|
|
180
182
|
cryptoKeyInfo: CryptoKeyInfo,
|
|
181
183
|
encryptedContent: any } | null> => {
|
|
@@ -386,7 +388,12 @@ const resDecrypt = async (header, data, cryptoKeyInfo: CryptoKeyInfo): Promise<B
|
|
|
386
388
|
'content-type': contentType, // 响应内容类型
|
|
387
389
|
} = formatHeader;
|
|
388
390
|
if (!encryptResponseMode || encryptResponseMode === '0') { // 不需要解密,直接返回
|
|
389
|
-
|
|
391
|
+
const dataStr = base64Util.encodeUTF8(new Uint8Array(data));
|
|
392
|
+
return new baseUtil.BaseRespFac({
|
|
393
|
+
header,
|
|
394
|
+
data: JSON.parse(dataStr),
|
|
395
|
+
retry: false,
|
|
396
|
+
});
|
|
390
397
|
}
|
|
391
398
|
const { retry, success: gwSuccess } = await eccUtil.resolveGwCode(gatewayCode);
|
|
392
399
|
if (!gwSuccess) {
|
package/src/encrypt/index.ts
CHANGED
|
@@ -118,6 +118,7 @@ function proxyWxRequest(): void {
|
|
|
118
118
|
const { success: resSuccess, msg, res } = await encryptUtil.resDecrypt(resHeader, resData, cryptoKeyInfo);
|
|
119
119
|
if (resSuccess) {
|
|
120
120
|
util.logInfo(url, traceparent, '解密成功');
|
|
121
|
+
encryptUtil.dealEncryptionSwitch(url, resHeader);
|
|
121
122
|
success?.call(this, res);
|
|
122
123
|
const completeRes: any = await completePromp;
|
|
123
124
|
completeRes.header = resHeader;
|