@abtnode/auth 1.7.21 → 1.7.22
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 +9 -9
- package/package.json +6 -6
package/lib/auth.js
CHANGED
|
@@ -392,35 +392,35 @@ const handleInvitationResponse = async ({
|
|
|
392
392
|
throw new Error(messages.notInitialized[locale]);
|
|
393
393
|
}
|
|
394
394
|
|
|
395
|
+
const claim = claims.find((x) => x.type === 'signature');
|
|
396
|
+
verifySignature(claim, userDid, userPk, locale);
|
|
397
|
+
|
|
395
398
|
const tmpInvitation = await node.getInvitation({ teamDid, inviteId });
|
|
396
399
|
|
|
397
400
|
if (tmpInvitation.role === 'owner' && userDid === nodeInfo.nodeOwner.did) {
|
|
398
401
|
throw new Error(messages.notAllowedTransferToSelf[locale]);
|
|
399
402
|
}
|
|
400
|
-
|
|
401
403
|
const inviteInfo = await node.processInvitation({ teamDid, inviteId });
|
|
402
404
|
if (inviteInfo.role === 'owner' && get(nodeInfo, 'ownerNft.holder')) {
|
|
403
405
|
// 这种情况下是 Transfer 有 Owner NFT 的 Blocklet Server
|
|
404
406
|
const client = new Client(nodeInfo.launcher.chainHost);
|
|
407
|
+
const ownerNftDid = get(nodeInfo, 'ownerNft.did');
|
|
405
408
|
|
|
406
|
-
const { state: assetState } = await client.getAssetState({ address:
|
|
409
|
+
const { state: assetState } = await client.getAssetState({ address: ownerNftDid });
|
|
407
410
|
if (assetState.owner !== newNftOwner) {
|
|
408
411
|
const hash = await client.transfer({
|
|
409
|
-
delegator: nodeInfo
|
|
412
|
+
delegator: get(nodeInfo, 'ownerNft.holder'),
|
|
410
413
|
to: newNftOwner,
|
|
411
|
-
assets: [
|
|
414
|
+
assets: [ownerNftDid],
|
|
412
415
|
wallet: getNodeWallet(nodeInfo.sk),
|
|
413
416
|
});
|
|
414
417
|
|
|
415
|
-
logger.info('transferred nft', { hash, nft:
|
|
418
|
+
logger.info('transferred nft', { hash, nft: ownerNftDid });
|
|
416
419
|
await node.updateNftHolder(newNftOwner);
|
|
417
|
-
logger.info('updated owner nft holder', { holder: newNftOwner, nft:
|
|
420
|
+
logger.info('updated owner nft holder', { holder: newNftOwner, nft: ownerNftDid });
|
|
418
421
|
}
|
|
419
422
|
}
|
|
420
423
|
|
|
421
|
-
const claim = claims.find((x) => x.type === 'signature');
|
|
422
|
-
verifySignature(claim, userDid, userPk, locale);
|
|
423
|
-
|
|
424
424
|
const {
|
|
425
425
|
name: issuerName,
|
|
426
426
|
wallet: issuerWallet,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.7.
|
|
6
|
+
"version": "1.7.22",
|
|
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.7.
|
|
24
|
-
"@abtnode/logger": "1.7.
|
|
25
|
-
"@abtnode/util": "1.7.
|
|
23
|
+
"@abtnode/constant": "1.7.22",
|
|
24
|
+
"@abtnode/logger": "1.7.22",
|
|
25
|
+
"@abtnode/util": "1.7.22",
|
|
26
26
|
"@arcblock/did": "^1.16.15",
|
|
27
27
|
"@arcblock/vc": "^1.16.15",
|
|
28
|
-
"@blocklet/meta": "1.7.
|
|
28
|
+
"@blocklet/meta": "1.7.22",
|
|
29
29
|
"@ocap/client": "1.16.15",
|
|
30
30
|
"@ocap/mcrypto": "^1.16.15",
|
|
31
31
|
"@ocap/util": "^1.16.15",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"jest": "^27.4.5"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "6190972e62b5e6b1039aa71a291b3e2c521df367"
|
|
44
44
|
}
|