@abtnode/auth 1.7.15 → 1.7.18
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 +3 -0
- package/lib/lost-passport.js +3 -1
- package/lib/server.js +8 -2
- package/package.json +12 -12
package/lib/auth.js
CHANGED
|
@@ -561,6 +561,7 @@ const handleIssuePassportResponse = async ({
|
|
|
561
561
|
locale = 'en',
|
|
562
562
|
claims,
|
|
563
563
|
statusEndpointBaseUrl,
|
|
564
|
+
updateSession,
|
|
564
565
|
endpoint,
|
|
565
566
|
}) => {
|
|
566
567
|
// verify signature
|
|
@@ -656,6 +657,8 @@ const handleIssuePassportResponse = async ({
|
|
|
656
657
|
await node.setBlockletInitialized({ did: teamDid, owner: { did: userDid, pk: userPk } });
|
|
657
658
|
}
|
|
658
659
|
|
|
660
|
+
await updateSession({ passportId: vc.id });
|
|
661
|
+
|
|
659
662
|
return {
|
|
660
663
|
disposition: 'attachment',
|
|
661
664
|
type: 'VerifiableCredential',
|
package/lib/lost-passport.js
CHANGED
|
@@ -182,7 +182,7 @@ const createLostPassportIssueRoute = ({ node, type, authServicePrefix }) => ({
|
|
|
182
182
|
},
|
|
183
183
|
],
|
|
184
184
|
|
|
185
|
-
onAuth: async ({ claims, userDid, userPk, extraParams, baseUrl, req }) => {
|
|
185
|
+
onAuth: async ({ claims, userDid, userPk, extraParams, updateSession, baseUrl, req }) => {
|
|
186
186
|
const { locale = 'en', receiverDid, passportName } = extraParams;
|
|
187
187
|
|
|
188
188
|
const { teamDid, issuerDid, issuerName, issuerWallet, passportColor } = await getTeamInfo({ node, req, type });
|
|
@@ -276,6 +276,8 @@ const createLostPassportIssueRoute = ({ node, type, authServicePrefix }) => ({
|
|
|
276
276
|
node
|
|
277
277
|
);
|
|
278
278
|
|
|
279
|
+
await updateSession({ passportId: vc.id });
|
|
280
|
+
|
|
279
281
|
return {
|
|
280
282
|
disposition: 'attachment',
|
|
281
283
|
type: 'VerifiableCredential',
|
package/lib/server.js
CHANGED
|
@@ -165,17 +165,23 @@ const authenticateByNFT = async ({ node, claims, userDid, challenge, locale }) =
|
|
|
165
165
|
|
|
166
166
|
const getAuthVcClaim =
|
|
167
167
|
(node) =>
|
|
168
|
-
async ({ extraParams: { locale }, context: { didwallet } }) => {
|
|
168
|
+
async ({ extraParams: { locale, passportId = '' }, context: { didwallet } }) => {
|
|
169
169
|
checkWalletVersion({ didwallet, locale });
|
|
170
170
|
const info = await node.getNodeInfo();
|
|
171
171
|
const trustedPassports = (info.trustedPassports || []).map((x) => x.issuerDid);
|
|
172
172
|
const trustedIssuers = [info.did, ...trustedPassports].filter(Boolean);
|
|
173
|
-
|
|
173
|
+
const claim = {
|
|
174
174
|
description: messages.requestPassport[locale],
|
|
175
175
|
optional: false,
|
|
176
176
|
item: abtnodeVcTypes,
|
|
177
177
|
trustedIssuers,
|
|
178
178
|
};
|
|
179
|
+
|
|
180
|
+
if (passportId) {
|
|
181
|
+
claim.target = passportId;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return claim;
|
|
179
185
|
};
|
|
180
186
|
|
|
181
187
|
const getLaunchFreeBlockletClaims = (node, authMethod) => {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.7.
|
|
6
|
+
"version": "1.7.18",
|
|
7
7
|
"description": "Simple lib to manage auth in ABT Node",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@abtnode/constant": "1.7.
|
|
24
|
-
"@abtnode/logger": "1.7.
|
|
25
|
-
"@abtnode/util": "1.7.
|
|
26
|
-
"@arcblock/did": "^1.16.
|
|
27
|
-
"@arcblock/vc": "^1.16.
|
|
28
|
-
"@blocklet/meta": "1.7.
|
|
29
|
-
"@ocap/client": "1.16.
|
|
30
|
-
"@ocap/mcrypto": "^1.16.
|
|
31
|
-
"@ocap/util": "^1.16.
|
|
32
|
-
"@ocap/wallet": "^1.16.
|
|
23
|
+
"@abtnode/constant": "1.7.18",
|
|
24
|
+
"@abtnode/logger": "1.7.18",
|
|
25
|
+
"@abtnode/util": "1.7.18",
|
|
26
|
+
"@arcblock/did": "^1.16.9",
|
|
27
|
+
"@arcblock/vc": "^1.16.9",
|
|
28
|
+
"@blocklet/meta": "1.7.18",
|
|
29
|
+
"@ocap/client": "1.16.9",
|
|
30
|
+
"@ocap/mcrypto": "^1.16.9",
|
|
31
|
+
"@ocap/util": "^1.16.9",
|
|
32
|
+
"@ocap/wallet": "^1.16.9",
|
|
33
33
|
"axios": "^0.26.1",
|
|
34
34
|
"joi": "^17.6.0",
|
|
35
35
|
"jsonwebtoken": "^8.5.1",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"jest": "^27.4.5"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "062bf3d0df5acd1f2207b70597f49745089033df"
|
|
44
44
|
}
|