@abtnode/auth 1.16.15-beta-04d1e821 → 1.16.15-beta-933eb977

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.
@@ -1,5 +1,18 @@
1
1
  const { getNftBGColor, DEFAULT_COLORS, getNftBGColorFromDid, getSvg } = require('@arcblock/nft-display');
2
2
 
3
+ const getPassportColor = (preferredColor, did) => {
4
+ let color;
5
+ if (preferredColor === 'default') {
6
+ color = DEFAULT_COLORS['app-passport'];
7
+ } else if (preferredColor === 'auto') {
8
+ color = getNftBGColorFromDid(did);
9
+ } else {
10
+ color = getNftBGColor(preferredColor);
11
+ }
12
+
13
+ return color;
14
+ };
15
+
3
16
  /**
4
17
  * Generate Passport SVG
5
18
  *
@@ -33,14 +46,7 @@ const createPassportSvg = ({
33
46
  width = '100%',
34
47
  height = '100%',
35
48
  }) => {
36
- let color;
37
- if (preferredColor === 'default') {
38
- color = DEFAULT_COLORS['app-passport'];
39
- } else if (preferredColor === 'auto') {
40
- color = getNftBGColorFromDid(issuerDid);
41
- } else {
42
- color = getNftBGColor(preferredColor);
43
- }
49
+ const color = getPassportColor(preferredColor, issuerDid);
44
50
 
45
51
  const svgXML = getSvg({
46
52
  width,
@@ -80,3 +86,4 @@ const createPassportSvg = ({
80
86
  };
81
87
 
82
88
  module.exports = createPassportSvg;
89
+ module.exports.getPassportColor = getPassportColor;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.15-beta-04d1e821",
6
+ "version": "1.16.15-beta-933eb977",
7
7
  "description": "Simple lib to manage auth in ABT Node",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -20,14 +20,14 @@
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.15-beta-04d1e821",
24
- "@abtnode/logger": "1.16.15-beta-04d1e821",
25
- "@abtnode/util": "1.16.15-beta-04d1e821",
23
+ "@abtnode/constant": "1.16.15-beta-933eb977",
24
+ "@abtnode/logger": "1.16.15-beta-933eb977",
25
+ "@abtnode/util": "1.16.15-beta-933eb977",
26
26
  "@arcblock/did": "1.18.89",
27
27
  "@arcblock/nft-display": "2.7.6",
28
28
  "@arcblock/vc": "1.18.89",
29
- "@blocklet/constant": "1.16.15-beta-04d1e821",
30
- "@blocklet/meta": "1.16.15-beta-04d1e821",
29
+ "@blocklet/constant": "1.16.15-beta-933eb977",
30
+ "@blocklet/meta": "1.16.15-beta-933eb977",
31
31
  "@ocap/mcrypto": "1.18.89",
32
32
  "@ocap/util": "1.18.89",
33
33
  "@ocap/wallet": "1.18.89",
@@ -43,5 +43,5 @@
43
43
  "devDependencies": {
44
44
  "jest": "^27.5.1"
45
45
  },
46
- "gitHead": "42e1523e5b92a3a57d9083ae29455df429afb0f6"
46
+ "gitHead": "d98826a347c05fb1c3dc50a44d8d492290c406ad"
47
47
  }