From 7493ba00c931d2de6916e435716c3d20e9be9ab7 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Tue, 18 Sep 2018 13:48:38 +0100 Subject: [PATCH 1/3] fix: coerce key gen size to number in CLI License: MIT Signed-off-by: Alan Shaw --- src/cli/commands/key/gen.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cli/commands/key/gen.js b/src/cli/commands/key/gen.js index a3f108eeaa..0e5dae1441 100644 --- a/src/cli/commands/key/gen.js +++ b/src/cli/commands/key/gen.js @@ -16,7 +16,8 @@ module.exports = { size: { alias: 's', describe: 'size of the key to generate.', - default: '2048' + default: '2048', + type: 'number' } }, From 437e5b1336d40285b119b3d9024b266198f9ec88 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Tue, 18 Sep 2018 14:05:29 +0100 Subject: [PATCH 2/3] fix: default for key size should be number License: MIT Signed-off-by: Alan Shaw --- src/cli/commands/key/gen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/commands/key/gen.js b/src/cli/commands/key/gen.js index 0e5dae1441..811fbe2a1e 100644 --- a/src/cli/commands/key/gen.js +++ b/src/cli/commands/key/gen.js @@ -16,7 +16,7 @@ module.exports = { size: { alias: 's', describe: 'size of the key to generate.', - default: '2048', + default: 2048, type: 'number' } }, From 57c13dcd069758fd1ac86d6ca0099a3591350ac8 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Tue, 18 Sep 2018 15:36:55 +0100 Subject: [PATCH 3/3] fix: pass number from http api as well License: MIT Signed-off-by: Alan Shaw --- src/http/api/resources/key.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http/api/resources/key.js b/src/http/api/resources/key.js index 15de675c8e..0e5e1545fc 100644 --- a/src/http/api/resources/key.js +++ b/src/http/api/resources/key.js @@ -64,7 +64,7 @@ exports.gen = (request, reply) => { const ipfs = request.server.app.ipfs const name = request.query.arg const type = request.query.type - const size = request.query.size + const size = parseInt(request.query.size) ipfs._keychain.createKey(name, type, size, (err, key) => { if (err) { return applyError(reply, err)