(error: unknown)
| 225 | } |
| 226 | |
| 227 | function 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 | } |
| 252 | async function resolvePrivateKeys(identityFiles: string[]): Promise<Buffer[]> { |
| 253 | const keys: Buffer[] = []; |
| 254 |
no test coverage detected