Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise {
const keyPath = path.resolve(options['key-path'] ? String(options['key-path']) : 'id_rsa');
const pubkeyPath = path.resolve(options['pubkey-path'] ? String(options['pubkey-path']) : 'id_rsa.pub');
const tasks = new TaskChain();
tasks.next('generating ssh keys');
const req = this.env.client.make('POST', '/apps/sshkeys/generate').send({});
const res = await this.env.client.do(req);
if (!isSSHGenerateResponse(res)) {
throw 'todo'; // TODO
}
tasks.next('writing ssh keys');
await Promise.all([
fsWriteFile(keyPath, res.data.key),
fsWriteFile(pubkeyPath, res.data.pubkey)
]);