dream-common 1.1.17 → 1.1.18

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/index.js CHANGED
@@ -14,5 +14,6 @@ export default {
14
14
  ...require('./lib/uuid'),
15
15
  ...require('./lib/authorization'),
16
16
  ...require('./lib/json'),
17
+ ...require('./lib/CryptoJS/Base58'),
17
18
  ...require('./lib/CryptoJS/AesUtils')
18
19
  }
@@ -8,8 +8,8 @@ import CryptoJS from 'crypto-js'
8
8
  */
9
9
  export const aesEncrypt = (key, content) => {
10
10
  key = CryptoJS.enc.Utf8.parse(key);
11
- let srcs = CryptoJS.enc.Utf8.parse(content);
12
- let encrypted = CryptoJS.AES.encrypt(srcs, key, {mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7});
11
+ let secs = CryptoJS.enc.Utf8.parse(content);
12
+ let encrypted = CryptoJS.AES.encrypt(secs, key, {mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7});
13
13
  return encrypted.toString();
14
14
  }
15
15
 
@@ -0,0 +1,13 @@
1
+ import bs58 from 'bs58'
2
+
3
+ export const encodeBase58 = (string) => {
4
+ const bufferData = Buffer.from(string, 'utf8');
5
+ const encodedData = bs58.encode(bufferData);
6
+ return encodedData.toString();
7
+ }
8
+ export const decodeBase58 = (string) => {
9
+ // 对编码后的数据进行解码
10
+ const decodedBuffer = bs58.decode(string);
11
+ const value = Buffer.from(decodedBuffer).toString('utf8');
12
+ return value.toString();
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dream-common",
3
- "version": "1.1.17",
3
+ "version": "1.1.18",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -13,6 +13,7 @@
13
13
  "author": "dreamflyZhang",
14
14
  "license": "ISC",
15
15
  "dependencies": {
16
- "crypto-js": "^4.0.0"
16
+ "bs58": "^6.0.0",
17
+ "crypto-js": "^4.2.0"
17
18
  }
18
19
  }