@abtnode/auth 1.16.6-beta-56be9f01 → 1.16.6-beta-593a7a98
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 +8 -2
- package/lib/server.js +20 -0
- package/package.json +12 -12
package/lib/auth.js
CHANGED
|
@@ -95,6 +95,10 @@ const messages = {
|
|
|
95
95
|
en: 'You are not the owner of this application',
|
|
96
96
|
zh: '你不是该应用的所有者',
|
|
97
97
|
},
|
|
98
|
+
notSupported: {
|
|
99
|
+
en: 'This application is not supported on this server',
|
|
100
|
+
zh: '此应用不支持在当前节点安装',
|
|
101
|
+
},
|
|
98
102
|
missingCredentialClaim: {
|
|
99
103
|
en: 'Credential is not provided',
|
|
100
104
|
zh: '请提供凭证',
|
|
@@ -577,8 +581,10 @@ const handleInvitationReceive = async ({
|
|
|
577
581
|
dataDir,
|
|
578
582
|
});
|
|
579
583
|
|
|
584
|
+
let doc;
|
|
585
|
+
|
|
580
586
|
if (user) {
|
|
581
|
-
|
|
587
|
+
doc = await node.loginUser({
|
|
582
588
|
teamDid,
|
|
583
589
|
user: {
|
|
584
590
|
...profile,
|
|
@@ -606,7 +612,7 @@ const handleInvitationReceive = async ({
|
|
|
606
612
|
node
|
|
607
613
|
);
|
|
608
614
|
} else {
|
|
609
|
-
|
|
615
|
+
doc = await node.loginUser({
|
|
610
616
|
teamDid,
|
|
611
617
|
user: {
|
|
612
618
|
...profile,
|
package/lib/server.js
CHANGED
|
@@ -25,6 +25,7 @@ const {
|
|
|
25
25
|
NFT_TYPE_SERVERLESS,
|
|
26
26
|
MAIN_CHAIN_ENDPOINT,
|
|
27
27
|
APP_STRUCT_VERSION,
|
|
28
|
+
NODE_MODES,
|
|
28
29
|
} = require('@abtnode/constant');
|
|
29
30
|
const {
|
|
30
31
|
messages,
|
|
@@ -818,6 +819,24 @@ const createRestoreOnServerlessHandler =
|
|
|
818
819
|
};
|
|
819
820
|
};
|
|
820
821
|
|
|
822
|
+
const createServerlessInstallGuard = (node) => {
|
|
823
|
+
return async ({ extraParams }) => {
|
|
824
|
+
const { locale, blockletMetaUrl } = extraParams;
|
|
825
|
+
const [info, blocklet] = await Promise.all([
|
|
826
|
+
node.getNodeInfo(),
|
|
827
|
+
blockletMetaUrl ? node.getBlockletMetaFromUrl({ url: blockletMetaUrl, checkPrice: true }) : null,
|
|
828
|
+
]);
|
|
829
|
+
|
|
830
|
+
// check if serverless is supported
|
|
831
|
+
if (blocklet && info.mode === NODE_MODES.SERVERLESS) {
|
|
832
|
+
const isServerlessSupported = get(blocklet.meta, 'capabilities.serverless', true);
|
|
833
|
+
if (!isServerlessSupported) {
|
|
834
|
+
throw new Error(messages.notSupported[locale]);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
};
|
|
839
|
+
|
|
821
840
|
module.exports = {
|
|
822
841
|
getAuthVcClaim,
|
|
823
842
|
getKeyPairClaim,
|
|
@@ -839,4 +858,5 @@ module.exports = {
|
|
|
839
858
|
getLauncherAppIdList,
|
|
840
859
|
getAuthPrincipalForMigrateAppToV2,
|
|
841
860
|
getAuthPrincipalForTransferAppOwnerShip,
|
|
861
|
+
createServerlessInstallGuard,
|
|
842
862
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.6-beta-
|
|
6
|
+
"version": "1.16.6-beta-593a7a98",
|
|
7
7
|
"description": "Simple lib to manage auth in ABT Node",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@abtnode/constant": "1.16.6-beta-
|
|
24
|
-
"@abtnode/logger": "1.16.6-beta-
|
|
25
|
-
"@abtnode/util": "1.16.6-beta-
|
|
26
|
-
"@arcblock/did": "1.18.
|
|
27
|
-
"@arcblock/vc": "1.18.
|
|
28
|
-
"@blocklet/constant": "1.16.6-beta-
|
|
29
|
-
"@blocklet/meta": "1.16.6-beta-
|
|
30
|
-
"@ocap/mcrypto": "1.18.
|
|
31
|
-
"@ocap/util": "1.18.
|
|
32
|
-
"@ocap/wallet": "1.18.
|
|
23
|
+
"@abtnode/constant": "1.16.6-beta-593a7a98",
|
|
24
|
+
"@abtnode/logger": "1.16.6-beta-593a7a98",
|
|
25
|
+
"@abtnode/util": "1.16.6-beta-593a7a98",
|
|
26
|
+
"@arcblock/did": "1.18.77",
|
|
27
|
+
"@arcblock/vc": "1.18.77",
|
|
28
|
+
"@blocklet/constant": "1.16.6-beta-593a7a98",
|
|
29
|
+
"@blocklet/meta": "1.16.6-beta-593a7a98",
|
|
30
|
+
"@ocap/mcrypto": "1.18.77",
|
|
31
|
+
"@ocap/util": "1.18.77",
|
|
32
|
+
"@ocap/wallet": "1.18.77",
|
|
33
33
|
"joi": "17.7.0",
|
|
34
34
|
"jsonwebtoken": "^9.0.0",
|
|
35
35
|
"lodash": "^4.17.21",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"jest": "^27.5.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "5ea65d1ddc91e997f029741f01ce453464d86666"
|
|
45
45
|
}
|