@vex-chat/cli 0.5.0 → 0.6.1
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/package.json +2 -2
- package/src/vex-chat.js +20 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vex-chat/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Terminal client for vex-chat.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"better-sqlite3": "11.10.0",
|
|
33
33
|
"msgpackr": "^1.11.9",
|
|
34
|
-
"@vex-chat/libvex": "^
|
|
34
|
+
"@vex-chat/libvex": "^10.0.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^25.6.0",
|
package/src/vex-chat.js
CHANGED
|
@@ -607,7 +607,12 @@ function removedStoredDeviceError(ctx, username) {
|
|
|
607
607
|
return err;
|
|
608
608
|
}
|
|
609
609
|
|
|
610
|
-
async function resolveRegistrationPassword(
|
|
610
|
+
async function resolveRegistrationPassword(
|
|
611
|
+
ctx,
|
|
612
|
+
args,
|
|
613
|
+
rl = null,
|
|
614
|
+
missingMessage = "Password is required to register a new account. Usage: vex auth register <username> <password> or pass --password <password>.",
|
|
615
|
+
) {
|
|
611
616
|
const provided = args[1] ?? ctx.password;
|
|
612
617
|
if (typeof provided === "string" && provided.trim().length > 0) {
|
|
613
618
|
return provided;
|
|
@@ -626,9 +631,7 @@ async function resolveRegistrationPassword(ctx, args, rl = null) {
|
|
|
626
631
|
}
|
|
627
632
|
}
|
|
628
633
|
}
|
|
629
|
-
throw new Error(
|
|
630
|
-
"Password is required to register a new account. Usage: vex auth register <username> <password> or pass --password <password>.",
|
|
631
|
-
);
|
|
634
|
+
throw new Error(missingMessage);
|
|
632
635
|
}
|
|
633
636
|
|
|
634
637
|
async function register(ctx, args) {
|
|
@@ -878,11 +881,20 @@ async function loginWithDeviceApproval(ctx, username) {
|
|
|
878
881
|
}
|
|
879
882
|
|
|
880
883
|
const { username: accountUsername } = accountRef;
|
|
884
|
+
const password = await resolveRegistrationPassword(
|
|
885
|
+
ctx,
|
|
886
|
+
[accountUsername],
|
|
887
|
+
null,
|
|
888
|
+
"Password is required to sign in on a new device. Pass it as the second argument or with --password.",
|
|
889
|
+
);
|
|
881
890
|
const privateKey = Client.generateSecretKey();
|
|
882
891
|
const client = await Client.create(privateKey, ctx.clientOptions);
|
|
883
892
|
attachDebugClientEvents(ctx, client, `login-request:${accountUsername}`);
|
|
884
893
|
try {
|
|
885
|
-
const [, registerErr] = await client.
|
|
894
|
+
const [, registerErr] = await client.requestDeviceEnrollment(
|
|
895
|
+
accountUsername,
|
|
896
|
+
password,
|
|
897
|
+
);
|
|
886
898
|
if (!registerErr) {
|
|
887
899
|
await persistNewLocalAccount(
|
|
888
900
|
ctx,
|
|
@@ -956,9 +968,7 @@ async function waitForDeviceApproval(
|
|
|
956
968
|
}
|
|
957
969
|
|
|
958
970
|
const code = matchingCodeStringForSignKey(client.getKeys().public);
|
|
959
|
-
console.log(
|
|
960
|
-
`${color(ROOT_ACCENT, "device approval required")} ${color("dim", `request=${pending.requestID}`)}`,
|
|
961
|
-
);
|
|
971
|
+
console.log(color(ROOT_ACCENT, "device approval required"));
|
|
962
972
|
console.log(
|
|
963
973
|
`${color("dim", "matching code")} ${formatDeviceApprovalCode(code)}`,
|
|
964
974
|
);
|
|
@@ -4591,12 +4601,7 @@ main()
|
|
|
4591
4601
|
.then(() => {
|
|
4592
4602
|
process.exit(0);
|
|
4593
4603
|
})
|
|
4594
|
-
.catch((
|
|
4595
|
-
console.error(
|
|
4596
|
-
color(
|
|
4597
|
-
ROOT_ACCENT,
|
|
4598
|
-
err instanceof Error ? err.message : String(err),
|
|
4599
|
-
),
|
|
4600
|
-
);
|
|
4604
|
+
.catch(() => {
|
|
4605
|
+
console.error(color(ROOT_ACCENT, "Vex command failed."));
|
|
4601
4606
|
process.exit(1);
|
|
4602
4607
|
});
|