@blocklet/sdk 1.16.47-beta-20250712-123458-4d4b61e5 → 1.16.47-beta-20250715-030340-f15b794e
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/middlewares/session.js +15 -1
- package/package.json +16 -16
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
const get_token_from_req_1 = require("@abtnode/util/lib/get-token-from-req");
|
|
6
|
+
const service_api_1 = __importDefault(require("../util/service-api"));
|
|
3
7
|
const login_1 = require("../util/login");
|
|
4
8
|
const verify_session_1 = require("../util/verify-session");
|
|
5
9
|
const sessionMiddleware = (options = {}) => {
|
|
@@ -18,10 +22,20 @@ const sessionMiddleware = (options = {}) => {
|
|
|
18
22
|
res.status(400).send('Access token found in multiple locations');
|
|
19
23
|
return;
|
|
20
24
|
}
|
|
25
|
+
if (process.env.NODE_ENV !== 'test') {
|
|
26
|
+
const { data: checkResult } = await service_api_1.default.post('/api/user/checkToken', {
|
|
27
|
+
token: loginTokenValue,
|
|
28
|
+
});
|
|
29
|
+
if (!checkResult.valid) {
|
|
30
|
+
res.status(401).send('Access token is blocked');
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// TODO: 检查 login_token 是否在黑名单中
|
|
21
35
|
if ((0, login_1.isLoginToken)(loginTokenValue)) {
|
|
22
36
|
result = await (0, verify_session_1.verifyLoginToken)({ token: loginTokenValue, strictMode });
|
|
23
37
|
}
|
|
24
|
-
if ((0, login_1.isAccessKey)(loginTokenValue) && accessKey) {
|
|
38
|
+
else if ((0, login_1.isAccessKey)(loginTokenValue) && accessKey) {
|
|
25
39
|
result = await (0, verify_session_1.verifyAccessKey)({ token: loginTokenValue, strictMode });
|
|
26
40
|
}
|
|
27
41
|
}
|
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-20250715-030340-f15b794e",
|
|
7
7
|
"description": "graphql client to read/write data on abt node",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"typings": "lib/index.d.ts",
|
|
@@ -27,25 +27,25 @@
|
|
|
27
27
|
"author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@abtnode/client": "1.16.47-beta-
|
|
31
|
-
"@abtnode/constant": "1.16.47-beta-
|
|
32
|
-
"@abtnode/db-cache": "1.16.47-beta-
|
|
33
|
-
"@abtnode/util": "1.16.47-beta-
|
|
34
|
-
"@arcblock/did": "1.20.
|
|
35
|
-
"@arcblock/did-auth": "1.20.
|
|
36
|
-
"@arcblock/jwt": "1.20.
|
|
37
|
-
"@arcblock/ws": "1.20.
|
|
38
|
-
"@blocklet/constant": "1.16.47-beta-
|
|
39
|
-
"@blocklet/env": "1.16.47-beta-
|
|
30
|
+
"@abtnode/client": "1.16.47-beta-20250715-030340-f15b794e",
|
|
31
|
+
"@abtnode/constant": "1.16.47-beta-20250715-030340-f15b794e",
|
|
32
|
+
"@abtnode/db-cache": "1.16.47-beta-20250715-030340-f15b794e",
|
|
33
|
+
"@abtnode/util": "1.16.47-beta-20250715-030340-f15b794e",
|
|
34
|
+
"@arcblock/did": "1.20.16",
|
|
35
|
+
"@arcblock/did-auth": "1.20.16",
|
|
36
|
+
"@arcblock/jwt": "1.20.16",
|
|
37
|
+
"@arcblock/ws": "1.20.16",
|
|
38
|
+
"@blocklet/constant": "1.16.47-beta-20250715-030340-f15b794e",
|
|
39
|
+
"@blocklet/env": "1.16.47-beta-20250715-030340-f15b794e",
|
|
40
40
|
"@blocklet/error": "^0.2.5",
|
|
41
|
-
"@blocklet/meta": "1.16.47-beta-
|
|
41
|
+
"@blocklet/meta": "1.16.47-beta-20250715-030340-f15b794e",
|
|
42
42
|
"@blocklet/theme": "^3.0.26",
|
|
43
43
|
"@did-connect/authenticator": "^2.2.8",
|
|
44
44
|
"@did-connect/handler": "^2.2.8",
|
|
45
45
|
"@nedb/core": "^2.1.5",
|
|
46
|
-
"@ocap/mcrypto": "1.20.
|
|
47
|
-
"@ocap/util": "1.20.
|
|
48
|
-
"@ocap/wallet": "1.20.
|
|
46
|
+
"@ocap/mcrypto": "1.20.16",
|
|
47
|
+
"@ocap/util": "1.20.16",
|
|
48
|
+
"@ocap/wallet": "1.20.16",
|
|
49
49
|
"axios": "^1.7.9",
|
|
50
50
|
"cheerio": "1.0.0-rc.12",
|
|
51
51
|
"debug": "^4.4.1",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"ts-node": "^10.9.1",
|
|
86
86
|
"typescript": "^5.6.3"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "615430ebd6f20c09fa7982fc47a18f77c3f17f6d"
|
|
89
89
|
}
|