MCPcopy Index your code
hub / github.com/coder/mux / parseHostKeyPrompt

Function parseHostKeyPrompt

src/node/runtime/sshAskpass.ts:54–68  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

52
53/** Parse host/keyType/fingerprint from OpenSSH output. */
54export function parseHostKeyPrompt(text: string): {
55 host: string;
56 keyType: string;
57 fingerprint: string;
58 prompt: string;
59} {
60 const hostMatch = /authenticity of host '([^']+)'/.exec(text);
61 const keyMatch = /(\w+) key fingerprint is (SHA256:\S+)/.exec(text);
62 return {
63 host: hostMatch?.[1] ?? "unknown",
64 keyType: keyMatch?.[1] ?? "unknown",
65 fingerprint: keyMatch?.[2] ?? "unknown",
66 prompt: text.trim(),
67 };
68}
69
70export interface AskpassSession {
71 /** Merge into the spawn env: { ...process.env, ...env } */

Callers 2

sshAskpass.test.tsFile · 0.90

Calls 1

execMethod · 0.65

Tested by

no test coverage detected