@lingxiteam/assets 1.0.12-alpha.9 → 1.0.12-rc.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/es/dealDsl/preprocess/common.js +4 -0
- package/es/rootConfig/pc/Drawer.js +3 -0
- package/es/rootConfig/pc/Modal.js +3 -0
- package/es/security/index.d.ts +3 -39
- package/es/security/index.js +6 -19
- package/es/security/security.d.ts +327 -0
- package/lib/dealDsl/preprocess/common.js +4 -0
- package/lib/rootConfig/pc/Drawer.js +3 -0
- package/lib/rootConfig/pc/Modal.js +3 -0
- package/lib/security/index.d.ts +3 -39
- package/lib/security/index.js +7 -19
- package/lib/security/security.d.ts +327 -0
- package/package.json +5 -5
- package/es/security/const.d.ts +0 -22
- package/es/security/const.js +0 -23
- package/es/security/encipher/aes.d.ts +0 -2
- package/es/security/encipher/aes.js +0 -26
- package/es/security/encipher/des.d.ts +0 -2
- package/es/security/encipher/des.js +0 -25
- package/es/security/encipher/rsa.d.ts +0 -2
- package/es/security/encipher/rsa.js +0 -17
- package/es/security/encipher/sign.d.ts +0 -6
- package/es/security/encipher/sign.js +0 -102
- package/es/security/fetch.d.ts +0 -9
- package/es/security/fetch.js +0 -219
- package/es/security/httpEncryption.js +0 -74
- package/lib/security/const.d.ts +0 -22
- package/lib/security/const.js +0 -38
- package/lib/security/encipher/aes.d.ts +0 -2
- package/lib/security/encipher/aes.js +0 -35
- package/lib/security/encipher/des.d.ts +0 -2
- package/lib/security/encipher/des.js +0 -34
- package/lib/security/encipher/rsa.d.ts +0 -2
- package/lib/security/encipher/rsa.js +0 -26
- package/lib/security/encipher/sign.d.ts +0 -6
- package/lib/security/encipher/sign.js +0 -111
- package/lib/security/fetch.d.ts +0 -9
- package/lib/security/fetch.js +0 -226
- package/lib/security/httpEncryption.js +0 -83
|
@@ -210,6 +210,10 @@ var pc = {
|
|
|
210
210
|
var component = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
211
211
|
var _component$props11 = component.props,
|
|
212
212
|
props = _component$props11 === void 0 ? {} : _component$props11;
|
|
213
|
+
// 存量垃圾数据的删除Menu
|
|
214
|
+
if (props.extendRules && component.type === 'Menu') {
|
|
215
|
+
delete props.extendRules;
|
|
216
|
+
}
|
|
213
217
|
delete props.iconInfo;
|
|
214
218
|
return component;
|
|
215
219
|
},
|
package/es/security/index.d.ts
CHANGED
|
@@ -1,39 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
mode?: string | undefined;
|
|
5
|
-
signKeyOptions?: {} | undefined;
|
|
6
|
-
aesOptions?: {} | undefined;
|
|
7
|
-
desOptions?: {} | undefined;
|
|
8
|
-
rsaOptions?: {} | undefined;
|
|
9
|
-
}) => boolean;
|
|
10
|
-
stop: () => void;
|
|
11
|
-
fetch: (url: any, fetchOptions?: any, config?: {
|
|
12
|
-
mode?: string | undefined;
|
|
13
|
-
signKeyOptions?: any;
|
|
14
|
-
aesOptions?: any;
|
|
15
|
-
desOptions?: any;
|
|
16
|
-
rsaOptions?: any;
|
|
17
|
-
debug?: boolean | undefined;
|
|
18
|
-
}) => Promise<Response>;
|
|
19
|
-
createHttpSignStr: (url: string, options: any) => string;
|
|
20
|
-
};
|
|
21
|
-
sign: {
|
|
22
|
-
createHttpSignStr: (url: string, options: any) => string;
|
|
23
|
-
getApiPath: (url: string) => string | undefined;
|
|
24
|
-
};
|
|
25
|
-
RSAEncrypt: (value: string, publicKey: string, handle?: any) => any;
|
|
26
|
-
RSADecrypt: (value: string, privKey: string, handle?: any) => any;
|
|
27
|
-
AESEncrypt: (value: any, aesKey: string, handle?: any) => any;
|
|
28
|
-
AESDecrypt: (value: string, aesKey: string, handle?: any) => any;
|
|
29
|
-
DESEncrypt: (value: string, aesKey: string, handle?: any) => any;
|
|
30
|
-
DESDecrypt: (value: string, aesKey: string, handle?: any) => any;
|
|
31
|
-
KEYS: {
|
|
32
|
-
signKey: string;
|
|
33
|
-
rsaPublicKey: string | undefined;
|
|
34
|
-
rsaPrivKey: string | undefined;
|
|
35
|
-
aesKey: string;
|
|
36
|
-
desKey: string;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export default _default;
|
|
1
|
+
/// <reference types="src/security/security" />
|
|
2
|
+
import security from '@lingxiteam/security';
|
|
3
|
+
export default security;
|
package/es/security/index.js
CHANGED
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { RSAEncrypt, RSADecrypt } from '../security/encipher/rsa';
|
|
4
|
-
import { AESEncrypt, AESDecrypt } from '../security/encipher/aes';
|
|
5
|
-
import { DESEncrypt, DESDecrypt } from '../security/encipher/des';
|
|
6
|
-
import KEYS from './const';
|
|
1
|
+
/// <reference path="./security.d.ts" />
|
|
2
|
+
import security from '@lingxiteam/security';
|
|
7
3
|
window.lingxiSecurity = {
|
|
8
|
-
httpEncryption: httpEncryption
|
|
9
|
-
sign: sign
|
|
4
|
+
httpEncryption: security.httpEncryption
|
|
10
5
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
RSAEncrypt: RSAEncrypt,
|
|
15
|
-
RSADecrypt: RSADecrypt,
|
|
16
|
-
AESEncrypt: AESEncrypt,
|
|
17
|
-
AESDecrypt: AESDecrypt,
|
|
18
|
-
DESEncrypt: DESEncrypt,
|
|
19
|
-
DESDecrypt: DESDecrypt,
|
|
20
|
-
KEYS: KEYS
|
|
21
|
-
};
|
|
6
|
+
security.httpEncryption.buildXSignUrl = security.createHttpSignWithUrl;
|
|
7
|
+
security.httpEncryption.createHttpSignStr = security.createHttpSignStr;
|
|
8
|
+
export default security;
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
declare module '@lingxiteam/security' {
|
|
4
|
+
/**
|
|
5
|
+
* 灵犀安全对象,包含请求加签加密程序以及安全工具类方法
|
|
6
|
+
* @see {@link https://www.npmjs.com/package/@lingxiteam/security?activeTab=readme|api使用文档}
|
|
7
|
+
*/
|
|
8
|
+
namespace security {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 请求安全处理程序
|
|
12
|
+
* @example
|
|
13
|
+
* // 启动, 将自动处理所有请求,为请求进行加签或者加密
|
|
14
|
+
* security.httpEncryption.start({ mode: '1.0' });
|
|
15
|
+
*
|
|
16
|
+
* // 停止,停止后后续发起的请求不再进行加签或者加密处理
|
|
17
|
+
* security.httpEncryption.stop();
|
|
18
|
+
*/
|
|
19
|
+
export const httpEncryption: {
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 启动请求自动加密加签处理
|
|
23
|
+
* @param startConfig
|
|
24
|
+
* @returns 返回true表示开启成功; 返回false表示开启失败(配置存在问题); 返回null表示程序已启动,此次启动配置不生效,需停止后才能再启动
|
|
25
|
+
* @example
|
|
26
|
+
* // 指定开启请求安全模式
|
|
27
|
+
* // 1.0-参数签名
|
|
28
|
+
* // 1.1-时间限制性签名
|
|
29
|
+
* // 1.2-唯一限制性签名
|
|
30
|
+
* // 2.0-RSA参数加密
|
|
31
|
+
* // 3.0-AES参数加密
|
|
32
|
+
* security.httpEncryption.start({ mode: '1.0' })
|
|
33
|
+
*
|
|
34
|
+
* // 指定自定处理浏览器请求程序, 如只处理XMLHttpRequest
|
|
35
|
+
* security.httpEncryption.start({ mode: '1.0', requester: ['xhr'] });
|
|
36
|
+
*
|
|
37
|
+
* // 使用默认处理, 将自动从全局变量上获取模式(window.lxSecurityMode),缺省值为1.1
|
|
38
|
+
* security.httpEncryption.start();
|
|
39
|
+
*/
|
|
40
|
+
start: (startConfig?: configType) => boolean | null;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 停止请求自动加密加签处理
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
stop: () => void;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 加密加签请求(fetch API)
|
|
50
|
+
* 在不使用全局自动加密加签处理程序时(security.httpEncryption.start()),使用此api单独发起加密加签请求
|
|
51
|
+
*/
|
|
52
|
+
fetch: typeof fetch;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 加密加签请求(XMLHttpRequest API)
|
|
56
|
+
* 在不使用全局自动加密加签处理程序时(security.httpEncryption.start()),使用此api单独发起加密加签请求
|
|
57
|
+
*/
|
|
58
|
+
XMLHttpRequest: new () => XMLHttpRequest;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 加密加签请求(微信小程序请求API)
|
|
62
|
+
* 在不使用全局自动加密加签处理程序时(security.httpEncryption.start()),使用此api单独发起加密加签请求
|
|
63
|
+
*/
|
|
64
|
+
wxRequest: (option: WechatMiniprogram.RequestOption) => WechatMiniprogram.RequestTask;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated 使用security.createHttpSignWithUrl
|
|
68
|
+
*/
|
|
69
|
+
buildXSignUrl: (url: string, options: signHttpOptionsType, version?: any) => string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated 使用security.createHttpSignStr
|
|
73
|
+
*/
|
|
74
|
+
createHttpSignStr: (url: string, options: signHttpOptionsType, version?: any) => string;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 生成签名
|
|
79
|
+
* @param url 请求url地址
|
|
80
|
+
* @param options 请求配置信息(可选), method: 请求方法, headers: 头部参数, body: 请求内容数据, search: 查询参数, saltValue: 盐值
|
|
81
|
+
* @param version 签名版本(可选), 1.0, 1.1, 1.2, 缺省时默认取全局配置mode的值
|
|
82
|
+
* @returns 签名结果值
|
|
83
|
+
* @example
|
|
84
|
+
* const xsign = security.createHttpSignStr('/api/user/10001',
|
|
85
|
+
* { method: 'GET', headers: { 'app-id': '123' }, search: 'attrs=name,age' }));
|
|
86
|
+
*/
|
|
87
|
+
export function createHttpSignStr(url: string, options: signHttpOptionsType, version?: any) : string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 将签名添加在url上
|
|
91
|
+
* @param url 待处理的url
|
|
92
|
+
* @param options 请求配置信息(可选), method: 请求方法, headers: 头部参数, body: 请求内容数据, search: 查询参数, saltValue: 盐值
|
|
93
|
+
* @param version 签名版本(可选), 1.0, 1.1, 1.2, 缺省时默认取全局配置mode的值
|
|
94
|
+
* @returns 处理后的url地址,在url地址上添加X-SIGN参数和XA-TYPE参数
|
|
95
|
+
* @example
|
|
96
|
+
* // 资源请求无法在header上带上签名,将签名放在url地址上
|
|
97
|
+
* const url = security.createHttpSignWithUrl('/file?id=123', null, '1.0')
|
|
98
|
+
* // url -> /file?id=123&X-SIGN=xxxxxxx&XA-TYPE=1.0
|
|
99
|
+
* <img src={url} />
|
|
100
|
+
*/
|
|
101
|
+
export function createHttpSignWithUrl(url: string, options?: signHttpOptionsType | null, version?: string) : string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 将url参数进行加密处理
|
|
105
|
+
* @param url 待处理的url参数
|
|
106
|
+
* @param version 加密版本(可选), 2.0,3.0, 缺省时默认取全局配置mode的值
|
|
107
|
+
* @returns 处理后的url地址,url参数加密并附加XA-TYPE参数
|
|
108
|
+
* @example
|
|
109
|
+
* const url = security.createEncryptedWithUrl('/file?id=123', '3.0')
|
|
110
|
+
* // url -> /file?id=%2FSYiu5xcnYcmwlTvvBXOZk2I&XA-TYPE=3.0
|
|
111
|
+
* <img src={url} />
|
|
112
|
+
*/
|
|
113
|
+
export function createEncryptedWithUrl(url: string, version?: '2.0' | '3.0') : string;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 根据配置的mode自动对url进行加密或加签处理
|
|
117
|
+
* @param url 待处理的url
|
|
118
|
+
* @param options 配置项
|
|
119
|
+
* @returns 加签或加密后的url地址
|
|
120
|
+
* @example
|
|
121
|
+
* // 简单使用
|
|
122
|
+
* security.autoSecurityWithUrl('/file?id=123');
|
|
123
|
+
*
|
|
124
|
+
* // 避免1.1模式资源请求无法进行缓存,当是1.1模式时资源地址使用1.0模式
|
|
125
|
+
* security.autoSecurityWithUrl('/file?id=123', { modeRule: (currentMode) => currentMode === '1.1' ? '1.0' : currentMode });
|
|
126
|
+
*/
|
|
127
|
+
export function autoSecurityWithUrl(url: string, options?: {
|
|
128
|
+
modeRule?: (currentMode: modeType) => modeType,
|
|
129
|
+
saltValue?: signHttpOptionsType['saltValue']
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* 默认RSA加密处理函数
|
|
134
|
+
* @param content 待加密内容
|
|
135
|
+
* @param publicKey 密钥(可选)
|
|
136
|
+
* @param handle 自定义加密函数(可选)
|
|
137
|
+
* @returns 加密后内容
|
|
138
|
+
* @example
|
|
139
|
+
* // 简单使用
|
|
140
|
+
* security.RSAEncrypt('test');
|
|
141
|
+
*
|
|
142
|
+
* // 自定义秘钥
|
|
143
|
+
* security.RSAEncrypt('test', 'YourKey');
|
|
144
|
+
*
|
|
145
|
+
* // 自定义加密处理(在形参上可取到JSEncrypt)
|
|
146
|
+
* security.RSAEncrypt('test', null, (content, key, JSEncrypt) => {
|
|
147
|
+
* const encrypt = new JSEncrypt();
|
|
148
|
+
* encrypt.setPublicKey(key);
|
|
149
|
+
* return encrypt.encrypt(content);
|
|
150
|
+
* })
|
|
151
|
+
*/
|
|
152
|
+
export function RSAEncrypt(content: string, publicKey?: string | null, handle?: fnRSAEncryptType) : string;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 默认RSA解密处理函数
|
|
156
|
+
* @param content 待加密内容
|
|
157
|
+
* @param privKey 密钥(可选)
|
|
158
|
+
* @param handle 自定义加密函数(可选)
|
|
159
|
+
* @returns 解密后内容
|
|
160
|
+
* @example
|
|
161
|
+
* // 简单使用
|
|
162
|
+
* security.RSADecrypt('securityContent');
|
|
163
|
+
*
|
|
164
|
+
* // 自定义秘钥
|
|
165
|
+
* security.RSAEncrypt('securityContent', 'YourKey');
|
|
166
|
+
*
|
|
167
|
+
* // 自定义加密处理(在形参上可取到JSEncrypt)
|
|
168
|
+
* security.RSADecrypt('', null, (content, key, JSEncrypt) => {
|
|
169
|
+
* const decrypt = new JSEncrypt();
|
|
170
|
+
* decrypt.setPrivateKey(key);
|
|
171
|
+
* return decrypt.decrypt(content);
|
|
172
|
+
* })
|
|
173
|
+
*/
|
|
174
|
+
export function RSADecrypt(content: string, privKey?: string | null, handle?: fnRSADecryptType) : string;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* 默认AES加密处理函数
|
|
178
|
+
* @param content 待加密内容
|
|
179
|
+
* @param aesKey 密钥(可选)
|
|
180
|
+
* @param handle 自定义加密函数(可选)
|
|
181
|
+
* @returns 加密后内容
|
|
182
|
+
* @example
|
|
183
|
+
* // 简单使用
|
|
184
|
+
* security.AESEncrypt('test');
|
|
185
|
+
*
|
|
186
|
+
* // 自定义秘钥
|
|
187
|
+
* security.AESEncrypt('test', 'YourKey');
|
|
188
|
+
*
|
|
189
|
+
* // 自定义加密处理(在形参上可取到cryptoJS)
|
|
190
|
+
* security.AESEncrypt('test', null, (content, key, cryptoJS) => {
|
|
191
|
+
* const cipher = cryptoJS.createCipheriv('aes-256-cbc', key, Buffer.from('16bytesrandomiv'));
|
|
192
|
+
* let encrypted = cipher.update(content);
|
|
193
|
+
* encrypted = Buffer.concat([encrypted, cipher.final()]);
|
|
194
|
+
* return encrypted.toString('hex');
|
|
195
|
+
* })
|
|
196
|
+
*/
|
|
197
|
+
export function AESEncrypt(content: string, aesKey?: string | null, handle?: fnAESEncryptType) : string;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* 默认AES解密处理函数
|
|
201
|
+
* @param content 待解密内容
|
|
202
|
+
* @param aesKey 密钥
|
|
203
|
+
* @param handle 自定义解密函数
|
|
204
|
+
* @returns 解密后内容
|
|
205
|
+
* @example
|
|
206
|
+
* // AESDecrypt
|
|
207
|
+
* security.AESEncrypt('securityContent');
|
|
208
|
+
*
|
|
209
|
+
* // 自定义秘钥
|
|
210
|
+
* security.AESDecrypt('securityContent', 'YourKey');
|
|
211
|
+
*
|
|
212
|
+
* // 自定义加密处理(在形参上可取到cryptoJS)
|
|
213
|
+
* security.AESDecrypt('test', null, (content, key, cryptoJS) => {
|
|
214
|
+
* const decipher = cryptoJS.createDecipheriv('aes-256-cbc', key, Buffer.from('16bytesrandomiv'));
|
|
215
|
+
* let decrypted = decipher.update(Buffer.from(content, 'hex'));
|
|
216
|
+
* decrypted = Buffer.concat([decrypted, decipher.final()]);
|
|
217
|
+
* return decrypted.toString();
|
|
218
|
+
* })
|
|
219
|
+
*/
|
|
220
|
+
export function AESDecrypt(content: string, aesKey?: string | null, handle?: fnAESDecryptType) : string;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* 配置设置
|
|
224
|
+
* @param config 配置项
|
|
225
|
+
* @example
|
|
226
|
+
* security.httpEncryption.start({ mode: '1.0' });
|
|
227
|
+
* // 等效于
|
|
228
|
+
* security.setConfig({ mode: '1.0' });
|
|
229
|
+
* security.httpEncryption.start();
|
|
230
|
+
*
|
|
231
|
+
* setConfig的使用场景一般为工程内不使用security.httpEncryption.start方法,或后续进行调整配置项时使用。
|
|
232
|
+
*/
|
|
233
|
+
export function setConfig(config: configType) : void;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* 获取配置信息
|
|
237
|
+
* @param key 配置项
|
|
238
|
+
* @returns 配置值
|
|
239
|
+
* @example
|
|
240
|
+
* // 获取当前mode值
|
|
241
|
+
* security.getConfig('mode');
|
|
242
|
+
*
|
|
243
|
+
* // 获取当前aes秘钥值
|
|
244
|
+
* security.getConfig('aes').key;
|
|
245
|
+
*/
|
|
246
|
+
export function getConfig<T extends keyof configType>(key: T) : configType[T];
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* 初始化配置项
|
|
250
|
+
* 将从全局上获取配置数据与默认配置项整合进行初始化设置
|
|
251
|
+
* 程序解析运行时将自动执行初始化,后续再次执行会重新从全局上获取配置数据进行设置
|
|
252
|
+
* @example
|
|
253
|
+
* security.initConfig();
|
|
254
|
+
*/
|
|
255
|
+
export function initConfig() : void;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* 预置加密函数,可以使用该函数加密结果作为key
|
|
259
|
+
* @param str 待加密字符
|
|
260
|
+
*/
|
|
261
|
+
export function lxEncrypt(str: string) : string;
|
|
262
|
+
|
|
263
|
+
export const html: {
|
|
264
|
+
safeHTML: (content: string, options?: { blackList?: string[] }) => string;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* 将url参数解密
|
|
269
|
+
* @param search url参数, 如: a=XAZYt1dl43v0gYUlNM6wEg%3D%3D&b=rbsCqzqEZvsUn41oxNsJ%2FQ%3D%3D
|
|
270
|
+
* @param mode 加密模式
|
|
271
|
+
* @returns string 解密后数据
|
|
272
|
+
*/
|
|
273
|
+
export function decryptedStrForSearchParams(search: string, mode: '2.0' | '3.0'): string;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* 检查安全模式是否为加密
|
|
277
|
+
* @param mode 模式值
|
|
278
|
+
* @returns boolean
|
|
279
|
+
*/
|
|
280
|
+
export function checkIsEncryption(mode: string): boolean;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* 统一解密函数
|
|
284
|
+
* @param str 待解密内容
|
|
285
|
+
* @param type 加密类型
|
|
286
|
+
* @param config 配置项(自定义秘钥和解密方法)
|
|
287
|
+
* @returns string 解密后的内容
|
|
288
|
+
*/
|
|
289
|
+
export function decryptedStr(str: string, type: string): string;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* 统一加密函数
|
|
293
|
+
* @param str 待加密内容
|
|
294
|
+
* @param type 加密类型
|
|
295
|
+
* @returns string 加密后内容
|
|
296
|
+
*/
|
|
297
|
+
export function encryptedStr(str: string, type: string): string;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* 检查安全模式是否为加签
|
|
301
|
+
* @param mode 模式值
|
|
302
|
+
* @returns boolean
|
|
303
|
+
*/
|
|
304
|
+
export function checkIsSignMode(mode: string): boolean;
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* 生成待签名的内容
|
|
308
|
+
* @param url
|
|
309
|
+
* @param options
|
|
310
|
+
* @param props
|
|
311
|
+
* @param version
|
|
312
|
+
*/
|
|
313
|
+
export function createHttpSignContent(
|
|
314
|
+
url: string,
|
|
315
|
+
options: signHttpOptionsType,
|
|
316
|
+
props: {
|
|
317
|
+
nowTime: number;
|
|
318
|
+
uuid: string;
|
|
319
|
+
},
|
|
320
|
+
version?: any
|
|
321
|
+
): [string, string];
|
|
322
|
+
|
|
323
|
+
export function SHA256(content: string): string;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export default security;
|
|
327
|
+
}
|
|
@@ -216,6 +216,10 @@ var pc = {
|
|
|
216
216
|
var component = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
217
217
|
var _component$props11 = component.props,
|
|
218
218
|
props = _component$props11 === void 0 ? {} : _component$props11;
|
|
219
|
+
// 存量垃圾数据的删除Menu
|
|
220
|
+
if (props.extendRules && component.type === 'Menu') {
|
|
221
|
+
delete props.extendRules;
|
|
222
|
+
}
|
|
219
223
|
delete props.iconInfo;
|
|
220
224
|
return component;
|
|
221
225
|
},
|
package/lib/security/index.d.ts
CHANGED
|
@@ -1,39 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
mode?: string | undefined;
|
|
5
|
-
signKeyOptions?: {} | undefined;
|
|
6
|
-
aesOptions?: {} | undefined;
|
|
7
|
-
desOptions?: {} | undefined;
|
|
8
|
-
rsaOptions?: {} | undefined;
|
|
9
|
-
}) => boolean;
|
|
10
|
-
stop: () => void;
|
|
11
|
-
fetch: (url: any, fetchOptions?: any, config?: {
|
|
12
|
-
mode?: string | undefined;
|
|
13
|
-
signKeyOptions?: any;
|
|
14
|
-
aesOptions?: any;
|
|
15
|
-
desOptions?: any;
|
|
16
|
-
rsaOptions?: any;
|
|
17
|
-
debug?: boolean | undefined;
|
|
18
|
-
}) => Promise<Response>;
|
|
19
|
-
createHttpSignStr: (url: string, options: any) => string;
|
|
20
|
-
};
|
|
21
|
-
sign: {
|
|
22
|
-
createHttpSignStr: (url: string, options: any) => string;
|
|
23
|
-
getApiPath: (url: string) => string | undefined;
|
|
24
|
-
};
|
|
25
|
-
RSAEncrypt: (value: string, publicKey: string, handle?: any) => any;
|
|
26
|
-
RSADecrypt: (value: string, privKey: string, handle?: any) => any;
|
|
27
|
-
AESEncrypt: (value: any, aesKey: string, handle?: any) => any;
|
|
28
|
-
AESDecrypt: (value: string, aesKey: string, handle?: any) => any;
|
|
29
|
-
DESEncrypt: (value: string, aesKey: string, handle?: any) => any;
|
|
30
|
-
DESDecrypt: (value: string, aesKey: string, handle?: any) => any;
|
|
31
|
-
KEYS: {
|
|
32
|
-
signKey: string;
|
|
33
|
-
rsaPublicKey: string | undefined;
|
|
34
|
-
rsaPrivKey: string | undefined;
|
|
35
|
-
aesKey: string;
|
|
36
|
-
desKey: string;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export default _default;
|
|
1
|
+
/// <reference types="src/security/security" />
|
|
2
|
+
import security from '@lingxiteam/security';
|
|
3
|
+
export default security;
|
package/lib/security/index.js
CHANGED
|
@@ -4,26 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
8
|
-
var _sign = _interopRequireDefault(require("./encipher/sign"));
|
|
9
|
-
var _rsa = require("../security/encipher/rsa");
|
|
10
|
-
var _aes = require("../security/encipher/aes");
|
|
11
|
-
var _des = require("../security/encipher/des");
|
|
12
|
-
var _const = _interopRequireDefault(require("./const"));
|
|
7
|
+
var _security = _interopRequireDefault(require("@lingxiteam/security"));
|
|
13
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
/// <reference path="./security.d.ts" />
|
|
10
|
+
|
|
14
11
|
window.lingxiSecurity = {
|
|
15
|
-
httpEncryption:
|
|
16
|
-
sign: _sign.default
|
|
17
|
-
};
|
|
18
|
-
var _default = {
|
|
19
|
-
httpEncryption: _httpEncryption.default,
|
|
20
|
-
sign: _sign.default,
|
|
21
|
-
RSAEncrypt: _rsa.RSAEncrypt,
|
|
22
|
-
RSADecrypt: _rsa.RSADecrypt,
|
|
23
|
-
AESEncrypt: _aes.AESEncrypt,
|
|
24
|
-
AESDecrypt: _aes.AESDecrypt,
|
|
25
|
-
DESEncrypt: _des.DESEncrypt,
|
|
26
|
-
DESDecrypt: _des.DESDecrypt,
|
|
27
|
-
KEYS: _const.default
|
|
12
|
+
httpEncryption: _security.default.httpEncryption
|
|
28
13
|
};
|
|
14
|
+
_security.default.httpEncryption.buildXSignUrl = _security.default.createHttpSignWithUrl;
|
|
15
|
+
_security.default.httpEncryption.createHttpSignStr = _security.default.createHttpSignStr;
|
|
16
|
+
var _default = _security.default;
|
|
29
17
|
exports.default = _default;
|