fix: ask for a push/TOTP menu choice as text instead of a push confirm

This commit is contained in:
LukeGus committed 2026-10-07 16:40:18 -05:00
1 parent 42c5682243
commit 1466c7bcab
2 files changed
+34 -6

No files matched your search

@@ -556,6 +556,30 @@ describe("ctx.auth", () => {
).not.toBe("browser");
});
it("asks for a push/TOTP menu choice as text and a press-enter confirm as a push", () => {
const host = { id: 1, ip: "10.0.0.1", port: 22, username: "root" };
expect(
classifyKeyboardInteractive(
{
name: "",
instructions: "",
prompts: [{ prompt: "Choose [1] Push, or [2] TOTP: ", echo: true }],
},
host,
),
).toEqual({ kind: "input", promptIndex: 0, isPush: false });
expect(
classifyKeyboardInteractive(
{
name: "",
instructions: "",
prompts: [{ prompt: "Press enter to send push", echo: false }],
},
host,
),
).toEqual({ kind: "input", promptIndex: 0, isPush: true });
});
it("refuses a keyboard-interactive handler that is not declared", () => {
const auth = createPluginAuth({
manifest: manifest(["auth:provide"], { keyboardInteractive: ["gate"] }),