@abtnode/core 1.16.47-beta-20250725-140845-15481a97 → 1.16.47-beta-20250729-133234-77359596
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.
|
@@ -38918,7 +38918,7 @@ module.exports = require("zlib");
|
|
|
38918
38918
|
/***/ ((module) => {
|
|
38919
38919
|
|
|
38920
38920
|
"use strict";
|
|
38921
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.16.46","description":"","main":"lib/index.js","files":["lib"],"scripts":{"lint":"eslint tests lib --ignore-pattern \'tests/assets/*\'","lint:fix":"eslint --fix tests lib","test":"node tools/jest.js","coverage":"npm run test -- --coverage"},"keywords":[],"author":"wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)","license":"Apache-2.0","dependencies":{"@abtnode/analytics":"1.16.46","@abtnode/auth":"1.16.46","@abtnode/certificate-manager":"1.16.46","@abtnode/client":"1.16.46","@abtnode/constant":"1.16.46","@abtnode/cron":"1.16.46","@abtnode/db-cache":"1.16.46","@abtnode/docker-utils":"1.16.46","@abtnode/logger":"1.16.46","@abtnode/models":"1.16.46","@abtnode/queue":"1.16.46","@abtnode/rbac":"1.16.46","@abtnode/router-provider":"1.16.46","@abtnode/static-server":"1.16.46","@abtnode/timemachine":"1.16.46","@abtnode/util":"1.16.46","@aigne/aigne-hub":"^0.2.
|
|
38921
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.16.46","description":"","main":"lib/index.js","files":["lib"],"scripts":{"lint":"eslint tests lib --ignore-pattern \'tests/assets/*\'","lint:fix":"eslint --fix tests lib","test":"node tools/jest.js","coverage":"npm run test -- --coverage"},"keywords":[],"author":"wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)","license":"Apache-2.0","dependencies":{"@abtnode/analytics":"1.16.46","@abtnode/auth":"1.16.46","@abtnode/certificate-manager":"1.16.46","@abtnode/client":"1.16.46","@abtnode/constant":"1.16.46","@abtnode/cron":"1.16.46","@abtnode/db-cache":"1.16.46","@abtnode/docker-utils":"1.16.46","@abtnode/logger":"1.16.46","@abtnode/models":"1.16.46","@abtnode/queue":"1.16.46","@abtnode/rbac":"1.16.46","@abtnode/router-provider":"1.16.46","@abtnode/static-server":"1.16.46","@abtnode/timemachine":"1.16.46","@abtnode/util":"1.16.46","@aigne/aigne-hub":"^0.2.2","@arcblock/did":"1.21.0","@arcblock/did-auth":"1.21.0","@arcblock/did-ext":"1.21.0","@arcblock/did-motif":"^1.1.14","@arcblock/did-util":"1.21.0","@arcblock/event-hub":"1.21.0","@arcblock/jwt":"1.21.0","@arcblock/pm2-events":"^0.0.5","@arcblock/validator":"1.21.0","@arcblock/vc":"1.21.0","@blocklet/constant":"1.16.46","@blocklet/did-space-js":"^1.1.10","@blocklet/env":"1.16.46","@blocklet/error":"^0.2.5","@blocklet/meta":"1.16.46","@blocklet/resolver":"1.16.46","@blocklet/sdk":"1.16.46","@blocklet/store":"1.16.46","@blocklet/theme":"^3.0.35","@fidm/x509":"^1.2.1","@ocap/mcrypto":"1.21.0","@ocap/util":"1.21.0","@ocap/wallet":"1.21.0","@slack/webhook":"^5.0.4","archiver":"^7.0.1","axios":"^1.7.9","axon":"^2.0.3","chalk":"^4.1.2","cross-spawn":"^7.0.3","dayjs":"^1.11.13","deep-diff":"^1.0.2","detect-port":"^1.5.1","envfile":"^7.1.0","escape-string-regexp":"^4.0.0","fast-glob":"^3.3.2","filesize":"^10.1.1","flat":"^5.0.2","fs-extra":"^11.2.0","get-port":"^5.1.1","hasha":"^5.2.2","is-base64":"^1.1.0","is-cidr":"4","is-ip":"3","is-url":"^1.2.4","joi":"17.12.2","joi-extension-semver":"^5.0.0","js-yaml":"^4.1.0","kill-port":"^2.0.1","lodash":"^4.17.21","node-stream-zip":"^1.15.0","p-all":"^3.0.0","p-limit":"^3.1.0","p-map":"^4.0.0","p-retry":"^4.6.2","p-wait-for":"^3.2.0","rate-limiter-flexible":"^5.0.5","read-last-lines":"^1.8.0","semver":"^7.6.3","sequelize":"^6.35.0","shelljs":"^0.8.5","slugify":"^1.6.6","ssri":"^8.0.1","stream-throttle":"^0.1.3","stream-to-promise":"^3.0.0","systeminformation":"^5.23.3","tail":"^2.2.4","tar":"^6.1.11","transliteration":"^2.3.5","ua-parser-js":"^1.0.2","ufo":"^1.5.3","uuid":"^11.1.0","valid-url":"^1.0.9","which":"^2.0.2","xbytes":"^1.8.0"},"devDependencies":{"expand-tilde":"^2.0.2","express":"^4.18.2","jest":"^29.7.0","unzipper":"^0.10.11"},"gitHead":"e5764f753181ed6a7c615cd4fc6682aacf0cb7cd"}');
|
|
38922
38922
|
|
|
38923
38923
|
/***/ }),
|
|
38924
38924
|
|
package/lib/states/access-key.js
CHANGED
|
@@ -6,6 +6,7 @@ const { fromRandom, fromPublicKey } = require('@ocap/wallet');
|
|
|
6
6
|
const { toBase58, fromBase58 } = require('@ocap/util');
|
|
7
7
|
const { CustomError } = require('@blocklet/error');
|
|
8
8
|
const logger = require('@abtnode/logger')('@abtnode/core:states:access-key');
|
|
9
|
+
const { SERVER_ROLES } = require('@abtnode/constant');
|
|
9
10
|
const BaseState = require('./base');
|
|
10
11
|
const { accessKeySchema, REMARK_MAX_LENGTH } = require('../validators/access-key');
|
|
11
12
|
const { validateOperator, getEndpoint, isUserCenterPath } = require('../util/verify-access-key-user');
|
|
@@ -22,14 +23,25 @@ const validatePassport = (passport, context) => {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const { user } = context;
|
|
26
|
+
logger.info('validate passport user', { userRole: user.role, passport });
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
const role = (user?.role || '').replace('blocklet-', '');
|
|
29
|
+
if (
|
|
30
|
+
[SERVER_ROLES.OWNER, SERVER_ROLES.ADMIN, SERVER_ROLES.BLOCKLET_OWNER, SERVER_ROLES.BLOCKLET_ADMIN].includes(role)
|
|
31
|
+
) {
|
|
27
32
|
return;
|
|
28
33
|
}
|
|
29
34
|
|
|
30
|
-
const roles = uniq([
|
|
35
|
+
const roles = uniq([
|
|
36
|
+
...(user?.passports || []).filter((p) => p.status === 'valid').map((p) => p.role),
|
|
37
|
+
role,
|
|
38
|
+
'guest',
|
|
39
|
+
]);
|
|
31
40
|
if (!roles.includes(passport)) {
|
|
32
|
-
throw new CustomError(
|
|
41
|
+
throw new CustomError(
|
|
42
|
+
400,
|
|
43
|
+
`You can not create access keys with passports you do not have access to: ${roles.join(',')}.`
|
|
44
|
+
);
|
|
33
45
|
}
|
|
34
46
|
};
|
|
35
47
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.47-beta-
|
|
6
|
+
"version": "1.16.47-beta-20250729-133234-77359596",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,23 +19,23 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@abtnode/analytics": "1.16.47-beta-
|
|
23
|
-
"@abtnode/auth": "1.16.47-beta-
|
|
24
|
-
"@abtnode/certificate-manager": "1.16.47-beta-
|
|
25
|
-
"@abtnode/client": "1.16.47-beta-
|
|
26
|
-
"@abtnode/constant": "1.16.47-beta-
|
|
27
|
-
"@abtnode/cron": "1.16.47-beta-
|
|
28
|
-
"@abtnode/db-cache": "1.16.47-beta-
|
|
29
|
-
"@abtnode/docker-utils": "1.16.47-beta-
|
|
30
|
-
"@abtnode/logger": "1.16.47-beta-
|
|
31
|
-
"@abtnode/models": "1.16.47-beta-
|
|
32
|
-
"@abtnode/queue": "1.16.47-beta-
|
|
33
|
-
"@abtnode/rbac": "1.16.47-beta-
|
|
34
|
-
"@abtnode/router-provider": "1.16.47-beta-
|
|
35
|
-
"@abtnode/static-server": "1.16.47-beta-
|
|
36
|
-
"@abtnode/timemachine": "1.16.47-beta-
|
|
37
|
-
"@abtnode/util": "1.16.47-beta-
|
|
38
|
-
"@aigne/aigne-hub": "^0.2.
|
|
22
|
+
"@abtnode/analytics": "1.16.47-beta-20250729-133234-77359596",
|
|
23
|
+
"@abtnode/auth": "1.16.47-beta-20250729-133234-77359596",
|
|
24
|
+
"@abtnode/certificate-manager": "1.16.47-beta-20250729-133234-77359596",
|
|
25
|
+
"@abtnode/client": "1.16.47-beta-20250729-133234-77359596",
|
|
26
|
+
"@abtnode/constant": "1.16.47-beta-20250729-133234-77359596",
|
|
27
|
+
"@abtnode/cron": "1.16.47-beta-20250729-133234-77359596",
|
|
28
|
+
"@abtnode/db-cache": "1.16.47-beta-20250729-133234-77359596",
|
|
29
|
+
"@abtnode/docker-utils": "1.16.47-beta-20250729-133234-77359596",
|
|
30
|
+
"@abtnode/logger": "1.16.47-beta-20250729-133234-77359596",
|
|
31
|
+
"@abtnode/models": "1.16.47-beta-20250729-133234-77359596",
|
|
32
|
+
"@abtnode/queue": "1.16.47-beta-20250729-133234-77359596",
|
|
33
|
+
"@abtnode/rbac": "1.16.47-beta-20250729-133234-77359596",
|
|
34
|
+
"@abtnode/router-provider": "1.16.47-beta-20250729-133234-77359596",
|
|
35
|
+
"@abtnode/static-server": "1.16.47-beta-20250729-133234-77359596",
|
|
36
|
+
"@abtnode/timemachine": "1.16.47-beta-20250729-133234-77359596",
|
|
37
|
+
"@abtnode/util": "1.16.47-beta-20250729-133234-77359596",
|
|
38
|
+
"@aigne/aigne-hub": "^0.2.2",
|
|
39
39
|
"@arcblock/did": "1.21.0",
|
|
40
40
|
"@arcblock/did-auth": "1.21.0",
|
|
41
41
|
"@arcblock/did-ext": "1.21.0",
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"@arcblock/pm2-events": "^0.0.5",
|
|
47
47
|
"@arcblock/validator": "1.21.0",
|
|
48
48
|
"@arcblock/vc": "1.21.0",
|
|
49
|
-
"@blocklet/constant": "1.16.47-beta-
|
|
50
|
-
"@blocklet/did-space-js": "^1.1.
|
|
51
|
-
"@blocklet/env": "1.16.47-beta-
|
|
49
|
+
"@blocklet/constant": "1.16.47-beta-20250729-133234-77359596",
|
|
50
|
+
"@blocklet/did-space-js": "^1.1.10",
|
|
51
|
+
"@blocklet/env": "1.16.47-beta-20250729-133234-77359596",
|
|
52
52
|
"@blocklet/error": "^0.2.5",
|
|
53
|
-
"@blocklet/meta": "1.16.47-beta-
|
|
54
|
-
"@blocklet/resolver": "1.16.47-beta-
|
|
55
|
-
"@blocklet/sdk": "1.16.47-beta-
|
|
56
|
-
"@blocklet/store": "1.16.47-beta-
|
|
57
|
-
"@blocklet/theme": "^3.0.
|
|
53
|
+
"@blocklet/meta": "1.16.47-beta-20250729-133234-77359596",
|
|
54
|
+
"@blocklet/resolver": "1.16.47-beta-20250729-133234-77359596",
|
|
55
|
+
"@blocklet/sdk": "1.16.47-beta-20250729-133234-77359596",
|
|
56
|
+
"@blocklet/store": "1.16.47-beta-20250729-133234-77359596",
|
|
57
|
+
"@blocklet/theme": "^3.0.35",
|
|
58
58
|
"@fidm/x509": "^1.2.1",
|
|
59
59
|
"@ocap/mcrypto": "1.21.0",
|
|
60
60
|
"@ocap/util": "1.21.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"jest": "^29.7.0",
|
|
118
118
|
"unzipper": "^0.10.11"
|
|
119
119
|
},
|
|
120
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "d5471eebcaa862d418d48b373ddd37b8150ba571"
|
|
121
121
|
}
|