MCPcopy
hub / github.com/coder/mux / isAuthFailure

Function isAuthFailure

src/node/runtime/SSH2ConnectionPool.ts:227–251  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

225}
226
227function isAuthFailure(error: unknown): boolean {
228 if (!error) {
229 return false;
230 }
231
232 // Encrypted key without passphrase should be treated as auth failure
233 // so we can fall back to agent-only authentication.
234 if (isEncryptedKeyError(error)) {
235 return true;
236 }
237
238 if (typeof error === "object" && error !== null && "level" in error) {
239 const level = (error as { level?: string }).level;
240 if (level === "client-authentication") {
241 return true;
242 }
243 }
244
245 const message = errorMessageText(error);
246 return (
247 message.includes("All configured authentication methods failed") ||
248 message.includes("Authentication failed") ||
249 message.includes("Authentication failure")
250 );
251}
252async function resolvePrivateKeys(identityFiles: string[]): Promise<Buffer[]> {
253 const keys: Buffer[] = [];
254

Callers 3

connectWithKeyMethod · 0.85
attemptConnectionMethod · 0.85
connectMethod · 0.85

Calls 2

isEncryptedKeyErrorFunction · 0.85
errorMessageTextFunction · 0.85

Tested by

no test coverage detected