@abtnode/auth 1.17.5-beta-20251209-090953-3a59e7ac → 1.17.5-beta-20251211-104355-426d7eb6
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/server.js +9 -8
- package/package.json +8 -8
package/lib/server.js
CHANGED
|
@@ -8,7 +8,7 @@ const pRetry = require('p-retry');
|
|
|
8
8
|
const { isNFTExpired, isNFTConsumed } = require('@abtnode/util/lib/nft');
|
|
9
9
|
const axios = require('@abtnode/util/lib/axios');
|
|
10
10
|
const { CustomError } = require('@blocklet/error');
|
|
11
|
-
const { joinURL } = require('ufo');
|
|
11
|
+
const { joinURL, withHttps } = require('ufo');
|
|
12
12
|
const { types } = require('@ocap/mcrypto');
|
|
13
13
|
const { toHex, fromBase64 } = require('@ocap/util');
|
|
14
14
|
const { DidType, isEthereumType } = require('@arcblock/did');
|
|
@@ -138,16 +138,16 @@ const getBlockletKnownDids = async ({ teamDid, blocklet, node }) => {
|
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
-
const getKnownIssuerDids = async ({ issuerDid
|
|
141
|
+
const getKnownIssuerDids = async ({ issuerDid }) => {
|
|
142
142
|
try {
|
|
143
143
|
// FIXME: @liushuang 多次迁移后,did 可能是第一次的 did,存在查询不到 blocklet 信息的情况,通过 domain 间接查询
|
|
144
144
|
const domain = getDidDomainForBlocklet({ did: issuerDid });
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
domain,
|
|
148
|
-
useCache: true,
|
|
145
|
+
const { data } = await axios.get(joinURL(withHttps(domain), '__blocklet__.js?type=json'), {
|
|
146
|
+
timeout: 10 * 1000,
|
|
149
147
|
});
|
|
150
|
-
|
|
148
|
+
const { appId, appPid, alsoKnownAs = [] } = data;
|
|
149
|
+
const alsoKnownAsDids = [appId, appPid, ...alsoKnownAs];
|
|
150
|
+
return [...new Set(alsoKnownAsDids.filter(Boolean))];
|
|
151
151
|
} catch (error) {
|
|
152
152
|
return [issuerDid];
|
|
153
153
|
}
|
|
@@ -225,7 +225,8 @@ const authenticateByVc = async ({
|
|
|
225
225
|
|
|
226
226
|
// 需要考虑到 Blocklet 迁移的情况
|
|
227
227
|
const knownTeamDids = await getBlockletKnownDids({ teamDid, blocklet, node });
|
|
228
|
-
const knownIssuerDids =
|
|
228
|
+
const knownIssuerDids =
|
|
229
|
+
trustedIssuers.length > 0 ? trustedIssuers : await getKnownIssuerDids({ issuerDid: issuerId });
|
|
229
230
|
|
|
230
231
|
// 如果 issuerId 存在于 blocklet 的 alsoKnownAs 中认为是相同的 blocklet
|
|
231
232
|
if (knownTeamDids.includes(issuerId)) {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.17.5-beta-
|
|
6
|
+
"version": "1.17.5-beta-20251211-104355-426d7eb6",
|
|
7
7
|
"description": "Simple lib to manage auth in ABT Node",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
19
19
|
"license": "Apache-2.0",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@abtnode/constant": "1.17.5-beta-
|
|
22
|
-
"@abtnode/logger": "1.17.5-beta-
|
|
23
|
-
"@abtnode/util": "1.17.5-beta-
|
|
21
|
+
"@abtnode/constant": "1.17.5-beta-20251211-104355-426d7eb6",
|
|
22
|
+
"@abtnode/logger": "1.17.5-beta-20251211-104355-426d7eb6",
|
|
23
|
+
"@abtnode/util": "1.17.5-beta-20251211-104355-426d7eb6",
|
|
24
24
|
"@arcblock/did": "^1.27.12",
|
|
25
25
|
"@arcblock/did-connect-js": "^1.27.12",
|
|
26
26
|
"@arcblock/did-ext": "^1.27.12",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"@arcblock/nft-display": "^3.2.11",
|
|
30
30
|
"@arcblock/validator": "^1.27.12",
|
|
31
31
|
"@arcblock/vc": "^1.27.12",
|
|
32
|
-
"@blocklet/constant": "1.17.5-beta-
|
|
32
|
+
"@blocklet/constant": "1.17.5-beta-20251211-104355-426d7eb6",
|
|
33
33
|
"@blocklet/error": "^0.3.3",
|
|
34
|
-
"@blocklet/meta": "1.17.5-beta-
|
|
35
|
-
"@blocklet/sdk": "1.17.5-beta-
|
|
34
|
+
"@blocklet/meta": "1.17.5-beta-20251211-104355-426d7eb6",
|
|
35
|
+
"@blocklet/sdk": "1.17.5-beta-20251211-104355-426d7eb6",
|
|
36
36
|
"@ocap/client": "^1.27.12",
|
|
37
37
|
"@ocap/mcrypto": "^1.27.12",
|
|
38
38
|
"@ocap/util": "^1.27.12",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"axios-mock-adapter": "^2.1.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "9ea2a8077a8edbf5021281e823719758eb9fe02c"
|
|
59
59
|
}
|