* Detect if error is due to encrypted key without passphrase. * ssh2 throws parse errors like "Cannot parse privateKey: Encrypted private OpenSSH key detected, * but no passphrase given" when encountering encrypted keys without a passphrase. * We treat these as auth failures so the retry loop can
(error: unknown)
| 212 | * We treat these as auth failures so the retry loop can skip the key and try agent-only. |
| 213 | */ |
| 214 | function isEncryptedKeyError(error: unknown): boolean { |
| 215 | if (!error) { |
| 216 | return false; |
| 217 | } |
| 218 | const message = errorMessageText(error); |
| 219 | return ( |
| 220 | message.includes("Encrypted private key detected") || |
| 221 | message.includes("Encrypted private OpenSSH key detected") || |
| 222 | message.includes("Encrypted PPK private key detected") || |
| 223 | (message.includes("Cannot parse privateKey") && message.includes("ncrypted")) |
| 224 | ); |
| 225 | } |
| 226 | |
| 227 | function isAuthFailure(error: unknown): boolean { |
| 228 | if (!error) { |
no test coverage detected