@abtnode/auth 1.16.25-next-1e779575 → 1.16.25-next-3d78a4cb
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 +8 -1
- package/lib/server.js +13 -6
- package/lib/util/get-auth-method.js +24 -7
- package/locales/ar.js +3 -0
- package/locales/de.js +3 -0
- package/locales/en.js +3 -1
- package/locales/es.js +3 -0
- package/locales/fr.js +3 -0
- package/locales/hi.js +3 -0
- package/locales/i18n.db +0 -0
- package/locales/id.js +3 -0
- package/locales/ja.js +3 -0
- package/locales/ko.js +3 -0
- package/locales/pt.js +3 -0
- package/locales/ru.js +3 -0
- package/locales/th.js +3 -0
- package/locales/vi.js +3 -0
- package/locales/zh-tw.js +3 -0
- package/locales/zh.js +3 -0
- package/package.json +9 -9
package/lib/auth.js
CHANGED
|
@@ -100,7 +100,8 @@ const messages = {
|
|
|
100
100
|
nftAlreadyUsed: getLocaleMap('nftAlreadyUsed'),
|
|
101
101
|
missingNftClaim: getLocaleMap('missingNftClaim'),
|
|
102
102
|
noNft: getLocaleMap('noNft'),
|
|
103
|
-
|
|
103
|
+
noLauncherDid: getLocaleMap('noLauncherDid'),
|
|
104
|
+
noNftDid: getLocaleMap('noNftDid'),
|
|
104
105
|
noChainHost: getLocaleMap('noChainHost'),
|
|
105
106
|
alreadyTransferred: getLocaleMap('alreadyTransferred'),
|
|
106
107
|
delegateTransferOwnerNFT: getLocaleMap('delegateTransferOwnerNFT'),
|
|
@@ -176,6 +177,12 @@ const messages = {
|
|
|
176
177
|
zh: (message) => `通行证状态检测失败:${message}`,
|
|
177
178
|
'zh-TW': (message) => `通行證狀態檢測失敗:${message}`,
|
|
178
179
|
},
|
|
180
|
+
/**
|
|
181
|
+
*
|
|
182
|
+
* @param {Parameters<typeof getLocaleMap>[1]} data
|
|
183
|
+
* @returns
|
|
184
|
+
*/
|
|
185
|
+
cannotImportFromDidSpace: (data) => getLocaleMap('cannotImportFromDidSpace', data),
|
|
179
186
|
};
|
|
180
187
|
|
|
181
188
|
const PASSPORT_STATUS_KEY = 'passport-status';
|
package/lib/server.js
CHANGED
|
@@ -520,19 +520,25 @@ const getOwnershipNFTClaim = async (node, locale) => {
|
|
|
520
520
|
throw new Error(messages.noNft[locale]);
|
|
521
521
|
}
|
|
522
522
|
|
|
523
|
-
const
|
|
523
|
+
const launcherDid = get(info, 'launcher.did', '');
|
|
524
|
+
const nftDid = get(info, 'launcher.nftDid', '');
|
|
524
525
|
const chainHost = get(info, 'launcher.chainHost', '');
|
|
525
|
-
if (!
|
|
526
|
-
throw new Error(messages.
|
|
526
|
+
if (!launcherDid) {
|
|
527
|
+
throw new Error(messages.noLauncherDid[locale]);
|
|
527
528
|
}
|
|
529
|
+
|
|
530
|
+
if (!nftDid) {
|
|
531
|
+
throw new Error(messages.noNftDid[locale]);
|
|
532
|
+
}
|
|
533
|
+
|
|
528
534
|
if (!chainHost) {
|
|
529
535
|
throw new Error(messages.noChainHost[locale]);
|
|
530
536
|
}
|
|
531
537
|
|
|
532
538
|
return {
|
|
533
539
|
description: messages.requestBlockletSpaceNFT[locale],
|
|
534
|
-
trustedIssuers: [
|
|
535
|
-
address:
|
|
540
|
+
trustedIssuers: [launcherDid],
|
|
541
|
+
address: nftDid,
|
|
536
542
|
};
|
|
537
543
|
};
|
|
538
544
|
|
|
@@ -960,7 +966,8 @@ const createServerlessInstallGuard = (node) => {
|
|
|
960
966
|
}
|
|
961
967
|
|
|
962
968
|
// check if launcher session consumed
|
|
963
|
-
|
|
969
|
+
// 只在 launch serverless 时校验 launch session 的合法性
|
|
970
|
+
if (launcherUrl && launcherSessionId && info.mode === NODE_MODES.SERVERLESS) {
|
|
964
971
|
if (await node.isLauncherSessionConsumed({ launcherUrl, launcherSessionId })) {
|
|
965
972
|
throw new Error(messages.sessionAlreadyConsumed[locale]);
|
|
966
973
|
}
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
const get = require('lodash/get');
|
|
2
2
|
|
|
3
|
+
const isServerLaunchedByLauncher = (info) =>
|
|
4
|
+
get(info, 'ownerNft.holder') &&
|
|
5
|
+
get(info, 'ownerNft.issuer') &&
|
|
6
|
+
get(info, 'launcher.tag') &&
|
|
7
|
+
get(info, 'launcher.chainHost') &&
|
|
8
|
+
get(info, 'launcher.did') === get(info, 'ownerNft.issuer');
|
|
9
|
+
|
|
3
10
|
const getServerAuthMethod = (info, type, launcherSessionId = '', authorized = false) => {
|
|
4
11
|
if (launcherSessionId) {
|
|
12
|
+
/*
|
|
13
|
+
* 需要用户提供 Ownership NFT 的情况:
|
|
14
|
+
* - 通过 Blocklet Launcher Launch
|
|
15
|
+
* - Server 是通过 Blocklet Launcher Launch 的
|
|
16
|
+
* - Server 没有初始化
|
|
17
|
+
*/
|
|
18
|
+
if (isServerLaunchedByLauncher(info) && !info.initialized && type !== 'serverless') {
|
|
19
|
+
return 'nft';
|
|
20
|
+
}
|
|
21
|
+
|
|
5
22
|
return 'launcher';
|
|
6
23
|
}
|
|
7
24
|
|
|
@@ -17,13 +34,13 @@ const getServerAuthMethod = (info, type, launcherSessionId = '', authorized = fa
|
|
|
17
34
|
return 'vc';
|
|
18
35
|
}
|
|
19
36
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
) {
|
|
37
|
+
/*
|
|
38
|
+
* 下面的情况也需要提供 NFT
|
|
39
|
+
* - 没有 launcherSessionId
|
|
40
|
+
* - Blocklet Server 没有初始化
|
|
41
|
+
* - Blocklet Server 是通过 Blocklet Launcher Launch
|
|
42
|
+
*/
|
|
43
|
+
if (isServerLaunchedByLauncher(info)) {
|
|
27
44
|
return 'nft';
|
|
28
45
|
}
|
|
29
46
|
|
package/locales/ar.js
CHANGED
|
@@ -65,4 +65,7 @@ module.exports = {
|
|
|
65
65
|
tagRequired: 'العلامة مطلوبة',
|
|
66
66
|
appIsInProgress: 'التطبيق قيد التقدم، يرجى الانتظار حتى الانتهاء.',
|
|
67
67
|
requestDidSpace: 'يرجى تفويض مساحة DID للاستمرار',
|
|
68
|
+
cannotImportFromDidSpace: 'غير قادر على إيجاد بيانات من الفضاء({spaceName}) التي يمكن استيرادها',
|
|
69
|
+
noLauncherDid: 'لم يتم العثور على المشغّل من معلومات مشغّل الخادم',
|
|
70
|
+
noNftDid: 'لم يتم العثور على NFT من معلومات مشغل الخادم',
|
|
68
71
|
};
|
package/locales/de.js
CHANGED
|
@@ -65,4 +65,7 @@ module.exports = {
|
|
|
65
65
|
tagRequired: 'Es ist ein Pflichtfeld',
|
|
66
66
|
appIsInProgress: 'Die Anwendung befindet sich in Bearbeitung. Bitte warten Sie, bis sie abgeschlossen ist.',
|
|
67
67
|
requestDidSpace: 'Bitte autorisieren Sie DID Space, um fortzufahren',
|
|
68
|
+
cannotImportFromDidSpace: 'Kann keine Daten aus dem Bereich({spaceName}) finden, die importiert werden können',
|
|
69
|
+
noLauncherDid: 'Launcher wurde nicht von der Server Launcher Info gefunden',
|
|
70
|
+
noNftDid: 'NFT wurde in den Server-Launcher-Informationen nicht gefunden',
|
|
68
71
|
};
|
package/locales/en.js
CHANGED
|
@@ -57,7 +57,8 @@ module.exports = {
|
|
|
57
57
|
nftAlreadyUsed: 'This NFT has already been connected to another user',
|
|
58
58
|
missingNftClaim: 'Ownership NFT not provided',
|
|
59
59
|
noNft: 'This server is not initialized to accept ownership NFT',
|
|
60
|
-
|
|
60
|
+
noLauncherDid: 'Launcher DID not found from server launcher info',
|
|
61
|
+
noNftDid: 'NFT DID not found from server launcher info',
|
|
61
62
|
noChainHost: 'chainHost not found from server launcher info',
|
|
62
63
|
alreadyTransferred: 'The Blocklet Server already belongs to {owner}',
|
|
63
64
|
delegateTransferOwnerNFT:
|
|
@@ -65,4 +66,5 @@ module.exports = {
|
|
|
65
66
|
notAllowedTransferToSelf: 'Not allowed to transfer the Server to yourself',
|
|
66
67
|
tagRequired: 'tag is required',
|
|
67
68
|
appIsInProgress: 'The application is in progress, please wait for it to finish',
|
|
69
|
+
cannotImportFromDidSpace: 'Unable to find data from space({spaceName}) that can be imported',
|
|
68
70
|
};
|
package/locales/es.js
CHANGED
|
@@ -65,4 +65,7 @@ module.exports = {
|
|
|
65
65
|
tagRequired: 'La etiqueta es requerida',
|
|
66
66
|
appIsInProgress: 'La aplicación está en progreso, por favor espere a que termine',
|
|
67
67
|
requestDidSpace: 'Por favor, autoriza a DID Space para continuar',
|
|
68
|
+
cannotImportFromDidSpace: 'No se pueden encontrar datos para importar desde el espacio ({spaceName})',
|
|
69
|
+
noLauncherDid: 'El lanzador NO fue encontrado en la información del lanzador del servidor',
|
|
70
|
+
noNftDid: 'NFT DID no encontrada en el lanzador del servidor',
|
|
68
71
|
};
|
package/locales/fr.js
CHANGED
|
@@ -66,4 +66,7 @@ module.exports = {
|
|
|
66
66
|
tagRequired: 'Les balises sont obligatoires',
|
|
67
67
|
appIsInProgress: "L'application est en cours, veuillez attendre qu'elle se termine.",
|
|
68
68
|
requestDidSpace: 'Veuillez autoriser DID Space à continuer',
|
|
69
|
+
cannotImportFromDidSpace: "Impossible de trouver des données de l'espace({spaceName}) pouvant être importées",
|
|
70
|
+
noLauncherDid: "Launcher n'a pas été trouvé depuis les informations du serveur Launcher",
|
|
71
|
+
noNftDid: 'Aucun NFT trouvé dans les informations du lanceur de serveur',
|
|
69
72
|
};
|
package/locales/hi.js
CHANGED
|
@@ -65,4 +65,7 @@ module.exports = {
|
|
|
65
65
|
tagRequired: 'टैग आवश्यक है',
|
|
66
66
|
appIsInProgress: 'ऐप्लीकेशन प्रगति में है, कृपया पूरा होने तक प्रतीक्षा करें।',
|
|
67
67
|
requestDidSpace: 'कृपया DID स्थान की प्राधिकरणदिये जारी रखें',
|
|
68
|
+
cannotImportFromDidSpace: 'डेटास्पेस({spaceName}) से आयात किए जा सकने वाले डेटा को खोजने में असमर्थ',
|
|
69
|
+
noLauncherDid: 'Launcher सर्वर लॉन्चर जानकारी से नहीं मिला',
|
|
70
|
+
noNftDid: 'NFT सर्वर लॉन्चर जानकारी से नहीं मिला',
|
|
68
71
|
};
|
package/locales/i18n.db
CHANGED
|
Binary file
|
package/locales/id.js
CHANGED
|
@@ -65,4 +65,7 @@ module.exports = {
|
|
|
65
65
|
tagRequired: 'Tag diperlukan',
|
|
66
66
|
appIsInProgress: 'Aplikasi ini sedang berjalan, mohon tunggu hingga selesai',
|
|
67
67
|
requestDidSpace: 'Silakan otorisasi DID Space untuk melanjutkan',
|
|
68
|
+
cannotImportFromDidSpace: 'Tidak dapat menemukan data dari ruang({spaceName}) yang dapat diimport',
|
|
69
|
+
noLauncherDid: 'Launcher TIDAK ditemukan dari info launcher server',
|
|
70
|
+
noNftDid: 'NFT DID tidak ditemukan dari info peluncur server',
|
|
68
71
|
};
|
package/locales/ja.js
CHANGED
|
@@ -65,4 +65,7 @@ module.exports = {
|
|
|
65
65
|
tagRequired: 'タグは必須です',
|
|
66
66
|
appIsInProgress: 'アプリケーションは進行中です。完了するまでお待ちください',
|
|
67
67
|
requestDidSpace: '続行するためにDID Spaceへの承認をお願いします',
|
|
68
|
+
cannotImportFromDidSpace: 'スペース ({spaceName}) からインポートできるデータが見つかりません',
|
|
69
|
+
noLauncherDid: 'ランチャーがサーバーランチャー情報から見つかりませんでした',
|
|
70
|
+
noNftDid: 'NFT DID がサーバーランチャー情報から見つかりませんでした',
|
|
68
71
|
};
|
package/locales/ko.js
CHANGED
|
@@ -65,4 +65,7 @@ module.exports = {
|
|
|
65
65
|
tagRequired: '태그가 필요합니다',
|
|
66
66
|
appIsInProgress: '애플리케이션 진행 중입니다. 완료될 때까지 기다려주세요',
|
|
67
67
|
requestDidSpace: '계속하려면 DID Space를 인증해주세요',
|
|
68
|
+
cannotImportFromDidSpace: '공간({spaceName})에서 가져올 수 있는 데이터를 찾을 수 없습니다.',
|
|
69
|
+
noLauncherDid: '서버 런처 정보에서 런처를 찾지 못했습니다',
|
|
70
|
+
noNftDid: '서버 런처 정보에서 NFT DID를 찾지 못했습니다',
|
|
68
71
|
};
|
package/locales/pt.js
CHANGED
|
@@ -65,4 +65,7 @@ module.exports = {
|
|
|
65
65
|
tagRequired: 'A tag é necessária',
|
|
66
66
|
appIsInProgress: 'O aplicativo está em progresso, por favor, aguarde até que ele termine',
|
|
67
67
|
requestDidSpace: 'Por favor, autorize o DID Space a continuar',
|
|
68
|
+
cannotImportFromDidSpace: 'Não é possível encontrar dados do espaço({spaceName}) que podem ser importados',
|
|
69
|
+
noLauncherDid: 'Launcher NÃO foi encontrado nas informações do Launcher do servidor',
|
|
70
|
+
noNftDid: 'NFT DID não encontrado nas informações do iniciador do servidor',
|
|
68
71
|
};
|
package/locales/ru.js
CHANGED
|
@@ -65,4 +65,7 @@ module.exports = {
|
|
|
65
65
|
tagRequired: 'Требуется тег',
|
|
66
66
|
appIsInProgress: 'Приложение находится в процессе, пожалуйста, подождите, пока оно закончится.',
|
|
67
67
|
requestDidSpace: 'Пожалуйста, авторизуйте DID Space для продолжения',
|
|
68
|
+
cannotImportFromDidSpace: 'Не удалось найти данные в пространстве({spaceName}), которые можно импортировать',
|
|
69
|
+
noLauncherDid: 'Laucnher не был найден в информации о запуске сервера',
|
|
70
|
+
noNftDid: 'NFT не найден в информации о запускающем сервере',
|
|
68
71
|
};
|
package/locales/th.js
CHANGED
|
@@ -65,4 +65,7 @@ module.exports = {
|
|
|
65
65
|
tagRequired: 'ต้องใส่แท็ก',
|
|
66
66
|
appIsInProgress: 'แอปพลิเคชันกำลังดำเนินการ โปรดรอให้เสร็จสิ้น',
|
|
67
67
|
requestDidSpace: 'โปรดอนุญาตให้ DID Space ดำเนินการต่อ',
|
|
68
|
+
cannotImportFromDidSpace: 'ไม่สามารถค้นหาข้อมูลจากพื้นที่({spaceName}) ที่สามารถนำเข้า',
|
|
69
|
+
noLauncherDid: 'Launcher หาไม่พบจากข้อมูล launcher ของ server',
|
|
70
|
+
noNftDid: 'ไม่พบ NFT DID จากข้อมูลตัวเปิดใช้เซิร์ฟเวอร์',
|
|
68
71
|
};
|
package/locales/vi.js
CHANGED
|
@@ -65,4 +65,7 @@ module.exports = {
|
|
|
65
65
|
tagRequired: 'Tag là bắt buộc',
|
|
66
66
|
appIsInProgress: 'Ứng dụng đang tiến hành, vui lòng đợi cho đến khi nó hoàn thành',
|
|
67
67
|
requestDidSpace: 'Vui lòng cho phép DID Space tiếp tục',
|
|
68
|
+
cannotImportFromDidSpace: 'Không tìm thấy dữ liệu từ khoảng không({spaceName}) có thể nhập',
|
|
69
|
+
noLauncherDid: 'Launcher KHÔNG tìm thấy từ thông tin launcher của máy chủ',
|
|
70
|
+
noNftDid: 'NFT DID không tìm thấy từ thông tin trình khởi chạy máy chủ',
|
|
68
71
|
};
|
package/locales/zh-tw.js
CHANGED
|
@@ -63,4 +63,7 @@ module.exports = {
|
|
|
63
63
|
tagRequired: '需要標籤',
|
|
64
64
|
appIsInProgress: '應用程式正在進行中,請等待完成',
|
|
65
65
|
requestDidSpace: '請授權DID Space繼續',
|
|
66
|
+
cannotImportFromDidSpace: '無法找到可從空間 ({spaceName}) 匯入的資料',
|
|
67
|
+
noLauncherDid: '從伺服器啟動器資訊中沒有發現啟動器',
|
|
68
|
+
noNftDid: 'NFT DID 沒有在伺服器啟動程式資訊中找到',
|
|
66
69
|
};
|
package/locales/zh.js
CHANGED
|
@@ -63,4 +63,7 @@ module.exports = {
|
|
|
63
63
|
notAllowedTransferToSelf: '不能将节点转移给自己',
|
|
64
64
|
tagRequired: 'tag 不能为空',
|
|
65
65
|
appIsInProgress: '应用正在进行中,请等待完成',
|
|
66
|
+
cannotImportFromDidSpace: '无法从 DID Space({spaceName}) 中找到可以导入的数据',
|
|
67
|
+
noLauncherDid: '从服务器启动器信息中没有发现启动器',
|
|
68
|
+
noNftDid: 'NFT DID 没有在服务器启动程序信息中找到',
|
|
66
69
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.25-next-
|
|
6
|
+
"version": "1.16.25-next-3d78a4cb",
|
|
7
7
|
"description": "Simple lib to manage auth in ABT Node",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -20,17 +20,17 @@
|
|
|
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.25-next-
|
|
24
|
-
"@abtnode/logger": "1.16.25-next-
|
|
25
|
-
"@abtnode/util": "1.16.25-next-
|
|
23
|
+
"@abtnode/constant": "1.16.25-next-3d78a4cb",
|
|
24
|
+
"@abtnode/logger": "1.16.25-next-3d78a4cb",
|
|
25
|
+
"@abtnode/util": "1.16.25-next-3d78a4cb",
|
|
26
26
|
"@arcblock/did": "1.18.113",
|
|
27
27
|
"@arcblock/jwt": "^1.18.113",
|
|
28
|
-
"@arcblock/nft-display": "^2.9.
|
|
28
|
+
"@arcblock/nft-display": "^2.9.60",
|
|
29
29
|
"@arcblock/validator": "^1.18.113",
|
|
30
30
|
"@arcblock/vc": "1.18.113",
|
|
31
|
-
"@blocklet/constant": "1.16.25-next-
|
|
32
|
-
"@blocklet/meta": "1.16.25-next-
|
|
33
|
-
"@blocklet/sdk": "1.16.25-next-
|
|
31
|
+
"@blocklet/constant": "1.16.25-next-3d78a4cb",
|
|
32
|
+
"@blocklet/meta": "1.16.25-next-3d78a4cb",
|
|
33
|
+
"@blocklet/sdk": "1.16.25-next-3d78a4cb",
|
|
34
34
|
"@ocap/client": "^1.18.113",
|
|
35
35
|
"@ocap/mcrypto": "1.18.113",
|
|
36
36
|
"@ocap/util": "1.18.113",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"jest": "^29.7.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "26b43891e46756b142bcd6b62c57357c7c23cf2f"
|
|
55
55
|
}
|