@abtnode/auth 1.6.11 → 1.6.15
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 +20 -6
- package/lib/lost-passport.js +12 -4
- package/lib/passport.js +18 -26
- package/lib/util/create-passport-svg.js +70 -0
- package/package.json +11 -11
package/lib/auth.js
CHANGED
|
@@ -13,12 +13,13 @@ const verifySignature = require('./util/verify-signature');
|
|
|
13
13
|
const {
|
|
14
14
|
createPassport,
|
|
15
15
|
createPassportVC,
|
|
16
|
-
createPassportSvg,
|
|
17
16
|
upsertToPassports,
|
|
18
17
|
createUserPassport,
|
|
19
18
|
getRoleFromLocalPassport,
|
|
20
19
|
} = require('./passport');
|
|
21
20
|
|
|
21
|
+
const createPassportSvg = require('./util/create-passport-svg');
|
|
22
|
+
|
|
22
23
|
const messages = {
|
|
23
24
|
description: {
|
|
24
25
|
en: 'Login with your DID Wallet',
|
|
@@ -270,7 +271,12 @@ const createInvitationRequest = async ({ node, nodeInfo, teamDid, inviteId, loca
|
|
|
270
271
|
type: 'mime:text/plain',
|
|
271
272
|
display: JSON.stringify({
|
|
272
273
|
type: 'svg',
|
|
273
|
-
content: createPassportSvg({
|
|
274
|
+
content: createPassportSvg({
|
|
275
|
+
issuer: issuerName,
|
|
276
|
+
title: passport.title,
|
|
277
|
+
issuerDid: issuerWallet.address,
|
|
278
|
+
ownerName: 'Your Name',
|
|
279
|
+
}),
|
|
274
280
|
}),
|
|
275
281
|
};
|
|
276
282
|
};
|
|
@@ -299,6 +305,8 @@ const handleInvitationResponse = async ({
|
|
|
299
305
|
const inviteInfo = await node.processInvitation({ teamDid, inviteId });
|
|
300
306
|
const { remark } = inviteInfo;
|
|
301
307
|
|
|
308
|
+
const profile = claims.find((x) => x.type === 'profile');
|
|
309
|
+
|
|
302
310
|
const vcParams = {
|
|
303
311
|
issuerName,
|
|
304
312
|
issuerWallet,
|
|
@@ -316,6 +324,7 @@ const handleInvitationResponse = async ({
|
|
|
316
324
|
teamDid,
|
|
317
325
|
}),
|
|
318
326
|
types: teamDid === nodeInfo.did ? [NFT_TYPE_NODE_PASSPORT] : [],
|
|
327
|
+
ownerProfile: profile,
|
|
319
328
|
};
|
|
320
329
|
|
|
321
330
|
if (issuerType === 'node') {
|
|
@@ -327,8 +336,6 @@ const handleInvitationResponse = async ({
|
|
|
327
336
|
const role = getRoleFromLocalPassport(get(vc, 'credentialSubject.passport'));
|
|
328
337
|
const passport = createUserPassport(vc, { role });
|
|
329
338
|
|
|
330
|
-
const profile = claims.find((x) => x.type === 'profile');
|
|
331
|
-
|
|
332
339
|
const user = await getUser(node, teamDid, userDid);
|
|
333
340
|
|
|
334
341
|
if (user) {
|
|
@@ -391,7 +398,6 @@ const createIssuePassportRequest = async ({ node, nodeInfo, teamDid, id, locale
|
|
|
391
398
|
if (!id) {
|
|
392
399
|
throw new Error('The issuance id does not exist');
|
|
393
400
|
}
|
|
394
|
-
|
|
395
401
|
const list = await node.getPassportIssuances({ teamDid });
|
|
396
402
|
const issuanceInfo = list.find((x) => x.id === id);
|
|
397
403
|
if (!issuanceInfo) {
|
|
@@ -399,6 +405,7 @@ const createIssuePassportRequest = async ({ node, nodeInfo, teamDid, id, locale
|
|
|
399
405
|
}
|
|
400
406
|
|
|
401
407
|
const { name: issuerName, wallet: issuerWallet } = await getTeamInfo({ node, nodeInfo, teamDid });
|
|
408
|
+
const user = await getUser(node, teamDid, issuanceInfo.ownerDid);
|
|
402
409
|
|
|
403
410
|
const passport = await createPassport({
|
|
404
411
|
name: issuanceInfo.name,
|
|
@@ -413,7 +420,13 @@ const createIssuePassportRequest = async ({ node, nodeInfo, teamDid, id, locale
|
|
|
413
420
|
type: 'mime:text/plain',
|
|
414
421
|
display: JSON.stringify({
|
|
415
422
|
type: 'svg',
|
|
416
|
-
content: createPassportSvg({
|
|
423
|
+
content: createPassportSvg({
|
|
424
|
+
issuer: issuerName,
|
|
425
|
+
title: passport.title,
|
|
426
|
+
issuerDid: issuerWallet.address,
|
|
427
|
+
ownerName: get(user, 'fullName', 'Your Name'),
|
|
428
|
+
ownerAvatarUrl: get(user, 'avatar', ''),
|
|
429
|
+
}),
|
|
417
430
|
}),
|
|
418
431
|
};
|
|
419
432
|
};
|
|
@@ -476,6 +489,7 @@ const handleIssuePassportResponse = async ({
|
|
|
476
489
|
teamDid,
|
|
477
490
|
}),
|
|
478
491
|
types: teamDid === nodeInfo.did ? [NFT_TYPE_NODE_PASSPORT] : [],
|
|
492
|
+
ownerProfile: user,
|
|
479
493
|
};
|
|
480
494
|
|
|
481
495
|
if (issuerType === 'node') {
|
package/lib/lost-passport.js
CHANGED
|
@@ -9,7 +9,6 @@ const get = require('lodash/get');
|
|
|
9
9
|
const logger = require('./logger');
|
|
10
10
|
const { messages, getUser, checkWalletVersion, getPassportStatusEndpoint } = require('./auth');
|
|
11
11
|
const {
|
|
12
|
-
createPassportSvg,
|
|
13
12
|
createPassport,
|
|
14
13
|
createPassportVC,
|
|
15
14
|
upsertToPassports,
|
|
@@ -18,6 +17,8 @@ const {
|
|
|
18
17
|
} = require('./passport');
|
|
19
18
|
const verifySignature = require('./util/verify-signature');
|
|
20
19
|
|
|
20
|
+
const createPassportSvg = require('./util/create-passport-svg');
|
|
21
|
+
|
|
21
22
|
const TEAM_TYPES = {
|
|
22
23
|
BLOCKLET: 'blocklet',
|
|
23
24
|
NODE: 'node',
|
|
@@ -132,7 +133,6 @@ const createLostPassportListRoute = ({ node, type }) => ({
|
|
|
132
133
|
const createLostPassportIssueRoute = ({ node, type, authServicePrefix }) => ({
|
|
133
134
|
action: 'lost-passport-issue',
|
|
134
135
|
authPrincipal: false,
|
|
135
|
-
|
|
136
136
|
claims: [
|
|
137
137
|
{
|
|
138
138
|
authPrincipal: async ({ extraParams }) => {
|
|
@@ -145,10 +145,11 @@ const createLostPassportIssueRoute = ({ node, type, authServicePrefix }) => ({
|
|
|
145
145
|
},
|
|
146
146
|
{
|
|
147
147
|
signature: async ({ extraParams, context: { request, abtwallet } }) => {
|
|
148
|
-
const { locale, passportName } = extraParams;
|
|
148
|
+
const { locale, passportName, receiverDid } = extraParams;
|
|
149
149
|
checkWalletVersion({ abtwallet, locale });
|
|
150
150
|
|
|
151
151
|
const { teamDid, issuerDid, issuerName } = await getTeamInfo({ node, req: request, type });
|
|
152
|
+
const user = await getUser(node, teamDid, receiverDid);
|
|
152
153
|
|
|
153
154
|
const passport = await createPassport({
|
|
154
155
|
name: passportName,
|
|
@@ -163,7 +164,13 @@ const createLostPassportIssueRoute = ({ node, type, authServicePrefix }) => ({
|
|
|
163
164
|
type: 'mime:text/plain',
|
|
164
165
|
display: JSON.stringify({
|
|
165
166
|
type: 'svg',
|
|
166
|
-
content: createPassportSvg({
|
|
167
|
+
content: createPassportSvg({
|
|
168
|
+
issuer: issuerName,
|
|
169
|
+
title: passport.title,
|
|
170
|
+
issuerDid,
|
|
171
|
+
ownerName: user.fullName || '',
|
|
172
|
+
ownerAvatarUrl: user.avatar || '',
|
|
173
|
+
}),
|
|
167
174
|
}),
|
|
168
175
|
};
|
|
169
176
|
},
|
|
@@ -232,6 +239,7 @@ const createLostPassportIssueRoute = ({ node, type, authServicePrefix }) => ({
|
|
|
232
239
|
teamDid,
|
|
233
240
|
}),
|
|
234
241
|
types: [],
|
|
242
|
+
ownerProfile: user,
|
|
235
243
|
};
|
|
236
244
|
|
|
237
245
|
if (type === TEAM_TYPES.NODE) {
|
package/lib/passport.js
CHANGED
|
@@ -4,6 +4,7 @@ const Joi = require('joi');
|
|
|
4
4
|
const pick = require('lodash/pick');
|
|
5
5
|
const { create: createVC } = require('@arcblock/vc');
|
|
6
6
|
const { ROLES, NFT_TYPE_GENERAL_PASSPORT, PASSPORT_STATUS } = require('@abtnode/constant');
|
|
7
|
+
const createPassportSvg = require('./util/create-passport-svg');
|
|
7
8
|
|
|
8
9
|
const SPEC_VERSION = '1.0.0';
|
|
9
10
|
|
|
@@ -48,31 +49,16 @@ const createPassport = async ({ name, node, locale = 'en', teamDid, endpoint } =
|
|
|
48
49
|
return passport;
|
|
49
50
|
};
|
|
50
51
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
<text x="24" y="44" font-size="18" fill="#222222" style='width: 100'>${issuer}</text>
|
|
62
|
-
<path d="M234 24.25H289V23.75H234V24.25ZM292.75 28V47H293.25V28H292.75ZM289 50.75H234V51.25H289V50.75ZM230.25 47V28H229.75V47H230.25ZM234 50.75C231.929 50.75 230.25 49.0711 230.25 47H229.75C229.75 49.3472 231.653 51.25 234 51.25V50.75ZM292.75 47C292.75 49.0711 291.071 50.75 289 50.75V51.25C291.347 51.25 293.25 49.3472 293.25 47H292.75ZM289 24.25C291.071 24.25 292.75 25.9289 292.75 28H293.25C293.25 25.6528 291.347 23.75 289 23.75V24.25ZM234 23.75C231.653 23.75 229.75 25.6528 229.75 28H230.25C230.25 25.9289 231.929 24.25 234 24.25V23.75Z" fill="#999999"/>
|
|
63
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M25.9318 163.527H41.0926C41.8394 163.527 42.4449 164.077 42.4449 164.756V173.244C42.4449 173.923 41.8394 174.473 41.0926 174.473H25.9318C25.185 174.473 24.5795 173.923 24.5795 173.244V173.172C24.5795 173.012 24.4498 172.882 24.2898 172.882C24.1297 172.882 24 173.012 24 173.172V173.244C24 174.214 24.8649 175 25.9318 175H41.0926C42.1595 175 43.0244 174.214 43.0244 173.244V164.756C43.0244 163.786 42.1595 163 41.0926 163H25.9318C24.8649 163 24 163.786 24 164.756V164.828C24 164.988 24.1297 165.118 24.2898 165.118C24.4498 165.118 24.5795 164.988 24.5795 164.828V164.756C24.5795 164.077 25.185 163.527 25.9318 163.527ZM24.0612 172.012C24.1079 172.053 24.1604 172.073 24.2187 172.073H26.5375C27.4008 172.073 28.057 171.877 28.5062 171.485C28.9612 171.087 29.2033 170.481 29.2325 169.667C29.2383 169.503 29.2412 169.281 29.2412 169C29.2412 168.719 29.2383 168.494 29.2325 168.324C29.2091 167.545 28.9612 166.951 28.4887 166.541C28.0162 166.132 27.3512 165.927 26.4937 165.927H24.2187C24.1604 165.927 24.1079 165.947 24.0612 165.988C24.0204 166.029 24 166.082 24 166.146V171.854C24 171.912 24.0204 171.965 24.0612 172.012ZM27.3425 170.537C27.1616 170.718 26.8787 170.809 26.4937 170.809H25.575V167.191H26.45C26.835 167.191 27.1237 167.285 27.3162 167.472C27.5146 167.66 27.6196 167.949 27.6312 168.341C27.6429 168.505 27.6487 168.722 27.6487 168.991C27.6487 169.26 27.6429 169.48 27.6312 169.65C27.6196 170.054 27.5233 170.349 27.3425 170.537ZM30.3246 172.012C30.3713 172.053 30.4238 172.073 30.4821 172.073H31.6546C31.7188 172.073 31.7713 172.053 31.8121 172.012C31.8588 171.971 31.8821 171.918 31.8821 171.854V166.146C31.8821 166.082 31.8588 166.029 31.8121 165.988C31.7713 165.947 31.7188 165.927 31.6546 165.927H30.4821C30.4238 165.927 30.3713 165.947 30.3246 165.988C30.2838 166.029 30.2634 166.082 30.2634 166.146V171.854C30.2634 171.912 30.2838 171.965 30.3246 172.012ZM33.319 172.073C33.2607 172.073 33.2082 172.053 33.1615 172.012C33.1207 171.965 33.1003 171.912 33.1003 171.854V166.146C33.1003 166.082 33.1207 166.029 33.1615 165.988C33.2082 165.947 33.2607 165.927 33.319 165.927H35.594C36.4515 165.927 37.1165 166.132 37.589 166.541C38.0615 166.951 38.3094 167.545 38.3327 168.324C38.3385 168.494 38.3415 168.719 38.3415 169C38.3415 169.281 38.3385 169.503 38.3327 169.667C38.3035 170.481 38.0615 171.087 37.6065 171.485C37.1573 171.877 36.5011 172.073 35.6377 172.073H33.319ZM35.594 170.809C35.979 170.809 36.2619 170.718 36.4427 170.537C36.6236 170.349 36.7198 170.054 36.7315 169.65C36.7431 169.48 36.749 169.26 36.749 168.991C36.749 168.722 36.7431 168.505 36.7315 168.341C36.7198 167.949 36.6148 167.66 36.4165 167.472C36.224 167.285 35.9352 167.191 35.5502 167.191H34.6752V170.809H35.594ZM40.1082 168.282C39.8193 168.282 39.5811 168.047 39.5811 167.759C39.5811 167.47 39.8193 167.235 40.1082 167.235C40.3972 167.235 40.6354 167.47 40.6354 167.759C40.6354 168.047 40.3972 168.282 40.1082 168.282ZM40.1082 171.017C39.8193 171.017 39.5811 170.782 39.5811 170.493C39.5811 170.205 39.8193 169.97 40.1082 169.97C40.3972 169.97 40.6354 170.205 40.6354 170.493C40.6354 170.782 40.3972 171.017 40.1082 171.017Z" fill="#999999"/>
|
|
64
|
-
<text x="48" y="173" font-size="11" fill="#777777" font-family="Courier New">${issuerDid}</text>
|
|
65
|
-
<rect x="0.5" y="0.5" width="316" height="199" rx="7.5" stroke="#E7ECF6"/>
|
|
66
|
-
<defs>
|
|
67
|
-
<linearGradient id="paint0_linear" x1="158.5" y1="0" x2="158.5" y2="200" gradientUnits="userSpaceOnUse">
|
|
68
|
-
<stop stop-color="#F3F6FC"/>
|
|
69
|
-
<stop offset="1" stop-color="#EEF1F7"/>
|
|
70
|
-
</linearGradient>
|
|
71
|
-
</defs>
|
|
72
|
-
</svg>
|
|
73
|
-
`;
|
|
74
|
-
|
|
75
|
-
const createPassportVC = ({ issuerWallet, issuerName, ownerDid, passport, endpoint, types = [], tag } = {}) => {
|
|
52
|
+
const createPassportVC = ({
|
|
53
|
+
issuerWallet,
|
|
54
|
+
issuerName,
|
|
55
|
+
ownerDid,
|
|
56
|
+
passport,
|
|
57
|
+
endpoint,
|
|
58
|
+
types = [],
|
|
59
|
+
tag,
|
|
60
|
+
ownerProfile,
|
|
61
|
+
} = {}) => {
|
|
76
62
|
validatePassport(passport);
|
|
77
63
|
|
|
78
64
|
return createVC({
|
|
@@ -86,7 +72,13 @@ const createPassportVC = ({ issuerWallet, issuerName, ownerDid, passport, endpoi
|
|
|
86
72
|
passport,
|
|
87
73
|
display: {
|
|
88
74
|
type: 'svg',
|
|
89
|
-
content: createPassportSvg({
|
|
75
|
+
content: createPassportSvg({
|
|
76
|
+
issuer: issuerName,
|
|
77
|
+
issuerDid: issuerWallet.address,
|
|
78
|
+
title: passport.title,
|
|
79
|
+
ownerName: ownerProfile ? ownerProfile.fullName : '',
|
|
80
|
+
ownerAvatarUrl: ownerProfile ? ownerProfile.avatar : '',
|
|
81
|
+
}),
|
|
90
82
|
},
|
|
91
83
|
},
|
|
92
84
|
endpoint,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate Passport SVG
|
|
3
|
+
*
|
|
4
|
+
* @param {string} title passport title
|
|
5
|
+
* @param {string} issuer issuer name
|
|
6
|
+
* @param {string} issuerDid
|
|
7
|
+
* @param {boolean} ownerName
|
|
8
|
+
* @param {boolean} ownerAvatarUrl
|
|
9
|
+
* @param {boolean} revoked 是否撤销
|
|
10
|
+
* @param {boolean} isDataUrl 返回生成 data url
|
|
11
|
+
* @returns {string} svg xml or image data url
|
|
12
|
+
*/
|
|
13
|
+
const createPassportSvg = ({ issuer, title, issuerDid, ownerName = '', ownerAvatarUrl = '', revoked, isDataUrl }) => {
|
|
14
|
+
const svgXML = `<svg width="100%" height="100%" viewBox="0 0 424 564" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
15
|
+
<rect x="1" y="1" width="422" height="562" rx="21" fill="url(#paint0_linear_6_342)"/>
|
|
16
|
+
<text x="360" y="65" fill="white" xml:space="preserve" font-family="Roboto" font-size="${(() => {
|
|
17
|
+
if (title.length >= 6) {
|
|
18
|
+
return 24;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (title.length >= 8) {
|
|
22
|
+
return 20;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return 28;
|
|
26
|
+
})()}" letter-spacing="0px" style="dominant-baseline:middle;text-anchor:middle;">${title.toUpperCase()}</text>
|
|
27
|
+
<text opacity="0.4" fill="white" xml:space="preserve" style="white-space: pre" font-family="Roboto" font-size="16" font-weight="500" letter-spacing="0px"><tspan x="319" y="40.9688">PASSPORT</tspan></text>
|
|
28
|
+
<text fill="white" xml:space="preserve" style="white-space: pre" font-family="Roboto" font-size="${(() => {
|
|
29
|
+
if (issuer.length > 15) {
|
|
30
|
+
return 20;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return 24;
|
|
34
|
+
})()}" font-weight="500" letter-spacing="0px"><tspan x="26" y="60.2031">${issuer}</tspan></text>
|
|
35
|
+
<rect x="2" y="102" width="420" height="168" fill="black" fill-opacity="0.3"/>
|
|
36
|
+
<circle cx="212" cy="250" r="60" fill="#FBFBFB"/>
|
|
37
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M212.224 247.722C218.932 247.722 224.37 242.284 224.37 235.575C224.37 228.867 218.932 223.429 212.224 223.429C205.515 223.429 200.077 228.867 200.077 235.575C200.077 242.284 205.515 247.722 212.224 247.722ZM188.857 272.018C188.857 274.573 190.929 276.645 193.484 276.645H230.962C231.28 276.645 231.597 276.612 231.908 276.547C234.41 276.025 236.014 273.574 235.492 271.072L234.335 265.533C232.991 259.099 227.319 254.489 220.746 254.489H203.7C197.127 254.489 191.455 259.099 190.112 265.533L188.955 271.072C188.89 271.383 188.857 271.7 188.857 272.018Z" fill="#FBFBFB" />
|
|
38
|
+
<path d="M231.908 276.547L232.215 278.016L231.908 276.547ZM235.492 271.072L236.96 270.765H236.96L235.492 271.072ZM234.335 265.533L232.866 265.839L234.335 265.533ZM190.112 265.533L191.58 265.839L190.112 265.533ZM188.955 271.072L187.487 270.765H187.487L188.955 271.072ZM222.87 235.575C222.87 241.455 218.104 246.222 212.224 246.222V249.222C219.761 249.222 225.87 243.112 225.87 235.575H222.87ZM212.224 224.929C218.104 224.929 222.87 229.695 222.87 235.575H225.87C225.87 228.038 219.761 221.929 212.224 221.929V224.929ZM201.577 235.575C201.577 229.695 206.344 224.929 212.224 224.929V221.929C204.687 221.929 198.577 228.038 198.577 235.575H201.577ZM212.224 246.222C206.344 246.222 201.577 241.455 201.577 235.575H198.577C198.577 243.112 204.687 249.222 212.224 249.222V246.222ZM193.484 275.145C191.757 275.145 190.357 273.745 190.357 272.018H187.357C187.357 275.402 190.1 278.145 193.484 278.145V275.145ZM230.962 275.145H193.484V278.145H230.962V275.145ZM231.601 275.079C231.391 275.123 231.177 275.145 230.962 275.145V278.145C231.383 278.145 231.803 278.102 232.215 278.016L231.601 275.079ZM234.023 271.379C234.376 273.069 233.292 274.726 231.601 275.079L232.215 278.016C235.527 277.324 237.652 274.078 236.96 270.765L234.023 271.379ZM232.866 265.839L234.023 271.379L236.96 270.765L235.803 265.226L232.866 265.839ZM220.746 255.989C226.609 255.989 231.668 260.1 232.866 265.839L235.803 265.226C234.314 258.097 228.029 252.989 220.746 252.989V255.989ZM203.7 255.989H220.746V252.989H203.7V255.989ZM191.58 265.839C192.779 260.1 197.838 255.989 203.7 255.989V252.989C196.417 252.989 190.132 258.097 188.643 265.226L191.58 265.839ZM190.423 271.379L191.58 265.839L188.643 265.226L187.487 270.765L190.423 271.379ZM190.357 272.018C190.357 271.803 190.379 271.589 190.423 271.379L187.487 270.765C187.401 271.177 187.357 271.597 187.357 272.018H190.357Z" fill="#BFBFBF" />
|
|
39
|
+
<circle cx="212" cy="250" r="60" fill="url(#raduisImage)"/>
|
|
40
|
+
<defs>
|
|
41
|
+
<pattern id="raduisImage" patternUnits="userSpaceOnUse" width="424" height="564">
|
|
42
|
+
<image x="152" y="190" href="${ownerAvatarUrl}" width="120" height="120" />
|
|
43
|
+
</pattern>
|
|
44
|
+
</defs>
|
|
45
|
+
<text x="215" y="350" fill="white" xml:space="preserve" style="dominant-baseline:middle;text-anchor:middle;" font-family="Roboto" font-size="28" font-weight="500" letter-spacing="0px">${ownerName}</text>
|
|
46
|
+
<text opacity="0.4" fill="white" xml:space="preserve" style="white-space: pre" font-family="Roboto" font-size="18" font-weight="500" letter-spacing="0px"><tspan x="26" y="407.652">ISSUER DID</tspan></text>
|
|
47
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M28.6722 423.313H45.3819C46.4294 423.313 47.2787 424.162 47.2787 425.21V433.79C47.2787 434.838 46.4294 435.687 45.3819 435.687H28.6722C27.9517 435.687 27.3249 435.285 27.0039 434.694H26.1167C26.4887 435.746 27.4924 436.5 28.6722 436.5H45.3819C46.8784 436.5 48.0916 435.287 48.0916 433.79V425.21C48.0916 423.713 46.8784 422.5 45.3819 422.5H28.6722C27.3296 422.5 26.215 423.477 26 424.758H26.8295C27.0321 423.929 27.7803 423.313 28.6722 423.313ZM27.8801 432.096C27.7831 432.089 27.6966 432.082 27.6204 432.075V427.526C27.7243 427.512 27.8351 427.505 27.9528 427.505C28.0705 427.498 28.1848 427.494 28.2955 427.494C29.1057 427.494 29.6978 427.688 30.0717 428.076C30.4457 428.464 30.6326 429.035 30.6326 429.79C30.6326 430.51 30.4353 431.074 30.0406 431.483C29.6528 431.892 29.0538 432.096 28.2436 432.096H27.8801ZM32.0141 431.421C32.208 430.957 32.305 430.413 32.305 429.79C32.305 429.139 32.208 428.582 32.0141 428.118C31.8202 427.654 31.5432 427.273 31.1832 426.975C30.8231 426.677 30.3903 426.459 29.8848 426.321C29.3862 426.182 28.8288 426.113 28.2125 426.113C27.9216 426.113 27.5719 426.127 27.1634 426.154C26.7617 426.175 26.3739 426.22 26 426.29V433.301C26.3739 433.377 26.7548 433.425 27.1426 433.446C27.5304 433.474 27.8697 433.488 28.1605 433.488C28.7976 433.488 29.3723 433.412 29.8848 433.259C30.3972 433.107 30.83 432.878 31.1832 432.574C31.5432 432.269 31.8202 431.885 32.0141 431.421ZM35.2788 426.196H33.6585V433.394H35.2788V426.196ZM38.5654 432.075C38.6416 432.082 38.7281 432.089 38.8251 432.096H39.1886C39.9988 432.096 40.5978 431.892 40.9856 431.483C41.3803 431.074 41.5776 430.51 41.5776 429.79C41.5776 429.035 41.3907 428.464 41.0167 428.076C40.6428 427.688 40.0507 427.494 39.2405 427.494C39.1298 427.494 39.0155 427.498 38.8978 427.505C38.7801 427.505 38.6693 427.512 38.5654 427.526V432.075ZM43.25 429.79C43.25 430.413 43.153 430.957 42.9591 431.421C42.7652 431.885 42.4882 432.269 42.1282 432.574C41.775 432.878 41.3422 433.107 40.8298 433.259C40.3173 433.412 39.7426 433.488 39.1055 433.488C38.8147 433.488 38.4754 433.474 38.0876 433.446C37.6998 433.425 37.3189 433.377 36.945 433.301V426.29C37.3189 426.22 37.7067 426.175 38.1084 426.154C38.5169 426.127 38.8666 426.113 39.1574 426.113C39.7738 426.113 40.3312 426.182 40.8298 426.321C41.3353 426.459 41.7681 426.677 42.1282 426.975C42.4882 427.273 42.7652 427.654 42.9591 428.118C43.153 428.582 43.25 429.139 43.25 429.79ZM45.1907 428.355C44.8209 428.355 44.5161 428.055 44.5161 427.686C44.5161 427.316 44.8209 427.016 45.1907 427.016C45.5604 427.016 45.8652 427.316 45.8652 427.686C45.8652 428.055 45.5604 428.355 45.1907 428.355ZM45.1907 431.855C44.8209 431.855 44.5161 431.555 44.5161 431.185C44.5161 430.815 44.8209 430.516 45.1907 430.516C45.5604 430.516 45.8652 430.815 45.8652 431.185C45.8652 431.555 45.5604 431.855 45.1907 431.855Z" fill="white"/>
|
|
48
|
+
<text fill="white" xml:space="preserve" style="white-space: pre" font-family="Roboto" font-size="15" font-weight="500" letter-spacing="0px"><tspan x="54.0916" y="434.969">${issuerDid}</tspan></text>
|
|
49
|
+
<rect x="1" y="1" width="422" height="562" rx="21" stroke="#F0F0F0" stroke-width="2"/>
|
|
50
|
+
<defs>
|
|
51
|
+
<linearGradient id="paint0_linear_6_342" x1="414.5" y1="562" x2="-116.166" y2="156.726" gradientUnits="userSpaceOnUse">
|
|
52
|
+
<stop stop-color="#2B3845"/>
|
|
53
|
+
<stop offset="1" stop-color="#5A7A8A"/>
|
|
54
|
+
</linearGradient>
|
|
55
|
+
</defs>
|
|
56
|
+
${
|
|
57
|
+
revoked
|
|
58
|
+
? '<circle cx="210" cy="250" r="120" stroke="rgba(255,0,0,0.5)" stroke-width="25" /><line x1="132" y1="168" x2="296" y2="323" stroke="rgba(255,0,0,0.5)" stroke-width="25" />'
|
|
59
|
+
: ''
|
|
60
|
+
}
|
|
61
|
+
</svg>`;
|
|
62
|
+
|
|
63
|
+
if (isDataUrl) {
|
|
64
|
+
return `data:image/svg+xml;utf8,${encodeURIComponent(svgXML)}`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return svgXML;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
module.exports = createPassportSvg;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.6.
|
|
6
|
+
"version": "1.6.15",
|
|
7
7
|
"description": "Simple lib to manage auth in ABT Node",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@abtnode/constant": "1.6.
|
|
24
|
-
"@abtnode/logger": "1.6.
|
|
25
|
-
"@abtnode/util": "1.6.
|
|
26
|
-
"@arcblock/did": "^1.13.
|
|
27
|
-
"@arcblock/vc": "^1.13.
|
|
28
|
-
"@blocklet/meta": "1.6.
|
|
29
|
-
"@ocap/mcrypto": "^1.13.
|
|
30
|
-
"@ocap/util": "^1.13.
|
|
31
|
-
"@ocap/wallet": "^1.13.
|
|
23
|
+
"@abtnode/constant": "1.6.15",
|
|
24
|
+
"@abtnode/logger": "1.6.15",
|
|
25
|
+
"@abtnode/util": "1.6.15",
|
|
26
|
+
"@arcblock/did": "^1.13.84",
|
|
27
|
+
"@arcblock/vc": "^1.13.84",
|
|
28
|
+
"@blocklet/meta": "1.6.15",
|
|
29
|
+
"@ocap/mcrypto": "^1.13.84",
|
|
30
|
+
"@ocap/util": "^1.13.84",
|
|
31
|
+
"@ocap/wallet": "^1.13.84",
|
|
32
32
|
"axios": "^0.21.4",
|
|
33
33
|
"joi": "^17.5.0",
|
|
34
34
|
"jsonwebtoken": "^8.5.1",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"jest": "^27.4.5"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "1b7b07da04387b1daa838b251a9388355009142d"
|
|
43
43
|
}
|