@blocklet/sdk 1.16.34-beta-20241207-004652-f10ad343 → 1.16.34-beta-20241212-094401-992d20c3

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.
@@ -1,9 +1,14 @@
1
1
  declare const encrypt: (message: string, password?: string, salt?: string) => string;
2
2
  declare const decrypt: (message: string, password?: string, salt?: string) => string;
3
+ declare const signResponse: (data: any) => any;
4
+ declare const verifyResponse: (data: any) => boolean;
3
5
  export { encrypt };
4
6
  export { decrypt };
7
+ export { signResponse, verifyResponse };
5
8
  declare const _default: {
6
9
  encrypt: (message: string, password?: string, salt?: string) => string;
7
10
  decrypt: (message: string, password?: string, salt?: string) => string;
11
+ signResponse: (data: any) => any;
12
+ verifyResponse: (data: any) => boolean;
8
13
  };
9
14
  export default _default;
@@ -3,9 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.decrypt = exports.encrypt = void 0;
6
+ exports.verifyResponse = exports.signResponse = exports.decrypt = exports.encrypt = void 0;
7
7
  const crypto_1 = __importDefault(require("crypto"));
8
8
  const aes_legacy_1 = __importDefault(require("@ocap/mcrypto/lib/crypter/aes-legacy"));
9
+ const security_1 = require("@blocklet/meta/lib/security");
10
+ const wallet_1 = __importDefault(require("../wallet"));
9
11
  const AES = { default: aes_legacy_1.default }.default;
10
12
  const encrypt = (message, password, salt) => {
11
13
  const _password = password || process.env.BLOCKLET_APP_EK;
@@ -25,7 +27,13 @@ const decrypt = (message, password, salt) => {
25
27
  return AES.decrypt(message, crypto_1.default.pbkdf2Sync(_password, _salt, 256, 32, 'sha512').toString('hex'));
26
28
  };
27
29
  exports.decrypt = decrypt;
30
+ const signResponse = (data) => (0, security_1.signResponse)(data, (0, wallet_1.default)());
31
+ exports.signResponse = signResponse;
32
+ const verifyResponse = (data) => (0, security_1.verifyResponse)(data, (0, wallet_1.default)());
33
+ exports.verifyResponse = verifyResponse;
28
34
  exports.default = {
29
35
  encrypt,
30
36
  decrypt,
37
+ signResponse,
38
+ verifyResponse,
31
39
  };
@@ -18,10 +18,15 @@ function parseDockerComponentHost(component) {
18
18
  return '127.0.0.1';
19
19
  }
20
20
  function parseDockerComponentEndpoint(endpoint, component) {
21
- if (process.env.BLOCKLET_DOCKER_NETWORK && process.env.BLOCKLET_DOCKER_NETWORK !== 'host') {
22
- const url = new URL(endpoint);
23
- url.host = parseDockerHost(`${process.env.BLOCKLET_DOCKER_NETWORK}-${component.name || component.did}`);
24
- return url.toString();
21
+ if (endpoint && process.env.BLOCKLET_DOCKER_NETWORK && process.env.BLOCKLET_DOCKER_NETWORK !== 'host') {
22
+ try {
23
+ const url = new URL(endpoint);
24
+ url.host = parseDockerHost(`${process.env.BLOCKLET_DOCKER_NETWORK}-${component.name || component.did}`);
25
+ return url.toString();
26
+ }
27
+ catch (error) {
28
+ return endpoint;
29
+ }
25
30
  }
26
31
  return endpoint;
27
32
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.34-beta-20241207-004652-f10ad343",
6
+ "version": "1.16.34-beta-20241212-094401-992d20c3",
7
7
  "description": "graphql client to read/write data on abt node",
8
8
  "main": "lib/index.js",
9
9
  "typings": "lib/index.d.ts",
@@ -27,21 +27,21 @@
27
27
  "author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
28
28
  "license": "Apache-2.0",
29
29
  "dependencies": {
30
- "@abtnode/client": "1.16.34-beta-20241207-004652-f10ad343",
31
- "@abtnode/constant": "1.16.34-beta-20241207-004652-f10ad343",
32
- "@abtnode/util": "1.16.34-beta-20241207-004652-f10ad343",
33
- "@arcblock/did": "1.18.156",
34
- "@arcblock/did-auth": "1.18.156",
35
- "@arcblock/jwt": "1.18.156",
36
- "@arcblock/ws": "1.18.156",
37
- "@blocklet/constant": "1.16.34-beta-20241207-004652-f10ad343",
38
- "@blocklet/env": "1.16.34-beta-20241207-004652-f10ad343",
39
- "@blocklet/meta": "1.16.34-beta-20241207-004652-f10ad343",
30
+ "@abtnode/client": "1.16.34-beta-20241212-094401-992d20c3",
31
+ "@abtnode/constant": "1.16.34-beta-20241212-094401-992d20c3",
32
+ "@abtnode/util": "1.16.34-beta-20241212-094401-992d20c3",
33
+ "@arcblock/did": "1.18.159",
34
+ "@arcblock/did-auth": "1.18.159",
35
+ "@arcblock/jwt": "1.18.159",
36
+ "@arcblock/ws": "1.18.159",
37
+ "@blocklet/constant": "1.16.34-beta-20241212-094401-992d20c3",
38
+ "@blocklet/env": "1.16.34-beta-20241212-094401-992d20c3",
39
+ "@blocklet/meta": "1.16.34-beta-20241212-094401-992d20c3",
40
40
  "@did-connect/authenticator": "^2.2.4",
41
41
  "@did-connect/handler": "^2.2.4",
42
42
  "@nedb/core": "^2.1.5",
43
- "@ocap/mcrypto": "1.18.156",
44
- "@ocap/wallet": "1.18.156",
43
+ "@ocap/mcrypto": "1.18.159",
44
+ "@ocap/wallet": "1.18.159",
45
45
  "axios": "^1.7.5",
46
46
  "cheerio": "1.0.0-rc.12",
47
47
  "debug": "^4.3.7",
@@ -80,5 +80,5 @@
80
80
  "ts-node": "^10.9.1",
81
81
  "typescript": "^5.6.3"
82
82
  },
83
- "gitHead": "164559152125585db2b26864ecb627bd81b56a77"
83
+ "gitHead": "b7f48fbd0fa4c1b5626a501a860701879be1c7b9"
84
84
  }