@abtnode/auth 1.16.21-beta-2e75c75c → 1.16.21-beta-da3f852a
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 +119 -250
- package/lib/auth.test.js +27 -0
- package/package.json +9 -8
package/lib/auth.js
CHANGED
|
@@ -26,6 +26,7 @@ const { LOGIN_PROVIDER } = require('@blocklet/constant');
|
|
|
26
26
|
|
|
27
27
|
const logger = require('./logger');
|
|
28
28
|
const verifySignature = require('./util/verify-signature');
|
|
29
|
+
const { getLocaleMap } = require('../locales');
|
|
29
30
|
const {
|
|
30
31
|
createPassport,
|
|
31
32
|
createPassportVC,
|
|
@@ -37,274 +38,142 @@ const {
|
|
|
37
38
|
const createPassportSvg = require('./util/create-passport-svg');
|
|
38
39
|
|
|
39
40
|
const messages = {
|
|
40
|
-
description:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
requestNFT: {
|
|
49
|
-
en: 'Please present NFT to exchange for passport',
|
|
50
|
-
zh: '请提供 NFT 以换取通行证',
|
|
51
|
-
},
|
|
52
|
-
requestCredential: {
|
|
53
|
-
en: 'Please provide credential',
|
|
54
|
-
zh: '请提供凭证',
|
|
55
|
-
},
|
|
56
|
-
requestPassport: {
|
|
57
|
-
en: 'Please provide passport',
|
|
58
|
-
zh: '请提供通行证',
|
|
59
|
-
},
|
|
60
|
-
requestOwnerPassport: {
|
|
61
|
-
en: 'Please provide owner passport',
|
|
62
|
-
zh: '请提供节点的所有者通行证',
|
|
63
|
-
},
|
|
64
|
-
requestBlockletNft: {
|
|
65
|
-
en: 'Please provide Blocklet Purchase NFT',
|
|
66
|
-
zh: '请提供 Blocklet Purchase NFT',
|
|
67
|
-
},
|
|
68
|
-
receivePassport: {
|
|
69
|
-
en: 'Please sign the text to get passport',
|
|
70
|
-
ah: '请对文本签名以获取通行证',
|
|
71
|
-
},
|
|
41
|
+
description: getLocaleMap('description'),
|
|
42
|
+
requestProfile: getLocaleMap('requestProfile'),
|
|
43
|
+
requestNFT: getLocaleMap('requestNFT'),
|
|
44
|
+
requestCredential: getLocaleMap('requestCredential'),
|
|
45
|
+
requestPassport: getLocaleMap('requestPassport'),
|
|
46
|
+
requestOwnerPassport: getLocaleMap('requestOwnerPassport'),
|
|
47
|
+
requestBlockletNft: getLocaleMap('requestBlockletNft'),
|
|
48
|
+
receivePassport: getLocaleMap('receivePassport'),
|
|
72
49
|
|
|
73
50
|
// error
|
|
74
|
-
actionForbidden:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
51
|
+
actionForbidden: getLocaleMap('actionForbidden'),
|
|
52
|
+
|
|
53
|
+
notInitialized: getLocaleMap('notInitialized'),
|
|
54
|
+
appNotInitialized: getLocaleMap('appNotInitialized'),
|
|
55
|
+
alreadyInitiated: getLocaleMap('alreadyInitiated'),
|
|
56
|
+
notAllowed: getLocaleMap('notAllowed'),
|
|
57
|
+
notAppOwner: getLocaleMap('notAppOwner'),
|
|
58
|
+
notSupported: getLocaleMap('notSupported'),
|
|
59
|
+
missingCredentialClaim: getLocaleMap('missingCredentialClaim'),
|
|
60
|
+
missingBlockletCredentialClaim: getLocaleMap('missingBlockletCredentialClaim'),
|
|
61
|
+
missingChallenge: getLocaleMap('missingChallenge'),
|
|
62
|
+
invalidCredentialHolder: getLocaleMap('invalidCredentialHolder'),
|
|
63
|
+
invalidCredentialProof: getLocaleMap('invalidCredentialProof'),
|
|
64
|
+
notOwner: getLocaleMap('notOwner'),
|
|
65
|
+
userMismatch: getLocaleMap('userMismatch'),
|
|
66
|
+
lowVersion: getLocaleMap('lowVersion'),
|
|
67
|
+
|
|
68
|
+
unKnownStatus: getLocaleMap('unKnownStatus'),
|
|
69
|
+
statusNotFound: getLocaleMap('statusNotFound'),
|
|
70
|
+
statusLabel: getLocaleMap('statusLabel'),
|
|
71
|
+
passportNotFound: getLocaleMap('passportNotFound'),
|
|
72
|
+
userNotFound: getLocaleMap('userNotFound'),
|
|
73
|
+
notAuthorized: getLocaleMap('notAuthorized'),
|
|
74
|
+
invalidParams: getLocaleMap('invalidParams'),
|
|
75
|
+
missingKeyPair: getLocaleMap('missingKeyPair'),
|
|
76
|
+
missingBlockletUrl: getLocaleMap('missingBlockletUrl'),
|
|
77
|
+
missingBlockletDid: getLocaleMap('missingBlockletDid'),
|
|
78
|
+
missingChainHost: getLocaleMap('missingChainHost'),
|
|
79
|
+
missingLauncherSession: getLocaleMap('missingLauncherSession'),
|
|
80
|
+
invalidBlocklet: getLocaleMap('invalidBlocklet'),
|
|
81
|
+
blockletExists: getLocaleMap('blockletExists'),
|
|
82
|
+
invalidBlockletVc: getLocaleMap('invalidBlockletVc'),
|
|
83
|
+
invalidAppVersion: getLocaleMap('invalidAppVersion'),
|
|
78
84
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
en: 'Credential is not provided',
|
|
105
|
-
zh: '请提供凭证',
|
|
106
|
-
},
|
|
107
|
-
missingBlockletCredentialClaim: {
|
|
108
|
-
en: 'Blocklet credential is not provided',
|
|
109
|
-
zh: '请提供 Blocklet 凭证',
|
|
110
|
-
},
|
|
111
|
-
missingChallenge: {
|
|
112
|
-
en: 'Credential presentation does not include valid challenge',
|
|
113
|
-
zh: '凭证中缺少正确的随机因子',
|
|
114
|
-
},
|
|
85
|
+
// NFT related
|
|
86
|
+
missingProfileClaim: getLocaleMap('missingProfileClaim'),
|
|
87
|
+
invalidNftClaim: getLocaleMap('invalidNftClaim'),
|
|
88
|
+
invalidNft: getLocaleMap('invalidNft'),
|
|
89
|
+
invalidNftHolder: getLocaleMap('invalidNftHolder'),
|
|
90
|
+
invalidNftProof: getLocaleMap('invalidNftProof'),
|
|
91
|
+
invalidNftIssuer: getLocaleMap('invalidNftIssuer'),
|
|
92
|
+
invalidNftParent: getLocaleMap('invalidNftParent'),
|
|
93
|
+
tagNotMatch: getLocaleMap('tagNotMatch'),
|
|
94
|
+
requestBlockletSpaceNFT: getLocaleMap('requestBlockletSpaceNFT'),
|
|
95
|
+
blockletSpaceNftIdRequired: getLocaleMap('blockletSpaceNftIdRequired'),
|
|
96
|
+
nftAlreadyConsumed: getLocaleMap('nftAlreadyConsumed'),
|
|
97
|
+
sessionAlreadyConsumed: getLocaleMap('sessionAlreadyConsumed'),
|
|
98
|
+
nftAlreadyExpired: getLocaleMap('nftAlreadyExpired'),
|
|
99
|
+
nftAlreadyUsed: getLocaleMap('nftAlreadyUsed'),
|
|
100
|
+
missingNftClaim: getLocaleMap('missingNftClaim'),
|
|
101
|
+
noNft: getLocaleMap('noNft'),
|
|
102
|
+
noTag: getLocaleMap('noTag'),
|
|
103
|
+
noChainHost: getLocaleMap('noChainHost'),
|
|
104
|
+
alreadyTransferred: getLocaleMap('alreadyTransferred'),
|
|
105
|
+
delegateTransferOwnerNFT: getLocaleMap('delegateTransferOwnerNFT'),
|
|
106
|
+
notAllowedTransferToSelf: getLocaleMap('notAllowedTransferToSelf'),
|
|
107
|
+
tagRequired: getLocaleMap('tagRequired'),
|
|
108
|
+
appIsInProgress: getLocaleMap('appIsInProgress'),
|
|
109
|
+
// 以后新增的文本尽量使用 `hello {name}` 的模版方式, 而不是函数
|
|
115
110
|
invalidCredentialType: {
|
|
111
|
+
ar: (types) => `نوع الاعتماد غير صالح ، يتوقع ${types.join(' أو ')}`,
|
|
112
|
+
de: (types) => `Ungültiger Anmeldeinformationstyp, erwarte ${types.join(' oder ')}`,
|
|
113
|
+
es: (types) => `Tipo de credencial no válido, espera ${types.join(' o ')}`,
|
|
116
114
|
en: (types) => `Invalid credential type, expect ${types.join(' or ')}`,
|
|
115
|
+
fr: (types) => `Type de justificatif invalide, attendre ${types.join(' ou ')}`,
|
|
116
|
+
hi: (types) => `अमान्य प्रमाणीकरण प्रकार, ${types.join(' या ')}`,
|
|
117
|
+
id: (types) => `Jenis kredensial tidak valid, harap ${types.join(' atau ')}`,
|
|
118
|
+
ja: (types) => `無効な資格情報タイプ、${types.join(' または ')}`,
|
|
119
|
+
ko: (types) => `잘못된 자격 증명 유형, ${types.join(' 또는 ')}`,
|
|
120
|
+
pt: (types) => `Tipo de credencial inválido, espera ${types.join(' ou ')}`,
|
|
121
|
+
ru: (types) => `Неверный тип учетных данных, ожидается ${types.join(' или ')}`,
|
|
122
|
+
th: (types) => `ประเภทข้อมูลประจำตัวไม่ถูกต้อง ต้องการ ${types.join(' หรือ ')}`,
|
|
123
|
+
vi: (types) => `Loại chứng chỉ không hợp lệ, mong đợi ${types.join(' hoặc ')}`,
|
|
117
124
|
zh: (types) => `无效的凭证类型,必须是 ${types.join(' 或 ')}`,
|
|
125
|
+
'zh-TW': (types) => `無效的憑證類型,必須是 ${types.join(' 或 ')}`,
|
|
118
126
|
},
|
|
119
127
|
invalidCredentialId: {
|
|
128
|
+
ar: (ids) => `المعرف غير صالح: ${[].concat(ids).join(' أو ')}`,
|
|
129
|
+
de: (ids) => `Ungültige ID: ${[].concat(ids).join(' oder ')}`,
|
|
120
130
|
en: (ids) => `Invalid credential type, expect ${[].concat(ids).join(' or ')}`,
|
|
131
|
+
es: (ids) => `ID no válida: ${[].concat(ids).join(' o ')}`,
|
|
132
|
+
fr: (ids) => `ID non valide: ${[].concat(ids).join(' ou ')}`,
|
|
133
|
+
hi: (ids) => `अमान्य परिचय: ${[].concat(ids).join(' या ')}`,
|
|
134
|
+
id: (ids) => `ID tidak valid: ${[].concat(ids).join(' atau ')}`,
|
|
135
|
+
ja: (ids) => `無効なID:${[].concat(ids).join('または')}`,
|
|
136
|
+
ko: (ids) => `잘못된 ID: ${[].concat(ids).join(' 또는 ')}`,
|
|
137
|
+
pt: (ids) => `ID inválido: ${[].concat(ids).join(' ou ')}`,
|
|
138
|
+
ru: (ids) => `Неверный идентификатор: ${[].concat(ids).join(' или ')}`,
|
|
139
|
+
th: (ids) => `รหัสไม่ถูกต้อง: ${[].concat(ids).join(' หรือ ')}`,
|
|
140
|
+
vi: (ids) => `ID không hợp lệ: ${[].concat(ids).join(' hoặc ')}`,
|
|
121
141
|
zh: (ids) => `无效的凭证,ID 必须是 ${[].concat(ids).join(' 或 ')}`,
|
|
122
|
-
|
|
123
|
-
invalidCredentialHolder: {
|
|
124
|
-
en: 'Invalid credential holder',
|
|
125
|
-
zh: '无效的凭证持有者',
|
|
126
|
-
},
|
|
127
|
-
invalidCredentialProof: {
|
|
128
|
-
en: 'Invalid credential signature proof',
|
|
129
|
-
zh: '无效的凭证签名',
|
|
142
|
+
'zh-TW': (ids) => `無效的憑證,ID 必須是 ${[].concat(ids).join(' 或 ')}`,
|
|
130
143
|
},
|
|
131
144
|
passportRevoked: {
|
|
145
|
+
ar: (title, issuer) => `تم إلغاء جواز السفر ${title} من قبل ${issuer ? ' ' : ''}${issuer || ''}`,
|
|
146
|
+
de: (title, issuer) => `Pass ${title} wurde von ${issuer ? ' ' : ''}${issuer || ''} widerrufen`,
|
|
147
|
+
es: (title, issuer) => `Pasaporte ${title} ha sido revocado por ${issuer ? ' ' : ''}${issuer || ''}`,
|
|
132
148
|
en: (title, issuer) => `Passport ${title} has been revoked${issuer ? ' by ' : ''}${issuer || ''}`,
|
|
149
|
+
fr: (title, issuer) => `Le passeport ${title} a été révoqué par ${issuer ? ' ' : ''}${issuer || ''}`,
|
|
150
|
+
hi: (title, issuer) => `पासपोर्ट ${title} को ${issuer ? ' ' : ''}${issuer || ''} द्वारा रद्द कर दिया गया है`,
|
|
151
|
+
id: (title, issuer) => `Paspor ${title} telah dicabut oleh ${issuer ? ' ' : ''}${issuer || ''}`,
|
|
152
|
+
ja: (title, issuer) => `パスポート ${title} は ${issuer ? ' ' : ''}${issuer || ''} によって取り消されました`,
|
|
153
|
+
ko: (title, issuer) => `여권 ${title} 은 ${issuer ? ' ' : ''}${issuer || ''} 에 의해 취소되었습니다`,
|
|
154
|
+
pt: (title, issuer) => `O passaporte ${title} foi revogado por ${issuer ? ' ' : ''}${issuer || ''}`,
|
|
155
|
+
ru: (title, issuer) => `Паспорт ${title} был отозван ${issuer ? ' ' : ''}${issuer || ''}`,
|
|
156
|
+
th: (title, issuer) => `หนังสือเดินทาง ${title} ถูกยกเลิกโดย ${issuer ? ' ' : ''}${issuer || ''}`,
|
|
157
|
+
vi: (title, issuer) => `Hộ chiếu ${title} đã bị thu hồi bởi ${issuer ? ' ' : ''}${issuer || ''}`,
|
|
133
158
|
zh: (title, issuer) => `通行证 ${title} 已被${issuer ? ' ' : ''}${issuer || ''}${issuer ? ' ' : ''}吊销`,
|
|
134
|
-
|
|
135
|
-
notOwner: {
|
|
136
|
-
en: 'The account does not match the owner account of this passport, please use the DID wallet that contains the owner account of this passport to receive.',
|
|
137
|
-
zh: '该账号与此通行证的所有者账号不匹配,请使用包含此通行证所有者账号的 DID 钱包领取。',
|
|
138
|
-
},
|
|
139
|
-
userMismatch: {
|
|
140
|
-
en: 'User mismatch, please use connected DID wallet to continue.',
|
|
141
|
-
zh: '用户不匹配,请使用当前会话连接的钱包操作',
|
|
142
|
-
},
|
|
143
|
-
lowVersion: {
|
|
144
|
-
en: 'Your DID wallet version is too low, please upgrade to the latest version',
|
|
145
|
-
zh: '你的 DID 钱包版本过低,请升级至最新版本',
|
|
159
|
+
'zh-TW': (title, issuer) => `通行證 ${title} 已被${issuer ? ' ' : ''}${issuer || ''}${issuer ? ' ' : ''}吊銷`,
|
|
146
160
|
},
|
|
147
161
|
passportStatusCheckFailed: {
|
|
162
|
+
ar: (message) => `فشلت عملية التحقق من حالة جواز السفر: ${message}`,
|
|
163
|
+
de: (message) => `Passport-Statusprüfung fehlgeschlagen: ${message}`,
|
|
164
|
+
es: (message) => `Error al verificar el estado del pasaporte: ${message}`,
|
|
148
165
|
en: (message) => `Passport status check failed: ${message}`,
|
|
166
|
+
fr: (message) => `Échec de la vérification du statut du passeport: ${message}`,
|
|
167
|
+
hi: (message) => `पासपोर्ट स्थिति जांच विफल: ${message}`,
|
|
168
|
+
id: (message) => `Pemeriksaan status paspor gagal: ${message}`,
|
|
169
|
+
ja: (message) => `パスポートのステータスチェックに失敗しました:${message}`,
|
|
170
|
+
ko: (message) => `여권 상태 확인 실패 : ${message}`,
|
|
171
|
+
pt: (message) => `Falha na verificação do status do passaporte: ${message}`,
|
|
172
|
+
ru: (message) => `Ошибка проверки статуса паспорта: ${message}`,
|
|
173
|
+
th: (message) => `การตรวจสอบสถานะหนังสือเดินทางล้มเหลว: ${message}`,
|
|
174
|
+
vi: (message) => `Kiểm tra trạng thái hộ chiếu không thành công: ${message}`,
|
|
149
175
|
zh: (message) => `通行证状态检测失败:${message}`,
|
|
150
|
-
|
|
151
|
-
unKnownStatus: {
|
|
152
|
-
en: 'unknown status',
|
|
153
|
-
zh: '未知的状态',
|
|
154
|
-
},
|
|
155
|
-
statusNotFound: {
|
|
156
|
-
en: 'status not found',
|
|
157
|
-
zh: '未找到状态',
|
|
158
|
-
},
|
|
159
|
-
statusLabel: {
|
|
160
|
-
en: 'Status',
|
|
161
|
-
zh: '状态',
|
|
162
|
-
},
|
|
163
|
-
passportNotFound: {
|
|
164
|
-
en: 'Passport not found',
|
|
165
|
-
zh: '未找到通行证',
|
|
166
|
-
},
|
|
167
|
-
userNotFound: {
|
|
168
|
-
en: 'User not found',
|
|
169
|
-
zh: '用户不存在',
|
|
170
|
-
},
|
|
171
|
-
notAuthorized: {
|
|
172
|
-
en: '没有执行此操作的权限',
|
|
173
|
-
zh: 'No permission to perform this operation',
|
|
174
|
-
},
|
|
175
|
-
invalidParams: {
|
|
176
|
-
en: 'Invalid Params',
|
|
177
|
-
zh: '无效的参数',
|
|
178
|
-
},
|
|
179
|
-
missingKeyPair: {
|
|
180
|
-
en: 'Missing app key pair',
|
|
181
|
-
zh: '缺少应用钥匙对',
|
|
182
|
-
},
|
|
183
|
-
missingBlockletUrl: {
|
|
184
|
-
en: 'Missing blocklet url',
|
|
185
|
-
zh: '缺少应用下载地址',
|
|
186
|
-
},
|
|
187
|
-
missingBlockletDid: {
|
|
188
|
-
en: 'Missing blocklet did',
|
|
189
|
-
zh: '缺少应用 DID',
|
|
190
|
-
},
|
|
191
|
-
missingChainHost: {
|
|
192
|
-
en: 'Missing chain host',
|
|
193
|
-
zh: '缺少链的端点地址',
|
|
194
|
-
},
|
|
195
|
-
missingLauncherSession: {
|
|
196
|
-
en: 'Missing launcherUrl and launcherSessionId',
|
|
197
|
-
zh: '缺少启动器会话参数',
|
|
198
|
-
},
|
|
199
|
-
invalidBlocklet: {
|
|
200
|
-
en: 'Invalid Blocklet',
|
|
201
|
-
zh: '无效的 Blocklet',
|
|
202
|
-
},
|
|
203
|
-
blockletExists: {
|
|
204
|
-
en: 'The blocklet already exists',
|
|
205
|
-
zh: '应用已安装',
|
|
206
|
-
},
|
|
207
|
-
invalidBlockletVc: {
|
|
208
|
-
en: 'Invalid Blocklet VC',
|
|
209
|
-
zh: '无效的 Blocklet VC',
|
|
210
|
-
},
|
|
211
|
-
invalidAppVersion: {
|
|
212
|
-
en: 'App key-pair rotating can only be performed on the latest version',
|
|
213
|
-
zh: '只有最新版应用可以变更钥匙对',
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
// NFT related
|
|
217
|
-
missingProfileClaim: {
|
|
218
|
-
en: 'Owner profile not provided',
|
|
219
|
-
zh: '节点所有者信息必须提供',
|
|
220
|
-
},
|
|
221
|
-
invalidNftClaim: {
|
|
222
|
-
en: 'Invalid Asset Claim: ownerPk, ownerDid and ownerProof are required',
|
|
223
|
-
zh: '无效的 NFT Claim:ownerPk、ownerDid、ownerProof 是必填的',
|
|
224
|
-
},
|
|
225
|
-
invalidNft: {
|
|
226
|
-
en: 'Invalid server ownership NFT state',
|
|
227
|
-
zh: '无效的节点所有权 NFT',
|
|
228
|
-
},
|
|
229
|
-
invalidNftHolder: {
|
|
230
|
-
en: 'Invalid server ownership NFT holder',
|
|
231
|
-
zh: '无效的节点所有权 NFT 持有者',
|
|
232
|
-
},
|
|
233
|
-
invalidNftProof: {
|
|
234
|
-
en: 'Invalid server ownership NFT signature proof',
|
|
235
|
-
zh: '无效的节点所有权 NFT 签名',
|
|
236
|
-
},
|
|
237
|
-
invalidNftIssuer: {
|
|
238
|
-
en: 'Invalid server ownership NFT issuer',
|
|
239
|
-
zh: '无效的节点所有权 NFT 颁发者',
|
|
240
|
-
},
|
|
241
|
-
invalidNftParent: {
|
|
242
|
-
en: 'Unexpected NFT Collection',
|
|
243
|
-
zh: '无效的 NFT 集合',
|
|
244
|
-
},
|
|
245
|
-
tagNotMatch: {
|
|
246
|
-
en: 'This NFT is for another blocklet server',
|
|
247
|
-
zh: '您所提供的所有权 NFT 不属于当前节点',
|
|
248
|
-
},
|
|
249
|
-
requestBlockletSpaceNFT: {
|
|
250
|
-
en: 'Please provide Blocklet Space NFT',
|
|
251
|
-
zh: '请提供应用空间 NFT',
|
|
252
|
-
},
|
|
253
|
-
blockletSpaceNftIdRequired: {
|
|
254
|
-
en: 'Blocklet Space NFT ID is required',
|
|
255
|
-
zh: '应用空间 NFT ID 是必须的',
|
|
256
|
-
},
|
|
257
|
-
nftAlreadyConsumed: {
|
|
258
|
-
en: 'This NFT has already been used',
|
|
259
|
-
zh: '该 NFT 已经被使用过了',
|
|
260
|
-
},
|
|
261
|
-
sessionAlreadyConsumed: {
|
|
262
|
-
en: 'This session has already been used',
|
|
263
|
-
zh: '该会话已经被使用过了',
|
|
264
|
-
},
|
|
265
|
-
nftAlreadyExpired: {
|
|
266
|
-
en: 'This NFT has expired',
|
|
267
|
-
zh: '该 NFT 已经过期',
|
|
268
|
-
},
|
|
269
|
-
nftAlreadyUsed: {
|
|
270
|
-
en: 'This NFT has already been connected to another user',
|
|
271
|
-
zh: '该 NFT 已经被起它用户使用过',
|
|
272
|
-
},
|
|
273
|
-
missingNftClaim: {
|
|
274
|
-
en: 'Ownership NFT not provided',
|
|
275
|
-
zh: '节点所有权 NFT 必须提供',
|
|
276
|
-
},
|
|
277
|
-
noNft: {
|
|
278
|
-
en: 'This server is not initialized to accept ownership NFT',
|
|
279
|
-
zh: '该节点不能用这种方式成为管理员',
|
|
280
|
-
},
|
|
281
|
-
noTag: {
|
|
282
|
-
en: 'Tag not found from server launcher info',
|
|
283
|
-
zh: '节点初始化信息异常:缺少标签',
|
|
284
|
-
},
|
|
285
|
-
noChainHost: {
|
|
286
|
-
en: 'chainHost not found from server launcher info',
|
|
287
|
-
zh: '节点初始化信息异常:缺少链地址',
|
|
288
|
-
},
|
|
289
|
-
alreadyTransferred: {
|
|
290
|
-
en: 'The Blocklet Server already belongs to {owner}',
|
|
291
|
-
zh: '该节点已经属于 {owner}',
|
|
292
|
-
},
|
|
293
|
-
delegateTransferOwnerNFT: {
|
|
294
|
-
en: 'Sign the delegation transaction to authorize blocklet server to transfer your ownership NFT to new owner when he/she claims the transfer.',
|
|
295
|
-
zh: '签名下面的交易以授权节点转移所有权以及代表所有权的 NFT。',
|
|
296
|
-
},
|
|
297
|
-
notAllowedTransferToSelf: {
|
|
298
|
-
en: 'Not allowed to transfer the Server to yourself',
|
|
299
|
-
zh: '不能将节点转移给自己',
|
|
300
|
-
},
|
|
301
|
-
tagRequired: {
|
|
302
|
-
en: 'tag is required',
|
|
303
|
-
zh: 'tag 不能为空',
|
|
304
|
-
},
|
|
305
|
-
appIsInProgress: {
|
|
306
|
-
en: 'The application is in progress, please wait for it to finish',
|
|
307
|
-
zh: '应用正在进行中,请等待完成',
|
|
176
|
+
'zh-TW': (message) => `通行證狀態檢測失敗:${message}`,
|
|
308
177
|
},
|
|
309
178
|
};
|
|
310
179
|
|
package/lib/auth.test.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const { messages } = require('./auth');
|
|
2
|
+
|
|
3
|
+
const funcKeys = {
|
|
4
|
+
invalidCredentialType: 1,
|
|
5
|
+
invalidCredentialId: 1,
|
|
6
|
+
passportRevoked: 1,
|
|
7
|
+
passportStatusCheckFailed: 1,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
describe('auth messages has key', () => {
|
|
11
|
+
const keys = Object.keys(messages);
|
|
12
|
+
// ensure all keys have values
|
|
13
|
+
test('auth messages has key', () => {
|
|
14
|
+
keys.forEach((key) => {
|
|
15
|
+
const localMap = messages[key];
|
|
16
|
+
expect(localMap).toBeDefined();
|
|
17
|
+
['en', 'zh', 'ja'].forEach((language) => {
|
|
18
|
+
if (funcKeys[key]) {
|
|
19
|
+
expect(typeof localMap[language]).toEqual('function');
|
|
20
|
+
} else {
|
|
21
|
+
expect(typeof localMap[language]).toEqual('string');
|
|
22
|
+
expect(localMap[language].length > 0).toBeTruthy();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
});
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.21-beta-
|
|
6
|
+
"version": "1.16.21-beta-da3f852a",
|
|
7
7
|
"description": "Simple lib to manage auth in ABT Node",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -20,17 +20,18 @@
|
|
|
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.21-beta-
|
|
24
|
-
"@abtnode/logger": "1.16.21-beta-
|
|
25
|
-
"@abtnode/util": "1.16.21-beta-
|
|
23
|
+
"@abtnode/constant": "1.16.21-beta-da3f852a",
|
|
24
|
+
"@abtnode/logger": "1.16.21-beta-da3f852a",
|
|
25
|
+
"@abtnode/util": "1.16.21-beta-da3f852a",
|
|
26
26
|
"@arcblock/did": "1.18.108",
|
|
27
|
-
"@arcblock/nft-display": "2.9.
|
|
27
|
+
"@arcblock/nft-display": "2.9.2",
|
|
28
28
|
"@arcblock/vc": "1.18.108",
|
|
29
|
-
"@blocklet/constant": "1.16.21-beta-
|
|
30
|
-
"@blocklet/meta": "1.16.21-beta-
|
|
29
|
+
"@blocklet/constant": "1.16.21-beta-da3f852a",
|
|
30
|
+
"@blocklet/meta": "1.16.21-beta-da3f852a",
|
|
31
31
|
"@ocap/mcrypto": "1.18.108",
|
|
32
32
|
"@ocap/util": "1.18.108",
|
|
33
33
|
"@ocap/wallet": "1.18.108",
|
|
34
|
+
"flat": "^5.0.2",
|
|
34
35
|
"fs-extra": "^10.1.0",
|
|
35
36
|
"joi": "17.11.0",
|
|
36
37
|
"jsonwebtoken": "^9.0.0",
|
|
@@ -43,5 +44,5 @@
|
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"jest": "^27.5.1"
|
|
45
46
|
},
|
|
46
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "57b315bdb59f2125c5f0595d5cb21c92196710ba"
|
|
47
48
|
}
|