@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 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
@@ -10,5 +10,6 @@ declare const getBlockletInfo: (state: BlockletState, nodeSk?: string, { returnW
10
10
  passportColor?: string;
11
11
  appUrl: string;
12
12
  wallet?: WalletObject;
13
+ permanentWallet?: WalletObject;
13
14
  };
14
15
  export = getBlockletInfo;
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
- if (customSk && customSk.value && customType) {
39
- wallet = (0, wallet_1.default)(customSk.value, null, type);
40
- }
41
- else if (customSk && customSk.value) {
42
- wallet = (0, wallet_1.default)(customSk.value);
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 = { role: mcrypto_1.types.RoleType.ROLE_APPLICATION }, index = 0) => {
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, type);
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, type, index);
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.67-beta-794a8082",
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.67-beta-794a8082",
28
- "@abtnode/constant": "1.8.67-beta-794a8082",
29
- "@abtnode/util": "1.8.67-beta-794a8082",
30
- "@arcblock/did": "1.18.54",
31
- "@arcblock/did-ext": "1.18.54",
32
- "@arcblock/did-util": "1.18.54",
33
- "@arcblock/jwt": "1.18.54",
34
- "@blocklet/constant": "1.8.67-beta-794a8082",
35
- "@ocap/asset": "1.18.54",
36
- "@ocap/mcrypto": "1.18.54",
37
- "@ocap/types": "1.18.54",
38
- "@ocap/util": "1.18.54",
39
- "@ocap/wallet": "1.18.54",
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.66",
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": "f4ad32bea4d80b12971fb6bef941bdbe2af6a834"
84
+ "gitHead": "9070621373f317a10ff0d289323bf725e30d3521"
85
85
  }