@abtnode/auth 1.6.25 → 1.6.28

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.
Files changed (2) hide show
  1. package/lib/auth.js +12 -1
  2. package/package.json +6 -6
package/lib/auth.js CHANGED
@@ -274,9 +274,10 @@ const createAuthToken = ({ did, passport, role, secret, expiresIn } = {}) => {
274
274
  return token;
275
275
  };
276
276
 
277
- const createAuthTokenByOwnershipNFT = ({ role, secret, expiresIn } = {}) => {
277
+ const createAuthTokenByOwnershipNFT = ({ did, role, secret, expiresIn } = {}) => {
278
278
  const payload = {
279
279
  type: 'ownership_nft',
280
+ did,
280
281
  role,
281
282
  };
282
283
 
@@ -300,6 +301,16 @@ const beforeInvitationRequest = async ({ node, teamDid, inviteId, locale = 'en'
300
301
  }[locale]
301
302
  );
302
303
  }
304
+
305
+ const count = await node.getUsersCount({ teamDid });
306
+ if (count === 0) {
307
+ throw new Error(
308
+ {
309
+ en: 'The Application has no owner attached',
310
+ zh: '应用未绑定所有者',
311
+ }[locale]
312
+ );
313
+ }
303
314
  };
304
315
 
305
316
  const createInvitationRequest = async ({ node, nodeInfo, teamDid, inviteId, locale = 'en' }) => {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.6.25",
6
+ "version": "1.6.28",
7
7
  "description": "Simple lib to manage auth in ABT Node",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -20,12 +20,12 @@
20
20
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@abtnode/constant": "1.6.25",
24
- "@abtnode/logger": "1.6.25",
25
- "@abtnode/util": "1.6.25",
23
+ "@abtnode/constant": "1.6.28",
24
+ "@abtnode/logger": "1.6.28",
25
+ "@abtnode/util": "1.6.28",
26
26
  "@arcblock/did": "^1.14.19",
27
27
  "@arcblock/vc": "^1.14.19",
28
- "@blocklet/meta": "1.6.25",
28
+ "@blocklet/meta": "1.6.28",
29
29
  "@ocap/mcrypto": "^1.14.19",
30
30
  "@ocap/util": "^1.14.19",
31
31
  "@ocap/wallet": "^1.14.19",
@@ -39,5 +39,5 @@
39
39
  "devDependencies": {
40
40
  "jest": "^27.4.5"
41
41
  },
42
- "gitHead": "bd2ad7d90fbd1b3786702dfca1ab28dcec9a7bc7"
42
+ "gitHead": "acef8ea339bd8fc9c785312eb5a1a113ecbf0d4d"
43
43
  }