@blocklet/sdk 1.7.5 → 1.7.8

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/README.md CHANGED
@@ -225,7 +225,6 @@ const authenticator = new WalletAuthenticator();
225
225
 
226
226
  const handlers = new WalletHandlers({
227
227
  authenticator,
228
- tokenGenerator: () => Date.now().toString(),
229
228
  tokenStorage: new AuthStorage({
230
229
  dbPath: path.join(process.env.BLOCKLET_DATA_DIR, 'auth.db'),
231
230
  onload: (err) => {
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable global-require */
2
2
  const axios = require('axios').create({ proxy: false });
3
+ const pick = require('lodash/pick');
3
4
 
4
5
  const JWT = require('@arcblock/jwt');
5
6
  const { NODE_MODES } = require('@abtnode/constant');
@@ -29,7 +30,8 @@ module.exports = async (
29
30
  options = {}
30
31
  ) => {
31
32
  await validateReceiver(receiver);
32
- await validateOption(options);
33
+ const opt = pick(options, ['keepForOfflineUser']);
34
+ await validateOption(opt);
33
35
 
34
36
  if (SERVER_MODE !== NODE_MODES.DEBUG) {
35
37
  await validateNotification(notification);
@@ -44,7 +46,7 @@ module.exports = async (
44
46
  sender: { did, token, appDid: appId },
45
47
  receiver,
46
48
  notification,
47
- options,
49
+ options: opt,
48
50
  },
49
51
  });
50
52
 
@@ -7,8 +7,8 @@ const noop = () => ({});
7
7
  const CONNECTED_DID_KEY = 'headers[x-connected-did]';
8
8
 
9
9
  // whether app web page is in mobile DID wallet
10
- const inMobileWallet = (abtwallet) => {
11
- return abtwallet && ['ios', 'android'].includes(abtwallet.os);
10
+ const inMobileWallet = (didwallet) => {
11
+ return didwallet && ['ios', 'android'].includes(didwallet.os);
12
12
  };
13
13
 
14
14
  class WalletHandlers extends Handler {
@@ -28,7 +28,7 @@ class WalletHandlers extends Handler {
28
28
  this.sendNotificationFn = sendNotificationFn || Notification.sendToUser.bind(Notification);
29
29
  }
30
30
 
31
- getConnectedDid = ({ req, abtwallet, extraParams }) => {
31
+ getConnectedDid = ({ req, didwallet, extraParams }) => {
32
32
  if (extraParams && extraParams.autoConnect === 'false') {
33
33
  return null;
34
34
  }
@@ -37,7 +37,7 @@ class WalletHandlers extends Handler {
37
37
  return null;
38
38
  }
39
39
 
40
- if (inMobileWallet(abtwallet)) {
40
+ if (inMobileWallet(didwallet)) {
41
41
  return null;
42
42
  }
43
43
 
@@ -75,6 +75,7 @@ class WalletHandlers extends Handler {
75
75
  message.checkUrl = checkUrl.href;
76
76
  }
77
77
 
78
+ // sendNotificationFn maybe custom function so we need params
78
79
  this.sendNotificationFn(connectedDid, message, params).catch((err) => {
79
80
  console.error(err);
80
81
  if (typeof opts.onError === 'function') {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.7.5",
6
+ "version": "1.7.8",
7
7
  "description": "graphql client to read/write data on abt node",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,16 +19,16 @@
19
19
  "author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@abtnode/client": "1.7.5",
23
- "@abtnode/constant": "1.7.5",
24
- "@arcblock/did-auth": "^1.15.7",
25
- "@arcblock/jwt": "^1.15.7",
26
- "@arcblock/ws": "^1.15.7",
27
- "@blocklet/meta": "1.7.5",
22
+ "@abtnode/client": "1.7.8",
23
+ "@abtnode/constant": "1.7.8",
24
+ "@arcblock/did-auth": "^1.16.3",
25
+ "@arcblock/jwt": "^1.16.3",
26
+ "@arcblock/ws": "^1.16.3",
27
+ "@blocklet/meta": "1.7.8",
28
28
  "@nedb/core": "^1.2.2",
29
- "@ocap/mcrypto": "^1.15.7",
30
- "@ocap/wallet": "^1.15.7",
31
- "axios": "^0.25.0",
29
+ "@ocap/mcrypto": "^1.16.3",
30
+ "@ocap/wallet": "^1.16.3",
31
+ "axios": "^0.26.1",
32
32
  "fs-extra": "^10.0.1",
33
33
  "joi": "^17.6.0",
34
34
  "lodash": "^4.17.21",
@@ -39,5 +39,5 @@
39
39
  "detect-port": "^1.3.0",
40
40
  "jest": "^27.4.5"
41
41
  },
42
- "gitHead": "b17d83773e5a4c06bae390fc70398d49d6dd86b3"
42
+ "gitHead": "ae75dd20b4750a31dc53c88b75ed1d95c8f15397"
43
43
  }