@abtnode/auth 1.8.0 → 1.8.3

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/auth.js CHANGED
@@ -402,10 +402,14 @@ const handleInvitationResponse = async ({
402
402
  verifySignature(claim, userDid, userPk, locale);
403
403
 
404
404
  const tmpInvitation = await node.getInvitation({ teamDid, inviteId });
405
+ if (!tmpInvitation) {
406
+ throw new Error(`The invitation does not exist: ${inviteId}`);
407
+ }
405
408
 
406
409
  if (tmpInvitation.role === 'owner' && userDid === nodeInfo.nodeOwner.did) {
407
410
  throw new Error(messages.notAllowedTransferToSelf[locale]);
408
411
  }
412
+
409
413
  const inviteInfo = await node.processInvitation({ teamDid, inviteId });
410
414
  if (inviteInfo.role === 'owner' && get(nodeInfo, 'ownerNft.holder')) {
411
415
  // 这种情况下是 Transfer 有 Owner NFT 的 Blocklet Server
package/lib/server.js CHANGED
@@ -13,7 +13,6 @@ const {
13
13
  VC_TYPE_NODE_PASSPORT,
14
14
  NFT_TYPE_SERVER_OWNERSHIP,
15
15
  } = require('@abtnode/constant');
16
- const { sign } = require('@arcblock/jwt');
17
16
  const {
18
17
  messages,
19
18
  getVCFromClaims,
@@ -278,23 +277,11 @@ const createLaunchBlockletHandler =
278
277
  throw new Error(messages.invalidBlocklet[locale]);
279
278
  }
280
279
 
281
- const info = await node.getNodeInfo();
282
- const headers = {};
283
-
284
280
  if (!blocklet.isFree) {
285
281
  if (isEmpty(extraParams?.previousWorkflowData?.downloadToken)) {
286
282
  logger.error('downloadToken must be provided');
287
283
  throw new Error(messages.invalidParams[locale]);
288
284
  }
289
-
290
- Object.assign(headers, {
291
- 'x-server-did': info.did,
292
- 'x-download-token': extraParams.previousWorkflowData.downloadToken,
293
- 'x-server-publick-key': info.pk,
294
- 'x-server-signature': sign(info.did, info.sk, {
295
- exp: (Date.now() + 5 * 60 * 1000) / 1000,
296
- }),
297
- });
298
285
  }
299
286
 
300
287
  const { did } = blocklet.meta;
@@ -339,14 +326,10 @@ const createLaunchBlockletHandler =
339
326
  return;
340
327
  }
341
328
 
342
- const tmp = await node.installBlocklet(
343
- {
344
- url: blockletMetaUrl,
345
- },
346
- {
347
- headers,
348
- }
349
- );
329
+ const tmp = await node.installBlocklet({
330
+ url: blockletMetaUrl,
331
+ downloadToken: extraParams?.previousWorkflowData?.downloadToken,
332
+ });
350
333
 
351
334
  await node.createAuditLog(
352
335
  {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.0",
6
+ "version": "1.8.3",
7
7
  "description": "Simple lib to manage auth in ABT Node",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -20,17 +20,17 @@
20
20
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@abtnode/constant": "1.8.0",
24
- "@abtnode/logger": "1.8.0",
25
- "@abtnode/util": "1.8.0",
26
- "@arcblock/did": "1.17.0",
27
- "@arcblock/jwt": "^1.17.0",
28
- "@arcblock/vc": "1.17.0",
29
- "@blocklet/meta": "1.8.0",
30
- "@ocap/client": "1.17.0",
31
- "@ocap/mcrypto": "1.17.0",
32
- "@ocap/util": "1.17.0",
33
- "@ocap/wallet": "1.17.0",
23
+ "@abtnode/constant": "1.8.3",
24
+ "@abtnode/logger": "1.8.3",
25
+ "@abtnode/util": "1.8.3",
26
+ "@arcblock/did": "1.17.5",
27
+ "@arcblock/jwt": "^1.17.5",
28
+ "@arcblock/vc": "1.17.5",
29
+ "@blocklet/meta": "1.8.3",
30
+ "@ocap/client": "1.17.5",
31
+ "@ocap/mcrypto": "1.17.5",
32
+ "@ocap/util": "1.17.5",
33
+ "@ocap/wallet": "1.17.5",
34
34
  "axios": "^0.27.2",
35
35
  "joi": "^17.6.0",
36
36
  "jsonwebtoken": "^8.5.1",
@@ -41,5 +41,5 @@
41
41
  "devDependencies": {
42
42
  "jest": "^27.4.5"
43
43
  },
44
- "gitHead": "6446a85fb33721abc24bb1045d59158e6b96c241"
44
+ "gitHead": "c734aca7bf1fc03378c3b082d0622b6a540a8bd3"
45
45
  }