workstation.md 0.2.0 → 0.3.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.
- package/bin/workstation.js +11 -3
- package/package.json +1 -1
package/bin/workstation.js
CHANGED
|
@@ -57,19 +57,27 @@ function signWithSSHKey(keyPath, data) {
|
|
|
57
57
|
}
|
|
58
58
|
async function create(args) {
|
|
59
59
|
let pubkey;
|
|
60
|
+
let name;
|
|
60
61
|
for (let i = 0; i < args.length; i++) {
|
|
61
62
|
if (args[i] === "--pubkey" && args[i + 1]) {
|
|
62
63
|
pubkey = args[i + 1];
|
|
63
64
|
i++;
|
|
64
65
|
}
|
|
66
|
+
else if (args[i] === "--name" && args[i + 1]) {
|
|
67
|
+
name = args[i + 1];
|
|
68
|
+
i++;
|
|
69
|
+
}
|
|
65
70
|
}
|
|
66
71
|
if (!pubkey) {
|
|
67
|
-
console.error("Usage: workstation create --pubkey <public_key>");
|
|
72
|
+
console.error("Usage: workstation create --pubkey <public_key> [--name <name>]");
|
|
68
73
|
process.exit(1);
|
|
69
74
|
}
|
|
75
|
+
const body = { pubkey };
|
|
76
|
+
if (name)
|
|
77
|
+
body.name = name;
|
|
70
78
|
const info = await apiRequest("/create", {
|
|
71
79
|
method: "POST",
|
|
72
|
-
body: JSON.stringify(
|
|
80
|
+
body: JSON.stringify(body),
|
|
73
81
|
});
|
|
74
82
|
console.log(JSON.stringify(info, null, 2));
|
|
75
83
|
}
|
|
@@ -101,7 +109,7 @@ async function list() {
|
|
|
101
109
|
}
|
|
102
110
|
function usage() {
|
|
103
111
|
console.log(`Usage:
|
|
104
|
-
workstation create --pubkey <
|
|
112
|
+
workstation create --pubkey <key> [--name <name>] Create a workstation (24h TTL)
|
|
105
113
|
workstation <id> destroy Destroy a workstation
|
|
106
114
|
workstation <id> extend [--key <path>] Extend TTL by 24h (proves key ownership)
|
|
107
115
|
workstation list List active workstations`);
|