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

Function isEncryptedKeyError

src/node/runtime/SSH2ConnectionPool.ts:214–225  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

212 * We treat these as auth failures so the retry loop can skip the key and try agent-only.
213 */
214function 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
227function isAuthFailure(error: unknown): boolean {
228 if (!error) {

Callers 1

isAuthFailureFunction · 0.85

Calls 1

errorMessageTextFunction · 0.85

Tested by

no test coverage detected