midway-fatcms 0.0.1-beta.72 → 0.0.1-beta.73

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.
@@ -11,6 +11,12 @@ export interface IExecuteSimpleSqlParams {
11
11
  validateCfg?: Record<string, IValidatorCfgItem[]>;
12
12
  columns?: string | string[];
13
13
  }
14
+ export interface ISecretBodyAnno {
15
+ payload1: string;
16
+ payload2: string;
17
+ payload3: string;
18
+ payload4: string;
19
+ }
14
20
  export interface ISecretBody {
15
21
  secretPayload: string;
16
22
  secretKey: string;
@@ -154,10 +154,14 @@ let BaseApiController = class BaseApiController extends BaseService_1.BaseServic
154
154
  throw new Error('[decodeBodyBySessionId] 用户必须登录');
155
155
  }
156
156
  const sessionInfo = this.getUserSessionInfo();
157
- const secretBody = body;
158
- if (!secretBody.secretPayload || !secretBody.secretKey) {
157
+ const secretBody0 = body;
158
+ if (!secretBody0.payload1 || !secretBody0.payload2 || !secretBody0.payload3 || !secretBody0.payload4) {
159
159
  return body;
160
160
  }
161
+ const secretBody = {
162
+ secretPayload: secretBody0.payload2,
163
+ secretKey: secretBody0.payload4,
164
+ };
161
165
  const { privateKey, publicKey } = sessionInfo;
162
166
  const secretPayload = secretBody.secretPayload;
163
167
  const secretKey = secretBody.secretKey; // 使用RSA加密的AES密钥
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "midway-fatcms",
3
- "version": "0.0.1-beta.72",
3
+ "version": "0.0.1-beta.73",
4
4
  "description": "This is a midway component sample",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
@@ -22,6 +22,13 @@ export interface IExecuteSimpleSqlParams {
22
22
  columns?: string | string[]; // ..."columns": "id,name,age,sex,addr",
23
23
  }
24
24
 
25
+ export interface ISecretBodyAnno {
26
+ payload1: string;
27
+ payload2: string;
28
+ payload3: string;
29
+ payload4: string;
30
+ }
31
+
25
32
  export interface ISecretBody {
26
33
  secretPayload: string;
27
34
  secretKey: string; // 使用RSA公钥加密的AES密钥
@@ -183,14 +190,18 @@ export class BaseApiController extends BaseService {
183
190
  }
184
191
 
185
192
  const sessionInfo = this.getUserSessionInfo();
186
- const secretBody = body as ISecretBody;
193
+ const secretBody0 = body as ISecretBodyAnno;
187
194
 
188
- if (!secretBody.secretPayload || !secretBody.secretKey) {
195
+ if (!secretBody0.payload1 || !secretBody0.payload2 || !secretBody0.payload3 || !secretBody0.payload4) {
189
196
  return body;
190
197
  }
191
198
 
192
- const { privateKey, publicKey } = sessionInfo;
199
+ const secretBody = {
200
+ secretPayload: secretBody0.payload2,
201
+ secretKey: secretBody0.payload4,
202
+ };
193
203
 
204
+ const { privateKey, publicKey } = sessionInfo;
194
205
  const secretPayload: string = secretBody.secretPayload;
195
206
  const secretKey: string = secretBody.secretKey; // 使用RSA加密的AES密钥
196
207
  const aesKey = await AsymmetricCrypto.decrypt(privateKey, secretKey); // 解密AES密钥