@abtnode/auth 1.16.19-beta-e6aac665 → 1.16.19-beta-710018ca
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/server.js +31 -31
- package/package.json +8 -8
package/lib/server.js
CHANGED
|
@@ -325,21 +325,6 @@ const getAuthVcClaim =
|
|
|
325
325
|
};
|
|
326
326
|
};
|
|
327
327
|
|
|
328
|
-
const getAuthNFTClaim =
|
|
329
|
-
({ node }) =>
|
|
330
|
-
({ extraParams: { locale, launchType, nftId }, context: { didwallet } }) => {
|
|
331
|
-
checkWalletVersion({ didwallet, locale });
|
|
332
|
-
if (launchType === 'serverless') {
|
|
333
|
-
if (!nftId) {
|
|
334
|
-
throw new Error(messages.blockletSpaceNftIdRequired[locale]);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
return getServerlessNFTClaim(nftId, locale);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
return getOwnershipNFTClaim(node, locale);
|
|
341
|
-
};
|
|
342
|
-
|
|
343
328
|
const getAuthPrincipalForMigrateAppToV2 = (node) => async (param) => {
|
|
344
329
|
const {
|
|
345
330
|
extraParams: { locale, appDid },
|
|
@@ -498,22 +483,6 @@ const getRotateKeyPairClaims = (node) => {
|
|
|
498
483
|
];
|
|
499
484
|
};
|
|
500
485
|
|
|
501
|
-
const getLaunchBlockletClaims = (node, authMethod) => {
|
|
502
|
-
const claims = {
|
|
503
|
-
blockletAppKeypair: ['keyPair', getKeyPairClaim(node)],
|
|
504
|
-
};
|
|
505
|
-
|
|
506
|
-
if (authMethod === 'vc') {
|
|
507
|
-
claims.serverPassport = ['verifiableCredential', getAuthVcClaim({ node, launchBlocklet: true })];
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
if (authMethod === 'nft') {
|
|
511
|
-
claims.serverNFT = ['asset', getAuthNFTClaim({ node })];
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
return claims;
|
|
515
|
-
};
|
|
516
|
-
|
|
517
486
|
const getAppDidOwnerClaims = () => {
|
|
518
487
|
const description = {
|
|
519
488
|
en: 'Sign following message to prove that you are the owner of the app',
|
|
@@ -572,6 +541,37 @@ const getServerlessNFTClaim = (nftId, locale) => {
|
|
|
572
541
|
};
|
|
573
542
|
};
|
|
574
543
|
|
|
544
|
+
const getAuthNFTClaim =
|
|
545
|
+
({ node }) =>
|
|
546
|
+
({ extraParams: { locale, launchType, nftId }, context: { didwallet } }) => {
|
|
547
|
+
checkWalletVersion({ didwallet, locale });
|
|
548
|
+
if (launchType === 'serverless') {
|
|
549
|
+
if (!nftId) {
|
|
550
|
+
throw new Error(messages.blockletSpaceNftIdRequired[locale]);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
return getServerlessNFTClaim(nftId, locale);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
return getOwnershipNFTClaim(node, locale);
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
const getLaunchBlockletClaims = (node, authMethod) => {
|
|
560
|
+
const claims = {
|
|
561
|
+
blockletAppKeypair: ['keyPair', getKeyPairClaim(node)],
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
if (authMethod === 'vc') {
|
|
565
|
+
claims.serverPassport = ['verifiableCredential', getAuthVcClaim({ node, launchBlocklet: true })];
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
if (authMethod === 'nft') {
|
|
569
|
+
claims.serverNFT = ['asset', getAuthNFTClaim({ node })];
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
return claims;
|
|
573
|
+
};
|
|
574
|
+
|
|
575
575
|
const ensureBlockletPermission = async ({
|
|
576
576
|
authMethod,
|
|
577
577
|
node,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.19-beta-
|
|
6
|
+
"version": "1.16.19-beta-710018ca",
|
|
7
7
|
"description": "Simple lib to manage auth in ABT Node",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@abtnode/constant": "1.16.19-beta-
|
|
24
|
-
"@abtnode/logger": "1.16.19-beta-
|
|
25
|
-
"@abtnode/util": "1.16.19-beta-
|
|
23
|
+
"@abtnode/constant": "1.16.19-beta-710018ca",
|
|
24
|
+
"@abtnode/logger": "1.16.19-beta-710018ca",
|
|
25
|
+
"@abtnode/util": "1.16.19-beta-710018ca",
|
|
26
26
|
"@arcblock/did": "1.18.95",
|
|
27
|
-
"@arcblock/nft-display": "2.8.
|
|
27
|
+
"@arcblock/nft-display": "2.8.16",
|
|
28
28
|
"@arcblock/vc": "1.18.95",
|
|
29
|
-
"@blocklet/constant": "1.16.19-beta-
|
|
30
|
-
"@blocklet/meta": "1.16.19-beta-
|
|
29
|
+
"@blocklet/constant": "1.16.19-beta-710018ca",
|
|
30
|
+
"@blocklet/meta": "1.16.19-beta-710018ca",
|
|
31
31
|
"@ocap/mcrypto": "1.18.95",
|
|
32
32
|
"@ocap/util": "1.18.95",
|
|
33
33
|
"@ocap/wallet": "1.18.95",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"jest": "^27.5.1"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "23518dd7a84664e2a015284d5867cc31540fbdb0"
|
|
47
47
|
}
|