Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
fix: coerce key gen size to number (#1582)
Browse files Browse the repository at this point in the history
Keychain params are now validated properly and has caused these test to fail libp2p/js-libp2p-keychain#26

License: MIT
Signed-off-by: Alan Shaw <[email protected]>
  • Loading branch information
Alan Shaw authored Sep 18, 2018
1 parent c52ee03 commit 25d820d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/cli/commands/key/gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ module.exports = {
size: {
alias: 's',
describe: 'size of the key to generate.',
default: '2048'
default: 2048,
type: 'number'
}
},

Expand Down
2 changes: 1 addition & 1 deletion src/http/api/resources/key.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 25d820d

Please sign in to comment.