@blocklet/sdk 1.8.24 → 1.8.26
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/lib/index.js +2 -0
- package/lib/security/index.js +26 -0
- package/package.json +7 -7
package/lib/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const env = require('./env');
|
|
|
9
9
|
const middlewares = require('./middlewares');
|
|
10
10
|
const getWallet = require('./wallet');
|
|
11
11
|
const Component = require('./component');
|
|
12
|
+
const Security = require('./security');
|
|
12
13
|
const config = require('./config');
|
|
13
14
|
|
|
14
15
|
module.exports = {
|
|
@@ -35,5 +36,6 @@ module.exports = {
|
|
|
35
36
|
*/
|
|
36
37
|
component: Component,
|
|
37
38
|
Component,
|
|
39
|
+
Security,
|
|
38
40
|
config,
|
|
39
41
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const crypto = require('crypto');
|
|
2
|
+
const AES = require('@ocap/mcrypto/lib/crypter/aes').default;
|
|
3
|
+
|
|
4
|
+
const encrypt = (message) => {
|
|
5
|
+
if (!process.env.BLOCKLET_DID || !process.env.BLOCKLET_APP_EK) {
|
|
6
|
+
return message;
|
|
7
|
+
}
|
|
8
|
+
return AES.encrypt(
|
|
9
|
+
message,
|
|
10
|
+
crypto.pbkdf2Sync(process.env.BLOCKLET_APP_EK, process.env.BLOCKLET_DID, 256, 32, 'sha512').toString('hex')
|
|
11
|
+
);
|
|
12
|
+
};
|
|
13
|
+
const decrypt = (message) => {
|
|
14
|
+
if (!process.env.BLOCKLET_DID || !process.env.BLOCKLET_APP_EK) {
|
|
15
|
+
return message;
|
|
16
|
+
}
|
|
17
|
+
return AES.decrypt(
|
|
18
|
+
message,
|
|
19
|
+
crypto.pbkdf2Sync(process.env.BLOCKLET_APP_EK, process.env.BLOCKLET_DID, 256, 32, 'sha512').toString('hex')
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
module.exports = {
|
|
24
|
+
encrypt,
|
|
25
|
+
decrypt,
|
|
26
|
+
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.8.
|
|
6
|
+
"version": "1.8.26",
|
|
7
7
|
"description": "graphql client to read/write data on abt node",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@abtnode/client": "1.8.
|
|
23
|
-
"@abtnode/constant": "1.8.
|
|
22
|
+
"@abtnode/client": "1.8.26",
|
|
23
|
+
"@abtnode/constant": "1.8.26",
|
|
24
24
|
"@arcblock/did-auth": "1.17.19",
|
|
25
25
|
"@arcblock/jwt": "1.17.19",
|
|
26
26
|
"@arcblock/ws": "1.17.19",
|
|
27
|
-
"@blocklet/meta": "1.8.
|
|
28
|
-
"@did-connect/authenticator": "^2.1.
|
|
29
|
-
"@did-connect/handler": "^2.1.
|
|
27
|
+
"@blocklet/meta": "1.8.26",
|
|
28
|
+
"@did-connect/authenticator": "^2.1.20",
|
|
29
|
+
"@did-connect/handler": "^2.1.20",
|
|
30
30
|
"@nedb/core": "^2.0.4",
|
|
31
31
|
"@ocap/mcrypto": "1.17.19",
|
|
32
32
|
"@ocap/wallet": "1.17.19",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"detect-port": "^1.3.0",
|
|
46
46
|
"jest": "^27.5.1"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "71937dabc196a98a1bb514789bc32aee44a1e8c4"
|
|
49
49
|
}
|