Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
`${strong(prettyPath(keyPath))} does not appear to exist. Please specify a valid SSH private key.\n` +
`If you are having issues, try using ${input('ionic ssh setup')}.`
);
} else if (e === ERROR_SSH_INVALID_PRIVKEY) {
throw new FatalException(
`${strong(prettyPath(keyPath))} does not appear to be a valid SSH private key. (Missing '-----BEGIN RSA PRIVATE KEY-----' header.)\n` +
`If you are having issues, try using ${input('ionic ssh setup')}.`
);
} else {
throw e;
}
}
const { SSHConfig } = await import('../../lib/ssh-config');
const sshConfigPath = getConfigPath();
const text1 = await fileToString(sshConfigPath);
const conf = SSHConfig.parse(text1);
ensureHostAndKeyPath(conf, { host: this.env.config.getGitHost(), port: this.env.config.getGitPort() }, keyPath);
const text2 = SSHConfig.stringify(conf);
if (text1 === text2) {
this.env.log.msg(`${strong(prettyPath(keyPath))} is already your active SSH key.`);
return;
} else {
const { diffPatch } = await import('../../lib/diff');
const diff = await diffPatch(sshConfigPath, text1, text2);
this.env.log.rawmsg(diff);
const confirm = await this.env.prompt({
type: 'confirm',
name: 'confirm',
export async function loadFromPath(p: string): Promise {
const s = await fileToString(p);
return SSHConfig.parse(s);
}