@abtnode/auth 1.16.28-beta-8acda0e6 → 1.16.28-next-5a717317
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 +3 -6
- package/lib/invitation.js +2 -2
- package/lib/lost-passport.js +2 -2
- package/lib/passport.js +2 -2
- package/lib/util/federated.js +4 -4
- package/package.json +12 -11
package/lib/auth.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const jwt = require('jsonwebtoken');
|
|
3
3
|
const semver = require('semver');
|
|
4
|
-
const
|
|
4
|
+
const joinUrl = require('url-join');
|
|
5
5
|
const get = require('lodash/get');
|
|
6
6
|
const { verifyPresentation, createCredentialList } = require('@arcblock/vc');
|
|
7
7
|
const formatContext = require('@abtnode/util/lib/format-context');
|
|
@@ -198,10 +198,7 @@ const getPassportStatusEndpoint = ({ baseUrl, userDid, teamDid }) => {
|
|
|
198
198
|
return null;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
return
|
|
202
|
-
userDid,
|
|
203
|
-
teamDid,
|
|
204
|
-
});
|
|
201
|
+
return joinUrl(baseUrl, `/api/passport/status?userDid=${userDid}&teamDid=${teamDid}`);
|
|
205
202
|
};
|
|
206
203
|
|
|
207
204
|
const getRandomMessage = (len = 16) => {
|
|
@@ -959,7 +956,7 @@ const getPassportStatus = async ({ node, teamDid, userDid, vcId, locale = 'en' }
|
|
|
959
956
|
const { name } = passport;
|
|
960
957
|
if ([ROLES.OWNER, ROLES.ADMIN].includes(name) && issuerType === TEAM_TYPE.BLOCKLET) {
|
|
961
958
|
claims.push({
|
|
962
|
-
id:
|
|
959
|
+
id: joinUrl(passport.endpoint, WELLKNOWN_BLOCKLET_ADMIN_PATH),
|
|
963
960
|
type: 'navigate',
|
|
964
961
|
name: 'open-blocklet-admin',
|
|
965
962
|
scope: 'public',
|
package/lib/invitation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const omit = require('lodash/omit');
|
|
3
|
-
const
|
|
3
|
+
const joinUrl = require('url-join');
|
|
4
4
|
const { WELLKNOWN_SERVICE_PATH_PREFIX, NODE_DATA_DIR_NAME } = require('@abtnode/constant');
|
|
5
5
|
const { BLOCKLET_CONFIGURABLE_KEY } = require('@blocklet/constant');
|
|
6
6
|
const { getDisplayName } = require('@blocklet/meta/lib/util');
|
|
@@ -134,7 +134,7 @@ module.exports = {
|
|
|
134
134
|
url: blockletInfo.environmentObj[BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL],
|
|
135
135
|
name: getDisplayName(blockletInfo),
|
|
136
136
|
version: blockletInfo.meta.version,
|
|
137
|
-
logo:
|
|
137
|
+
logo: joinUrl(groupPathPrefix, WELLKNOWN_SERVICE_PATH_PREFIX, '/blocklet/logo'),
|
|
138
138
|
chainHost: blockletInfo.configObj.CHAIN_HOST,
|
|
139
139
|
passportColor: blockletInfo.configObj[BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR],
|
|
140
140
|
description: blockletInfo.meta.description,
|
package/lib/lost-passport.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
-
const
|
|
2
|
+
const joinUrl = require('url-join');
|
|
3
3
|
const uniqBy = require('lodash/uniqBy');
|
|
4
4
|
const uniq = require('lodash/uniq');
|
|
5
5
|
const getBlockletInfo = require('@blocklet/meta/lib/info');
|
|
@@ -88,7 +88,7 @@ const getApplicationInfo = async ({ type, node, req, baseUrl = '' }) => {
|
|
|
88
88
|
|
|
89
89
|
const getStatusEndpointBaseUrl = (type, baseUrl, authServicePrefix) => {
|
|
90
90
|
if (type === TEAM_TYPES.BLOCKLET) {
|
|
91
|
-
return
|
|
91
|
+
return joinUrl(baseUrl, authServicePrefix);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
return baseUrl;
|
package/lib/passport.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable max-len */
|
|
2
2
|
|
|
3
3
|
const Joi = require('joi');
|
|
4
|
-
const
|
|
4
|
+
const joinUrl = require('url-join');
|
|
5
5
|
const pick = require('lodash/pick');
|
|
6
6
|
const { create: createVC } = require('@arcblock/vc');
|
|
7
7
|
const {
|
|
@@ -181,7 +181,7 @@ const createUserPassport = (vc, { status = PASSPORT_STATUS.VALID, role = ROLES.G
|
|
|
181
181
|
};
|
|
182
182
|
|
|
183
183
|
const getPassportClaimUrl = (baseUrl, prefix = '') =>
|
|
184
|
-
baseUrl ?
|
|
184
|
+
baseUrl ? joinUrl(new URL(baseUrl).origin, prefix, WELLKNOWN_SERVICE_PATH_PREFIX, '/lost-passport') : '';
|
|
185
185
|
|
|
186
186
|
module.exports = {
|
|
187
187
|
validatePassport,
|
package/lib/util/federated.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { WELLKNOWN_SERVICE_PATH_PREFIX, USER_AVATAR_URL_PREFIX, USER_AVATAR_PATH_PREFIX } = require('@abtnode/constant');
|
|
2
2
|
const pRetry = require('p-retry');
|
|
3
3
|
const { signV2 } = require('@arcblock/jwt');
|
|
4
|
-
const
|
|
4
|
+
const joinUrl = require('url-join');
|
|
5
5
|
|
|
6
6
|
const request = require('./request');
|
|
7
7
|
|
|
@@ -12,10 +12,10 @@ function isMaster(site) {
|
|
|
12
12
|
function getUserAvatarUrl(avatar, blocklet) {
|
|
13
13
|
let avatarUrl = avatar;
|
|
14
14
|
if (avatar && avatar.startsWith(USER_AVATAR_URL_PREFIX)) {
|
|
15
|
-
avatarUrl =
|
|
15
|
+
avatarUrl = joinUrl(WELLKNOWN_SERVICE_PATH_PREFIX, USER_AVATAR_PATH_PREFIX, avatarUrl.split('/').slice(-1)[0]);
|
|
16
16
|
|
|
17
17
|
const appUrl = blocklet.environmentObj.BLOCKLET_APP_URL;
|
|
18
|
-
avatarUrl =
|
|
18
|
+
avatarUrl = joinUrl(appUrl, avatarUrl);
|
|
19
19
|
}
|
|
20
20
|
return avatarUrl;
|
|
21
21
|
}
|
|
@@ -43,7 +43,7 @@ function findFederatedSite(blocklet, targetAppPid) {
|
|
|
43
43
|
|
|
44
44
|
async function callFederated({ site, permanentWallet, data, action }) {
|
|
45
45
|
const url = new URL(site.appUrl);
|
|
46
|
-
url.pathname =
|
|
46
|
+
url.pathname = joinUrl(WELLKNOWN_SERVICE_PATH_PREFIX, `/api/federated/${action}`);
|
|
47
47
|
const result = await pRetry(
|
|
48
48
|
() =>
|
|
49
49
|
request.post(url.href, {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.28-
|
|
6
|
+
"version": "1.16.28-next-5a717317",
|
|
7
7
|
"description": "Simple lib to manage auth in ABT Node",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -20,22 +20,22 @@
|
|
|
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.28-
|
|
24
|
-
"@abtnode/logger": "1.16.28-
|
|
25
|
-
"@abtnode/util": "1.16.28-
|
|
23
|
+
"@abtnode/constant": "1.16.28-next-5a717317",
|
|
24
|
+
"@abtnode/logger": "1.16.28-next-5a717317",
|
|
25
|
+
"@abtnode/util": "1.16.28-next-5a717317",
|
|
26
26
|
"@arcblock/did": "1.18.123",
|
|
27
27
|
"@arcblock/jwt": "^1.18.123",
|
|
28
|
-
"@arcblock/nft-display": "^2.
|
|
28
|
+
"@arcblock/nft-display": "^2.9.90",
|
|
29
29
|
"@arcblock/validator": "^1.18.123",
|
|
30
30
|
"@arcblock/vc": "1.18.123",
|
|
31
|
-
"@blocklet/constant": "1.16.28-
|
|
32
|
-
"@blocklet/meta": "1.16.28-
|
|
33
|
-
"@blocklet/sdk": "1.16.28-
|
|
31
|
+
"@blocklet/constant": "1.16.28-next-5a717317",
|
|
32
|
+
"@blocklet/meta": "1.16.28-next-5a717317",
|
|
33
|
+
"@blocklet/sdk": "1.16.28-next-5a717317",
|
|
34
34
|
"@ocap/client": "^1.18.123",
|
|
35
35
|
"@ocap/mcrypto": "1.18.123",
|
|
36
36
|
"@ocap/util": "1.18.123",
|
|
37
37
|
"@ocap/wallet": "1.18.123",
|
|
38
|
-
"axios": "^
|
|
38
|
+
"axios": "^0.27.2",
|
|
39
39
|
"flat": "^5.0.2",
|
|
40
40
|
"fs-extra": "^11.2.0",
|
|
41
41
|
"is-url": "^1.2.4",
|
|
@@ -45,10 +45,11 @@
|
|
|
45
45
|
"p-retry": "4.6.1",
|
|
46
46
|
"semver": "^7.3.8",
|
|
47
47
|
"transliteration": "^2.3.5",
|
|
48
|
-
"ufo": "^1.
|
|
48
|
+
"ufo": "^1.3.2",
|
|
49
|
+
"url-join": "^4.0.1"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"jest": "^29.7.0"
|
|
52
53
|
},
|
|
53
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "3624967f9549de3a25a87ed6b20f82519ddb4757"
|
|
54
55
|
}
|