index.js
function generateKeyPair (pub, prv) {
  try {
    mkdirp.sync(path.dirname(pub))
    mkdirp.sync(path.dirname(prv))

    childProcess.execFileSync('openssl', [
      'genrsa',
      '-out',
      prv,
      '4096'
    ], {
      stdio: 'ignore'
    })

    childProcess.execFileSync('openssl', [
      'rsa',
      '-pubout',
      '-in',
      prv,
      '-out',
      pub
    ], {
      stdio: 'ignore'
    })
  } catch (e) {
    throw new Error(
      'Failed to generate keys using OpenSSL. Please ensure you have OpenSSL ' +
      'installed and configured on your system.'
    )
  }
}
function generateKeyPair (pub, prv) {
  try {
    mkdirp.sync(path.dirname(pub))
    mkdirp.sync(path.dirname(prv))

    childProcess.execFileSync('openssl', [
      'genrsa',
      '-out',
      prv,
      '4096'
    ], {
      stdio: 'ignore'
    })

    childProcess.execFileSync('openssl', [
      'rsa',
      '-pubout',
      '-in',
      prv,
      '-out',
      pub
    ], {
      stdio: 'ignore'
    })
  } catch (e) {
    throw new Error(
      'Failed to generate keys using OpenSSL. Please ensure you have OpenSSL ' +
      'installed and configured on your system.'
    )
  }
}
function generateKeyPair ( pub , prv ) { try { mkdirp . sync ( path . dirname ( pub ) ) mkdirp . sync ( path . dirname ( prv ) ) childProcess . execFileSync ( 'openssl' , [ 'genrsa' , '-out' , prv , '4096' ] , { stdio : 'ignore' } ) childProcess . execFileSync ( 'openssl' , [ 'rsa' , '-pubout' , '-in' , prv , '-out' , pub ] , { stdio : 'ignore' } ) } catch ( e ) { throw new Error ( 'Failed to generate keys using OpenSSL. Please ensure you have OpenSSL ' + 'installed and configured on your system.' ) } }
Generate single key pair
Generate single key pair