@abtnode/auth 1.4.14 → 1.5.3

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.
Files changed (2) hide show
  1. package/lib/auth.js +31 -1
  2. package/package.json +11 -11
package/lib/auth.js CHANGED
@@ -36,6 +36,10 @@ const messages = {
36
36
  en: 'Please provide passport',
37
37
  zh: '请提供通行证',
38
38
  },
39
+ requestBlockletNft: {
40
+ en: 'Please provide Blocklet Purchase NFT',
41
+ zh: '请提供 Blocklet Purchase NFT',
42
+ },
39
43
  receivePassport: {
40
44
  en: 'Please sign the text to get passport',
41
45
  ah: '请对文本签名以获取通行证',
@@ -59,6 +63,10 @@ const messages = {
59
63
  en: 'Credential is not provided',
60
64
  zh: '请提供凭证',
61
65
  },
66
+ missingBlockletCredentialClaim: {
67
+ en: 'Blocklet credential is not provided',
68
+ zh: '请提供 Blocklet 凭证',
69
+ },
62
70
  missingChallenge: {
63
71
  en: 'Credential presentation does not include valid challenge',
64
72
  zh: '凭证中缺少正确的随机因子',
@@ -111,6 +119,26 @@ const messages = {
111
119
  en: 'User not found',
112
120
  zh: '用户不存在',
113
121
  },
122
+ notAuthorized: {
123
+ en: '没有执行此操作的权限',
124
+ zh: 'No permission to perform this operation',
125
+ },
126
+ invalidParams: {
127
+ en: 'Invalid Params',
128
+ zh: '无效的参数',
129
+ },
130
+ invalidBlocklet: {
131
+ en: 'Invalid Blocklet',
132
+ zh: '无效的 Blocklet',
133
+ },
134
+ blockletExists: {
135
+ en: 'The blocklet already exists',
136
+ zh: '应用已安装',
137
+ },
138
+ invalidBlockletVc: {
139
+ en: 'Invalid Blocklet VC',
140
+ zh: '无效的 Blocklet VC',
141
+ },
114
142
  };
115
143
 
116
144
  const PASSPORT_STATUS_KEY = 'passport-status';
@@ -451,7 +479,9 @@ const handleIssuePassportResponse = async ({
451
479
  };
452
480
 
453
481
  const getVCFromClaims = async ({ claims, challenge, trustedIssuers, vcTypes, locale = 'en' }) => {
454
- const credential = claims.find((x) => x.type === 'verifiableCredential');
482
+ const credential = claims.find(
483
+ (x) => x.type === 'verifiableCredential' && vcTypes.some((item) => x.item.includes(item))
484
+ );
455
485
 
456
486
  if (!credential || !credential.presentation) {
457
487
  return {};
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.4.14",
6
+ "version": "1.5.3",
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.4.14",
24
- "@abtnode/logger": "1.4.14",
25
- "@abtnode/util": "1.4.14",
26
- "@arcblock/did": "^1.13.15",
27
- "@arcblock/vc": "^1.13.15",
28
- "@blocklet/meta": "1.4.14",
29
- "@ocap/mcrypto": "^1.13.15",
30
- "@ocap/util": "^1.13.15",
31
- "@ocap/wallet": "^1.13.15",
23
+ "@abtnode/constant": "1.5.3",
24
+ "@abtnode/logger": "1.5.3",
25
+ "@abtnode/util": "1.5.3",
26
+ "@arcblock/did": "^1.13.27",
27
+ "@arcblock/vc": "^1.13.27",
28
+ "@blocklet/meta": "1.5.3",
29
+ "@ocap/mcrypto": "^1.13.27",
30
+ "@ocap/util": "^1.13.27",
31
+ "@ocap/wallet": "^1.13.27",
32
32
  "axios": "^0.21.4",
33
33
  "joi": "^17.4.0",
34
34
  "jsonwebtoken": "^8.5.1",
@@ -39,5 +39,5 @@
39
39
  "devDependencies": {
40
40
  "jest": "^26.4.2"
41
41
  },
42
- "gitHead": "9176b462ff92c787e18a8b218f06a451aad4cf1d"
42
+ "gitHead": "31e38c299c61c2a33caa93ed6a74d6e901409295"
43
43
  }