From 976d65bb7ece6f52e54d8d760d9ebb61738d3030 Mon Sep 17 00:00:00 2001 From: Eliott T Date: Thu, 24 Aug 2017 19:11:52 +0200 Subject: [PATCH 1/2] feat: command option to specify key type --- src/cli/commands/init.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cli/commands/init.js b/src/cli/commands/init.js index b53639fec0..5d76d6a214 100644 --- a/src/cli/commands/init.js +++ b/src/cli/commands/init.js @@ -21,6 +21,12 @@ module.exports = { alias: 'e', type: 'boolean', describe: "Don't add and pin help files to the local storage" + }, + type: { + alias: 't', + type: 'string', + default: 'RSA', + describe: 'Choose the key type used by your node' } }, From b1f1b3fa94a791c03fc51bfa353fdade7ada5f66 Mon Sep 17 00:00:00 2001 From: Eliott T Date: Thu, 24 Aug 2017 19:12:50 +0200 Subject: [PATCH 2/2] feat: implements key type feature --- src/core/components/init.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/components/init.js b/src/core/components/init.js index 46084c2eb5..0e9232e8a5 100644 --- a/src/core/components/init.js +++ b/src/core/components/init.js @@ -36,6 +36,7 @@ module.exports = function init (self) { opts.emptyRepo = opts.emptyRepo || false opts.bits = Number(opts.bits) || 2048 opts.log = opts.log || function () {} + opts.type = opts.type || 'RSA' waterfall([ // Verify repo does not yet exist. @@ -47,9 +48,9 @@ module.exports = function init (self) { } // Generate peer identity keypair + transform to desired format + add to config. - opts.log(`generating ${opts.bits}-bit RSA keypair...`, false) + opts.log(`generating ${opts.bits}-bit ${opts.type} keypair...`, false) self.log('generating peer id: %s bits', opts.bits) - peerId.create({bits: opts.bits}, cb) + peerId.create({bits: opts.bits, type: opts.type}, cb) }, (keys, cb) => { self.log('identity generated')