@abtnode/auth 1.16.28-next-5a717317 → 1.16.28
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 +6 -3
- 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 +11 -12
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, withQuery } = require('ufo');
|
|
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,7 +198,10 @@ const getPassportStatusEndpoint = ({ baseUrl, userDid, teamDid }) => {
|
|
|
198
198
|
return null;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
return
|
|
201
|
+
return withQuery(joinURL(baseUrl, '/api/passport/status'), {
|
|
202
|
+
userDid,
|
|
203
|
+
teamDid,
|
|
204
|
+
});
|
|
202
205
|
};
|
|
203
206
|
|
|
204
207
|
const getRandomMessage = (len = 16) => {
|
|
@@ -956,7 +959,7 @@ const getPassportStatus = async ({ node, teamDid, userDid, vcId, locale = 'en' }
|
|
|
956
959
|
const { name } = passport;
|
|
957
960
|
if ([ROLES.OWNER, ROLES.ADMIN].includes(name) && issuerType === TEAM_TYPE.BLOCKLET) {
|
|
958
961
|
claims.push({
|
|
959
|
-
id:
|
|
962
|
+
id: joinURL(passport.endpoint, WELLKNOWN_BLOCKLET_ADMIN_PATH),
|
|
960
963
|
type: 'navigate',
|
|
961
964
|
name: 'open-blocklet-admin',
|
|
962
965
|
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('ufo');
|
|
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('ufo');
|
|
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('ufo');
|
|
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('ufo');
|
|
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",
|
|
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",
|
|
24
|
+
"@abtnode/logger": "1.16.28",
|
|
25
|
+
"@abtnode/util": "1.16.28",
|
|
26
26
|
"@arcblock/did": "1.18.123",
|
|
27
27
|
"@arcblock/jwt": "^1.18.123",
|
|
28
|
-
"@arcblock/nft-display": "^2.
|
|
28
|
+
"@arcblock/nft-display": "^2.10.0",
|
|
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",
|
|
32
|
+
"@blocklet/meta": "1.16.28",
|
|
33
|
+
"@blocklet/sdk": "1.16.28",
|
|
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": "^1.7.2",
|
|
39
39
|
"flat": "^5.0.2",
|
|
40
40
|
"fs-extra": "^11.2.0",
|
|
41
41
|
"is-url": "^1.2.4",
|
|
@@ -45,11 +45,10 @@
|
|
|
45
45
|
"p-retry": "4.6.1",
|
|
46
46
|
"semver": "^7.3.8",
|
|
47
47
|
"transliteration": "^2.3.5",
|
|
48
|
-
"ufo": "^1.3
|
|
49
|
-
"url-join": "^4.0.1"
|
|
48
|
+
"ufo": "^1.5.3"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
52
51
|
"jest": "^29.7.0"
|
|
53
52
|
},
|
|
54
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "54db076a7e520bbc260f8cbf0af31dd50b86aef1"
|
|
55
54
|
}
|