tools-min-ns 1.17.0 → 1.18.0

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/README.md CHANGED
@@ -5,6 +5,12 @@ pnpm i tools-min-ns --save
5
5
  ```
6
6
 
7
7
  # updates
8
+ ## v1.18.0
9
+ >StorageUtil
10
+ 采用xor压缩算法加解密
11
+ ## v1.17.1
12
+ >StorageUtil
13
+ PasswordUtil引用路径bug
8
14
  ## v1.17.0
9
15
  >StorageUtil
10
16
  加解密
@@ -20,20 +20,20 @@ var __read = this && this.__read || function (o, n) {
20
20
  }
21
21
  return ar;
22
22
  };
23
- import PasswordUtil from 'src/pwd/PasswordUtil';
23
+ import PasswordUtil from '../pwd/PasswordUtil';
24
24
  import config from '../config';
25
25
  var StorageUtil;
26
26
  (function (StorageUtil) {
27
27
  function setItem(name, data, opts) {
28
28
  var cacheType = (opts === null || opts === void 0 ? void 0 : opts.type) || config.cacheType;
29
- if (name && data !== undefined) window["".concat(cacheType, "Storage")].setItem((opts === null || opts === void 0 ? void 0 : opts.itemName) || "".concat(config.title).concat(name), PasswordUtil.strEncrypt(JSON.stringify(data)));
29
+ if (name && data !== undefined) window["".concat(cacheType, "Storage")].setItem((opts === null || opts === void 0 ? void 0 : opts.itemName) || "".concat(config.title).concat(name), PasswordUtil.xorEncryptData(data));
30
30
  }
31
31
  StorageUtil.setItem = setItem;
32
32
  function getItem(name, opts) {
33
33
  var cacheType = (opts === null || opts === void 0 ? void 0 : opts.type) || config.cacheType;
34
34
  var item = window["".concat(cacheType, "Storage")].getItem((opts === null || opts === void 0 ? void 0 : opts.itemName) || "".concat(config.title).concat(name));
35
35
  try {
36
- return JSON.parse(PasswordUtil.strDecrypt(item));
36
+ return PasswordUtil.xorDecryptData(item);
37
37
  } catch (error) {
38
38
  return item;
39
39
  }
@@ -30,20 +30,20 @@ var __importDefault = this && this.__importDefault || function (mod) {
30
30
  Object.defineProperty(exports, "__esModule", {
31
31
  value: true
32
32
  });
33
- var PasswordUtil_1 = __importDefault(require("src/pwd/PasswordUtil"));
33
+ var PasswordUtil_1 = __importDefault(require("../pwd/PasswordUtil"));
34
34
  var config_1 = __importDefault(require("../config"));
35
35
  var StorageUtil;
36
36
  (function (StorageUtil) {
37
37
  function setItem(name, data, opts) {
38
38
  var cacheType = (opts === null || opts === void 0 ? void 0 : opts.type) || config_1.default.cacheType;
39
- if (name && data !== undefined) window["".concat(cacheType, "Storage")].setItem((opts === null || opts === void 0 ? void 0 : opts.itemName) || "".concat(config_1.default.title).concat(name), PasswordUtil_1.default.strEncrypt(JSON.stringify(data)));
39
+ if (name && data !== undefined) window["".concat(cacheType, "Storage")].setItem((opts === null || opts === void 0 ? void 0 : opts.itemName) || "".concat(config_1.default.title).concat(name), PasswordUtil_1.default.xorEncryptData(data));
40
40
  }
41
41
  StorageUtil.setItem = setItem;
42
42
  function getItem(name, opts) {
43
43
  var cacheType = (opts === null || opts === void 0 ? void 0 : opts.type) || config_1.default.cacheType;
44
44
  var item = window["".concat(cacheType, "Storage")].getItem((opts === null || opts === void 0 ? void 0 : opts.itemName) || "".concat(config_1.default.title).concat(name));
45
45
  try {
46
- return JSON.parse(PasswordUtil_1.default.strDecrypt(item));
46
+ return PasswordUtil_1.default.xorDecryptData(item);
47
47
  } catch (error) {
48
48
  return item;
49
49
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tools-min-ns",
3
3
  "description": "工具包适用于前端以及node",
4
- "version": "1.17.0",
4
+ "version": "1.18.0",
5
5
  "main": "lib/index.js",
6
6
  "license": "MIT",
7
7
  "author": "nanshen",