Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

204
Vistas
ssh-keygen npm package gives undefined public and private keys

Output for the keys is undefined for both private and public key [ssh-keygen][1]

Keys created!

private key: undefined
public key: undefined

async generateAndWriteSSHKeyv2() {
return new Promise((resolve, reject) => {

    let t = new Date().getTime();
    var location = path.join(process.cwd(), `contents/apps/SSHkeys/key_${t}`);
    var comment = 'test';
    var password = 'test';
    var format = 'PEM';
    keygen({
        location: location,
        comment: comment,
        password: password,
        read: true,
        destroy: false,
        format: format,
        size: 4096,
    }, (err, output) => {
        if (err) resolve(console.log('Something went wrong: ' + err));
        console.log('Keys created!');
        console.log('private key: ' + output.key);
        console.log('public key: ' + output.pubKey);
        resolve({
            location,
            comment,
            password,
            read: true,
            format,
            size: 4096,
            output
        })
    });
})
};
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I have found this example, for you to compare with your own code

  generateSshKeyFiles(name, next) {
    keygen({
      location: name,
      read: true,
      destroy: true,
    }, function(err, out) {
      if (err) {
        next(err);
      } else {
        let sshKeyFiles = [{'content': out.pubKey, 'fileName': name+'.pub'}, {'content': out.key, 'fileName': name}];
        next(null, sshKeyFiles);
      }
    });
  }

Check if you get the same kind of error message with that type of function.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda