@abtnode/auth 1.16.39 → 1.16.40-beta-20250227-092112-1815be0a

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.
@@ -11,12 +11,13 @@ const getNodeWallet = require('@abtnode/util/lib/get-app-wallet');
11
11
  const CustomError = require('@abtnode/util/lib/custom-error');
12
12
  const { getActivePassports } = require('@abtnode/util/lib/passport');
13
13
  const { getDisplayName, getBlockletAppIdList } = require('@blocklet/meta/lib/util');
14
- const { VC_TYPE_NODE_PASSPORT, NODE_DATA_DIR_NAME } = require('@abtnode/constant');
14
+ const { NODE_DATA_DIR_NAME, VC_TYPE_GENERAL_PASSPORT, VC_TYPE_NODE_PASSPORT } = require('@abtnode/constant');
15
15
  const { getUserAvatarUrl, getAppAvatarUrl, getServerAvatarUrl, extractUserAvatar } = require('@abtnode/util/lib/user');
16
16
  const getRequestIP = require('@abtnode/util/lib/get-request-ip');
17
17
  const { getWalletDid } = require('@blocklet/meta/lib/did-utils');
18
18
  const { Hasher } = require('@ocap/mcrypto');
19
19
  const { getSourceAppPid, getLoginProvider } = require('@blocklet/sdk/lib/util/login');
20
+ const isArray = require('lodash/isArray');
20
21
  const {
21
22
  getFederatedMaster,
22
23
  shouldSyncFederated,
@@ -278,7 +279,11 @@ const createLostPassportIssueRoute = ({ node, type, authServicePrefix, createTok
278
279
  let role;
279
280
  let passport;
280
281
 
281
- const purpose = teamDid === info.did || isEmpty(exist.type) ? 'login' : 'verification';
282
+ // @note: 如果通行证类型为空,或者为通用通行证,则认为是登录,但是这可能会导致恶意应用伪造 type 字段
283
+ const purpose =
284
+ isEmpty(exist.type) || (isArray(exist.type) && exist.type.includes(VC_TYPE_GENERAL_PASSPORT))
285
+ ? 'login'
286
+ : 'verification';
282
287
  if (oldPassport.scope === 'passport') {
283
288
  const vcParams = {
284
289
  issuerName,
@@ -362,7 +367,7 @@ const createLostPassportIssueRoute = ({ node, type, authServicePrefix, createTok
362
367
  node
363
368
  );
364
369
 
365
- if (oldPassport.scope === 'passport' && purpose === 'login' && isFunction(createToken)) {
370
+ if (oldPassport.scope === 'passport' && isFunction(createToken)) {
366
371
  if (type === TEAM_TYPES.BLOCKLET) {
367
372
  const lastLoginIp = getRequestIP(request);
368
373
  const walletDeviceMessageToken = request.get('wallet-device-message-token');
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.39",
6
+ "version": "1.16.40-beta-20250227-092112-1815be0a",
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.39",
24
- "@abtnode/logger": "1.16.39",
25
- "@abtnode/util": "1.16.39",
26
- "@arcblock/did": "1.19.10",
27
- "@arcblock/did-auth": "1.19.10",
28
- "@arcblock/jwt": "^1.19.10",
29
- "@arcblock/nft-display": "^2.11.48",
30
- "@arcblock/validator": "^1.19.10",
31
- "@arcblock/vc": "1.19.10",
32
- "@blocklet/constant": "1.16.39",
33
- "@blocklet/meta": "1.16.39",
34
- "@blocklet/sdk": "1.16.39",
35
- "@ocap/client": "^1.19.10",
36
- "@ocap/mcrypto": "1.19.10",
37
- "@ocap/util": "1.19.10",
38
- "@ocap/wallet": "1.19.10",
23
+ "@abtnode/constant": "1.16.40-beta-20250227-092112-1815be0a",
24
+ "@abtnode/logger": "1.16.40-beta-20250227-092112-1815be0a",
25
+ "@abtnode/util": "1.16.40-beta-20250227-092112-1815be0a",
26
+ "@arcblock/did": "1.19.12",
27
+ "@arcblock/did-auth": "1.19.12",
28
+ "@arcblock/jwt": "^1.19.12",
29
+ "@arcblock/nft-display": "^2.11.49",
30
+ "@arcblock/validator": "^1.19.12",
31
+ "@arcblock/vc": "1.19.12",
32
+ "@blocklet/constant": "1.16.40-beta-20250227-092112-1815be0a",
33
+ "@blocklet/meta": "1.16.40-beta-20250227-092112-1815be0a",
34
+ "@blocklet/sdk": "1.16.40-beta-20250227-092112-1815be0a",
35
+ "@ocap/client": "^1.19.12",
36
+ "@ocap/mcrypto": "1.19.12",
37
+ "@ocap/util": "1.19.12",
38
+ "@ocap/wallet": "1.19.12",
39
39
  "@simplewebauthn/server": "^13.0.0",
40
40
  "axios": "^1.7.9",
41
41
  "flat": "^5.0.2",
@@ -52,5 +52,5 @@
52
52
  "devDependencies": {
53
53
  "jest": "^29.7.0"
54
54
  },
55
- "gitHead": "e3a614757b32dba71dcc187f20060932df31eab6"
55
+ "gitHead": "e33d791e24236a10ed3d196618aba989a0eee8ad"
56
56
  }