@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 +4 -0
- package/lib/server.js +4 -21
- package/package.json +13 -13
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
|
-
|
|
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.
|
|
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.
|
|
24
|
-
"@abtnode/logger": "1.8.
|
|
25
|
-
"@abtnode/util": "1.8.
|
|
26
|
-
"@arcblock/did": "1.17.
|
|
27
|
-
"@arcblock/jwt": "^1.17.
|
|
28
|
-
"@arcblock/vc": "1.17.
|
|
29
|
-
"@blocklet/meta": "1.8.
|
|
30
|
-
"@ocap/client": "1.17.
|
|
31
|
-
"@ocap/mcrypto": "1.17.
|
|
32
|
-
"@ocap/util": "1.17.
|
|
33
|
-
"@ocap/wallet": "1.17.
|
|
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": "
|
|
44
|
+
"gitHead": "c734aca7bf1fc03378c3b082d0622b6a540a8bd3"
|
|
45
45
|
}
|