@blocklet/meta 1.8.67-beta-794a8082 → 1.8.68-beta-500af7e5
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.d.ts +2 -1
- package/lib/info.d.ts +1 -0
- package/lib/info.js +8 -5
- package/lib/util.js +4 -1
- package/lib/wallet.d.ts +1 -1
- package/lib/wallet.js +4 -3
- package/package.json +16 -16
package/lib/index.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ declare const _default: {
|
|
|
74
74
|
name: string;
|
|
75
75
|
};
|
|
76
76
|
};
|
|
77
|
-
getBlockletWallet: (blockletDid: string, nodeSk?: string, type?: import("@arcblock/did").DIDType, index?: number) => import("@ocap/wallet").WalletObject<string>;
|
|
77
|
+
getBlockletWallet: (blockletDid: string, nodeSk?: string, type?: string | import("@arcblock/did").DIDType, index?: number) => import("@ocap/wallet").WalletObject<string>;
|
|
78
78
|
getBlockletInfo: (state: import("@abtnode/client").BlockletState, nodeSk?: string, { returnWallet }?: {
|
|
79
79
|
returnWallet?: boolean;
|
|
80
80
|
}) => {
|
|
@@ -85,6 +85,7 @@ declare const _default: {
|
|
|
85
85
|
passportColor?: string;
|
|
86
86
|
appUrl: string;
|
|
87
87
|
wallet?: import("@ocap/wallet").WalletObject<string>;
|
|
88
|
+
permanentWallet?: import("@ocap/wallet").WalletObject<string>;
|
|
88
89
|
};
|
|
89
90
|
getBlockletEngine: (meta: import("./types").TBlockletMeta) => import("./types").TEngine;
|
|
90
91
|
verifyMultiSig: (blockletMeta: import("./types").TBlockletMeta) => boolean;
|
package/lib/info.d.ts
CHANGED
package/lib/info.js
CHANGED
|
@@ -30,16 +30,18 @@ const getBlockletInfo = (state, nodeSk, { returnWallet = true } = {}) => {
|
|
|
30
30
|
}
|
|
31
31
|
const customSk = envs.find((x) => x.key === 'BLOCKLET_APP_SK');
|
|
32
32
|
const customType = envs.find((x) => x.key === 'BLOCKLET_WALLET_TYPE');
|
|
33
|
+
const permanentSk = envs.find((x) => x.key === 'BLOCKLET_APP_PSK');
|
|
33
34
|
let type;
|
|
34
35
|
if (customType && customType.value === 'eth') {
|
|
35
36
|
type = customType.value;
|
|
36
37
|
}
|
|
37
38
|
let wallet = null;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
let permanentWallet = null;
|
|
40
|
+
if (customSk && customSk.value) {
|
|
41
|
+
wallet = (0, wallet_1.default)(customSk.value, undefined, type);
|
|
42
|
+
if (permanentSk && permanentSk.value && permanentSk.value !== customSk.value) {
|
|
43
|
+
permanentWallet = (0, wallet_1.default)(permanentSk.value, undefined, type);
|
|
44
|
+
}
|
|
43
45
|
}
|
|
44
46
|
else {
|
|
45
47
|
if (!nodeSk || typeof nodeSk !== 'string') {
|
|
@@ -60,6 +62,7 @@ const getBlockletInfo = (state, nodeSk, { returnWallet = true } = {}) => {
|
|
|
60
62
|
passportColor,
|
|
61
63
|
appUrl,
|
|
62
64
|
wallet,
|
|
65
|
+
permanentWallet: permanentWallet || wallet,
|
|
63
66
|
};
|
|
64
67
|
};
|
|
65
68
|
module.exports = getBlockletInfo;
|
package/lib/util.js
CHANGED
|
@@ -275,10 +275,13 @@ const wipeSensitiveData = (blocklet) => {
|
|
|
275
275
|
});
|
|
276
276
|
}
|
|
277
277
|
(d.environments || []).forEach((x) => {
|
|
278
|
-
if (['BLOCKLET_APP_SK'].includes(x.key)) {
|
|
278
|
+
if (['BLOCKLET_APP_SK', 'BLOCKLET_APP_PSK'].includes(x.key)) {
|
|
279
279
|
x.value = '__encrypted__';
|
|
280
280
|
}
|
|
281
281
|
});
|
|
282
|
+
(d.migratedFrom || []).forEach((x) => {
|
|
283
|
+
x.appSk = '__encrypted__';
|
|
284
|
+
});
|
|
282
285
|
// @ts-ignore
|
|
283
286
|
delete blocklet.configObj;
|
|
284
287
|
// @ts-ignore
|
package/lib/wallet.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ import { DIDType } from '@arcblock/did';
|
|
|
5
5
|
*
|
|
6
6
|
* Spec: https://github.com/ArcBlock/ABT-DID-Protocol#request-did-authentication
|
|
7
7
|
*/
|
|
8
|
-
declare const getBlockletWallet: (blockletDid: string, nodeSk?: string, type?: DIDType, index?: number) => WalletObject;
|
|
8
|
+
declare const getBlockletWallet: (blockletDid: string, nodeSk?: string, type?: DIDType | string, index?: number) => WalletObject;
|
|
9
9
|
export = getBlockletWallet;
|
package/lib/wallet.js
CHANGED
|
@@ -8,10 +8,11 @@ const did_ext_1 = require("@arcblock/did-ext");
|
|
|
8
8
|
*
|
|
9
9
|
* Spec: https://github.com/ArcBlock/ABT-DID-Protocol#request-did-authentication
|
|
10
10
|
*/
|
|
11
|
-
const getBlockletWallet = (blockletDid, nodeSk, type
|
|
11
|
+
const getBlockletWallet = (blockletDid, nodeSk, type, index) => {
|
|
12
|
+
const t = type || { role: mcrypto_1.types.RoleType.ROLE_APPLICATION };
|
|
12
13
|
if (!(0, did_1.isValid)(blockletDid)) {
|
|
13
14
|
try {
|
|
14
|
-
return (0, wallet_1.fromSecretKey)(blockletDid,
|
|
15
|
+
return (0, wallet_1.fromSecretKey)(blockletDid, t);
|
|
15
16
|
}
|
|
16
17
|
catch (err) {
|
|
17
18
|
throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${err.message}`);
|
|
@@ -20,6 +21,6 @@ const getBlockletWallet = (blockletDid, nodeSk, type = { role: mcrypto_1.types.R
|
|
|
20
21
|
if (!nodeSk) {
|
|
21
22
|
throw new Error('Cannot get blocklet wallet with empty node sk');
|
|
22
23
|
}
|
|
23
|
-
return (0, did_ext_1.fromAppDid)(blockletDid, nodeSk,
|
|
24
|
+
return (0, did_ext_1.fromAppDid)(blockletDid, nodeSk, t, index || 0);
|
|
24
25
|
};
|
|
25
26
|
module.exports = getBlockletWallet;
|
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.68-beta-500af7e5",
|
|
7
7
|
"description": "Library to parse/validate/fix blocklet meta",
|
|
8
8
|
"main": "./lib/index.js",
|
|
9
9
|
"typings": "./lib/index.d.ts",
|
|
@@ -24,19 +24,19 @@
|
|
|
24
24
|
"author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@abtnode/client": "1.8.
|
|
28
|
-
"@abtnode/constant": "1.8.
|
|
29
|
-
"@abtnode/util": "1.8.
|
|
30
|
-
"@arcblock/did": "1.18.
|
|
31
|
-
"@arcblock/did-ext": "1.18.
|
|
32
|
-
"@arcblock/did-util": "1.18.
|
|
33
|
-
"@arcblock/jwt": "1.18.
|
|
34
|
-
"@blocklet/constant": "1.8.
|
|
35
|
-
"@ocap/asset": "1.18.
|
|
36
|
-
"@ocap/mcrypto": "1.18.
|
|
37
|
-
"@ocap/types": "1.18.
|
|
38
|
-
"@ocap/util": "1.18.
|
|
39
|
-
"@ocap/wallet": "1.18.
|
|
27
|
+
"@abtnode/client": "1.8.68-beta-500af7e5",
|
|
28
|
+
"@abtnode/constant": "1.8.68-beta-500af7e5",
|
|
29
|
+
"@abtnode/util": "1.8.68-beta-500af7e5",
|
|
30
|
+
"@arcblock/did": "1.18.57",
|
|
31
|
+
"@arcblock/did-ext": "1.18.57",
|
|
32
|
+
"@arcblock/did-util": "1.18.57",
|
|
33
|
+
"@arcblock/jwt": "1.18.57",
|
|
34
|
+
"@blocklet/constant": "1.8.68-beta-500af7e5",
|
|
35
|
+
"@ocap/asset": "1.18.57",
|
|
36
|
+
"@ocap/mcrypto": "1.18.57",
|
|
37
|
+
"@ocap/types": "1.18.57",
|
|
38
|
+
"@ocap/util": "1.18.57",
|
|
39
|
+
"@ocap/wallet": "1.18.57",
|
|
40
40
|
"ajv": "^8.11.0",
|
|
41
41
|
"axios": "^0.27.2",
|
|
42
42
|
"cjk-length": "^1.0.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"validate-npm-package-name": "^3.0.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@abtnode/client": "^1.8.
|
|
62
|
+
"@abtnode/client": "^1.8.67",
|
|
63
63
|
"@arcblock/eslint-config-ts": "^0.2.3",
|
|
64
64
|
"@types/express": "^4.17.14",
|
|
65
65
|
"@types/jest": "^29.2.2",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"ts-node": "^10.9.1",
|
|
82
82
|
"typescript": "^4.8.4"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "9070621373f317a10ff0d289323bf725e30d3521"
|
|
85
85
|
}
|