@blocklet/sdk 1.16.8-beta-0c0c5eb2 → 1.16.8-beta-81db8efa

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.
@@ -7,8 +7,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
7
7
  const pickBy_1 = __importDefault(require("lodash/pickBy"));
8
8
  const url_join_1 = __importDefault(require("url-join"));
9
9
  const client_1 = __importDefault(require("@abtnode/client"));
10
+ const semver_1 = __importDefault(require("semver"));
10
11
  const mcrypto_1 = require("@ocap/mcrypto");
11
12
  const wallet_1 = require("@ocap/wallet");
13
+ const env_1 = require("@blocklet/env");
12
14
  const constant_1 = __importDefault(require("@abtnode/constant"));
13
15
  const check_blocklet_env_1 = __importDefault(require("../util/check-blocklet-env"));
14
16
  const version_1 = require("../version");
@@ -29,15 +31,18 @@ const fixAvatar = (user) => {
29
31
  }
30
32
  return user;
31
33
  };
34
+ const toBuffer = (str) => (str.startsWith('0x') ? Buffer.from(str.slice(2), 'hex') : str);
32
35
  class AuthClient extends client_1.default {
33
36
  constructor(httpEndpoint) {
34
37
  (0, check_blocklet_env_1.default)();
35
38
  super(httpEndpoint || `http://127.0.0.1:${process.env.ABT_NODE_PORT}/api/gql`.trim(), `BlockletSDK/${VERSION}`);
36
39
  const wallet = (0, wallet_2.default)();
40
+ const useNewSigner = !env_1.serverVersion || semver_1.default.gte(env_1.serverVersion, '1.16.7');
37
41
  this.setAuthAccessKey({
38
42
  accessKeyId: wallet.address,
39
- accessKeySecret: wallet.secretKey,
40
- type,
43
+ // for backward compatibility
44
+ accessKeySecret: useNewSigner ? toBuffer(wallet.secretKey) : wallet.secretKey,
45
+ type: useNewSigner ? 'sha256' : type,
41
46
  });
42
47
  }
43
48
  _getAuthHeaders() {
@@ -0,0 +1,7 @@
1
+ export interface TEmailConfigSchema {
2
+ from: string;
3
+ host: string;
4
+ password: string;
5
+ port: number;
6
+ user: string;
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/indent */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import Joi from 'joi';
2
+ declare const emailConfigSchema: Joi.ObjectSchema<any>;
3
+ export { emailConfigSchema };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.emailConfigSchema = void 0;
7
+ const joi_1 = __importDefault(require("joi"));
8
+ const emailConfigSchema = joi_1.default.object({
9
+ from: joi_1.default.string().email().required(),
10
+ host: joi_1.default.string().hostname().required(),
11
+ port: joi_1.default.number().port().required(),
12
+ user: joi_1.default.string().required(),
13
+ password: joi_1.default.string().required(),
14
+ })
15
+ .empty(null)
16
+ .meta({ className: 'TEmailConfigSchema' });
17
+ exports.emailConfigSchema = emailConfigSchema;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.8-beta-0c0c5eb2",
6
+ "version": "1.16.8-beta-81db8efa",
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",
@@ -26,15 +26,15 @@
26
26
  "author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
- "@abtnode/client": "1.16.8-beta-0c0c5eb2",
30
- "@abtnode/constant": "1.16.8-beta-0c0c5eb2",
29
+ "@abtnode/client": "1.16.8-beta-81db8efa",
30
+ "@abtnode/constant": "1.16.8-beta-81db8efa",
31
31
  "@arcblock/did": "1.18.78",
32
32
  "@arcblock/did-auth": "1.18.78",
33
33
  "@arcblock/jwt": "1.18.78",
34
34
  "@arcblock/ws": "1.18.78",
35
- "@blocklet/constant": "1.16.8-beta-0c0c5eb2",
36
- "@blocklet/env": "1.16.8-beta-0c0c5eb2",
37
- "@blocklet/meta": "1.16.8-beta-0c0c5eb2",
35
+ "@blocklet/constant": "1.16.8-beta-81db8efa",
36
+ "@blocklet/env": "1.16.8-beta-81db8efa",
37
+ "@blocklet/meta": "1.16.8-beta-81db8efa",
38
38
  "@did-connect/authenticator": "^2.1.54",
39
39
  "@did-connect/handler": "^2.1.54",
40
40
  "@nedb/core": "^2.1.5",
@@ -47,6 +47,7 @@
47
47
  "json-stable-stringify": "^1.0.1",
48
48
  "lodash": "^4.17.21",
49
49
  "lru-cache": "^6.0.0",
50
+ "semver": "^7.3.8",
50
51
  "ufo": "^1.1.1",
51
52
  "url-join": "^4.0.1"
52
53
  },
@@ -72,5 +73,5 @@
72
73
  "ts-node": "^10.9.1",
73
74
  "typescript": "^4.8.4"
74
75
  },
75
- "gitHead": "0d8ec3154caf670770284dbdabc61a5f4e8b205f"
76
+ "gitHead": "8c4e3190de79a1fb2aaa14646255d938324cc5c2"
76
77
  }