diff --git a/bin/32/msys-2.0.dll b/bin/32/msys-2.0.dll new file mode 100644 index 0000000..d194356 Binary files /dev/null and b/bin/32/msys-2.0.dll differ diff --git a/bin/32/msys-crypto-1.0.0.dll b/bin/32/msys-crypto-1.0.0.dll new file mode 100644 index 0000000..b53971a Binary files /dev/null and b/bin/32/msys-crypto-1.0.0.dll differ diff --git a/bin/32/msys-gcc_s-1.dll b/bin/32/msys-gcc_s-1.dll new file mode 100644 index 0000000..a912801 Binary files /dev/null and b/bin/32/msys-gcc_s-1.dll differ diff --git a/bin/32/msys-z.dll b/bin/32/msys-z.dll new file mode 100644 index 0000000..61c0b0b Binary files /dev/null and b/bin/32/msys-z.dll differ diff --git a/bin/32/ssh-keygen.exe b/bin/32/ssh-keygen.exe new file mode 100644 index 0000000..3041d89 Binary files /dev/null and b/bin/32/ssh-keygen.exe differ diff --git a/bin/64/msys-2.0.dll b/bin/64/msys-2.0.dll new file mode 100644 index 0000000..b1a463c Binary files /dev/null and b/bin/64/msys-2.0.dll differ diff --git a/bin/64/msys-crypto-1.0.0.dll b/bin/64/msys-crypto-1.0.0.dll new file mode 100644 index 0000000..85fff89 Binary files /dev/null and b/bin/64/msys-crypto-1.0.0.dll differ diff --git a/bin/64/msys-gcc_s-seh-1.dll b/bin/64/msys-gcc_s-seh-1.dll new file mode 100644 index 0000000..618f094 Binary files /dev/null and b/bin/64/msys-gcc_s-seh-1.dll differ diff --git a/bin/64/msys-z.dll b/bin/64/msys-z.dll new file mode 100644 index 0000000..4bd4f6f Binary files /dev/null and b/bin/64/msys-z.dll differ diff --git a/bin/64/ssh-keygen.exe b/bin/64/ssh-keygen.exe new file mode 100644 index 0000000..14f2c14 Binary files /dev/null and b/bin/64/ssh-keygen.exe differ diff --git a/bin/ssh-keygen-32.exe b/bin/ssh-keygen-32.exe deleted file mode 100755 index 6862a37..0000000 Binary files a/bin/ssh-keygen-32.exe and /dev/null differ diff --git a/bin/ssh-keygen-64.exe b/bin/ssh-keygen-64.exe deleted file mode 100755 index 64d7a13..0000000 Binary files a/bin/ssh-keygen-64.exe and /dev/null differ diff --git a/package.json b/package.json index 33162a5..534a905 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,8 @@ "name": "ssh-keygen", "version": "0.4.1", "author": { - "name": "Eric Vicenti", - "url": "http://github.com/ericvicenti" + "name": "Eric Vicenti", + "url": "http://github.com/ericvicenti" }, "homepage": "http://github.com/ericvicenti/ssh-keygen", "repository": { diff --git a/src/ssh-keygen.js b/src/ssh-keygen.js index 7c773d9..0e6498b 100644 --- a/src/ssh-keygen.js +++ b/src/ssh-keygen.js @@ -11,8 +11,8 @@ function binPath() { if(process.platform !== 'win32') return 'ssh-keygen'; switch(process.arch) { - case 'ia32': return path.join(__dirname, '..', 'bin', 'ssh-keygen-32.exe'); - case 'x64': return path.join(__dirname, '..', 'bin', 'ssh-keygen-64.exe'); + case 'ia32': return path.join(__dirname, '..', 'bin','32', 'ssh-keygen.exe'); + case 'x64': return path.join(__dirname, '..', 'bin', '64', 'ssh-keygen.exe'); } throw new Error('Unsupported platform'); @@ -126,3 +126,26 @@ module.exports = function(opts, callback){ ssh_keygen(location, opts, callback); }); }; + +module.exports.keygenPromise = function(opts, callback){ + return new Promise((resolve , reject) => { + var location = opts.location; + if(!location) location = path.join(os.tmpdir(),'id_rsa'); + + if(_.isUndefined(opts.read)) opts.read = true; + if(_.isUndefined(opts.force)) opts.force = true; + if(_.isUndefined(opts.destroy)) opts.destroy = false; + + checkAvailability(location, opts.force, function(err){ + if(err){ + log('availability err '+err); + reject(err) + } + ssh_keygen(location, opts, (err, out)=>{ + if(err)reject(err) + resolve(out) + }); + }); + }) +}; + diff --git a/test.js b/test.js index 0ffeb24..5141662 100644 --- a/test.js +++ b/test.js @@ -10,4 +10,19 @@ keygen({ console.log('Done generating key pairs'); console.log(out.key) console.log(out.pubKey) -}); \ No newline at end of file +}); + + +var keygenPromise = require('./src/ssh-keygen').keygenPromise; + +keygenPromise({ + comment: 'promise@doe.com', + read: true +}).then(out=>{ + console.log('Done generating key pairs'); + console.log(out.key) + console.log(out.pubKey) +}).catch(err=>{ + console.log('There was a problem : '+err); +}); +