mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
951a89e91e
Add execCommand options to opt into keyboard-interactive auth and wire MFA only for export-key flows, preserving non-interactive exec usage elsewhere. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
29 lines
883 B
TypeScript
29 lines
883 B
TypeScript
import { useCallback } from "react";
|
|
import { netcattyBridge } from "../../infrastructure/services/netcattyBridge";
|
|
|
|
export const useKeychainBackend = () => {
|
|
const generateKeyPair = useCallback(async (options: { type: "RSA" | "ECDSA" | "ED25519"; bits?: number; comment?: string }) => {
|
|
const bridge = netcattyBridge.get();
|
|
return bridge?.generateKeyPair?.(options);
|
|
}, []);
|
|
|
|
const execCommand = useCallback(async (options: {
|
|
hostname: string;
|
|
username: string;
|
|
port?: number;
|
|
password?: string;
|
|
privateKey?: string;
|
|
command: string;
|
|
timeout?: number;
|
|
enableKeyboardInteractive?: boolean;
|
|
sessionId?: string;
|
|
}) => {
|
|
const bridge = netcattyBridge.get();
|
|
if (!bridge?.execCommand) throw new Error("execCommand unavailable");
|
|
return bridge.execCommand(options);
|
|
}, []);
|
|
|
|
return { generateKeyPair, execCommand };
|
|
};
|
|
|