@nmshd/connector-tui 2.0.1 → 2.1.0
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.
|
@@ -62,7 +62,8 @@ export function AddShareRequestByTemplate(Base) {
|
|
|
62
62
|
if (result.includeName)
|
|
63
63
|
request.items.push(sharedAttributes);
|
|
64
64
|
request.items.push(requestedAttributes);
|
|
65
|
-
await this.
|
|
65
|
+
const passwordProtection = await this.createPasswordProtection();
|
|
66
|
+
await this.createQRCodeForRelationshipTemplate(request, name, passwordProtection);
|
|
66
67
|
}
|
|
67
68
|
async getOrCreateConnectorDisplayName(displayName) {
|
|
68
69
|
const response = await this.connectorClient.attributes.getValidAttributes({
|
|
@@ -89,7 +90,49 @@ export function AddShareRequestByTemplate(Base) {
|
|
|
89
90
|
});
|
|
90
91
|
return createAttributeResponse.result;
|
|
91
92
|
}
|
|
92
|
-
async
|
|
93
|
+
async createPasswordProtection() {
|
|
94
|
+
const result = await prompts({
|
|
95
|
+
message: "What kind of password protection do you want to use?",
|
|
96
|
+
type: "select",
|
|
97
|
+
name: "passwordProtection",
|
|
98
|
+
choices: [
|
|
99
|
+
{ title: "None", value: "None", selected: true },
|
|
100
|
+
{ title: "Password", value: "Password" },
|
|
101
|
+
{ title: "PIN", value: "PIN" },
|
|
102
|
+
],
|
|
103
|
+
});
|
|
104
|
+
if (result.passwordProtection === "None")
|
|
105
|
+
return;
|
|
106
|
+
if (result.passwordProtection === "Password") {
|
|
107
|
+
const password = await prompts({
|
|
108
|
+
message: "Enter the password",
|
|
109
|
+
type: "text",
|
|
110
|
+
validate: (value) => {
|
|
111
|
+
if (value.length < 1)
|
|
112
|
+
return "Password must have at least 1 character";
|
|
113
|
+
return true;
|
|
114
|
+
},
|
|
115
|
+
name: "password",
|
|
116
|
+
});
|
|
117
|
+
return { password: password.password };
|
|
118
|
+
}
|
|
119
|
+
const password = await prompts({
|
|
120
|
+
message: "Enter the PIN",
|
|
121
|
+
type: "text",
|
|
122
|
+
validate: (value) => {
|
|
123
|
+
if (!/^\d+$/.test(value))
|
|
124
|
+
return "PIN must only contain digits";
|
|
125
|
+
if (value.length < 4)
|
|
126
|
+
return "PIN must have at least 4 digits";
|
|
127
|
+
if (value.length > 16)
|
|
128
|
+
return "PIN must have at most 16 digits";
|
|
129
|
+
return true;
|
|
130
|
+
},
|
|
131
|
+
name: "password",
|
|
132
|
+
});
|
|
133
|
+
return { password: password.password, passwordIsPin: true };
|
|
134
|
+
}
|
|
135
|
+
async createQRCodeForRelationshipTemplate(request, name, passwordProtection) {
|
|
93
136
|
const content = {
|
|
94
137
|
"@type": "RelationshipTemplateContent",
|
|
95
138
|
title: `Kontaktanfrage mit ${name}`,
|
|
@@ -101,6 +144,7 @@ export function AddShareRequestByTemplate(Base) {
|
|
|
101
144
|
const template = await this.connectorClient.relationshipTemplates.createOwnRelationshipTemplate({
|
|
102
145
|
content,
|
|
103
146
|
expiresAt: DateTime.now().plus({ days: 2 }).toISO(),
|
|
147
|
+
passwordProtection,
|
|
104
148
|
});
|
|
105
149
|
const url = `nmshd://tr#${template.result.truncatedReference}`;
|
|
106
150
|
console.log(url);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nmshd/connector-tui",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"repository": "github:nmshd/connector-tui",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "j&s-soft GmbH",
|
|
@@ -28,26 +28,26 @@
|
|
|
28
28
|
"watch": "node --watch --import 'data:text/javascript,import { register } from \"node:module\"; import { pathToFileURL } from \"node:url\"; register(\"ts-node/esm\", pathToFileURL(\"./\"));' src/index.ts"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@nmshd/connector-sdk": "^6.
|
|
31
|
+
"@nmshd/connector-sdk": "^6.7.0",
|
|
32
32
|
"chalk": "^5.3.0",
|
|
33
|
-
"dotenv": "^16.4.
|
|
33
|
+
"dotenv": "^16.4.7",
|
|
34
34
|
"luxon": "^3.5.0",
|
|
35
35
|
"prompts": "^2.4.2",
|
|
36
36
|
"qrcode-terminal": "^0.12.0",
|
|
37
37
|
"yargs": "^17.7.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@js-soft/eslint-config-ts": "^1.6.
|
|
40
|
+
"@js-soft/eslint-config-ts": "^1.6.13",
|
|
41
41
|
"@js-soft/license-check": "^1.0.9",
|
|
42
42
|
"@types/luxon": "^3.4.2",
|
|
43
|
-
"@types/node": "^22.
|
|
43
|
+
"@types/node": "^22.10.1",
|
|
44
44
|
"@types/prompts": "^2.4.9",
|
|
45
45
|
"@types/qrcode-terminal": "^0.12.2",
|
|
46
46
|
"@types/yargs": "^17.0.33",
|
|
47
47
|
"eslint": "^8.57.0",
|
|
48
|
-
"prettier": "^3.
|
|
48
|
+
"prettier": "^3.4.2",
|
|
49
49
|
"ts-node": "^10.9.2",
|
|
50
|
-
"typescript": "^5.
|
|
50
|
+
"typescript": "^5.7.2"
|
|
51
51
|
},
|
|
52
52
|
"engines": {
|
|
53
53
|
"node": ">=19.0.0"
|