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

Commit 25d820d

Browse files
author
Alan Shaw
authored
fix: coerce key gen size to number (#1582)
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]>
1 parent c52ee03 commit 25d820d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/cli/commands/key/gen.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ module.exports = {
1616
size: {
1717
alias: 's',
1818
describe: 'size of the key to generate.',
19-
default: '2048'
19+
default: 2048,
20+
type: 'number'
2021
}
2122
},
2223

src/http/api/resources/key.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ exports.gen = (request, reply) => {
6464
const ipfs = request.server.app.ipfs
6565
const name = request.query.arg
6666
const type = request.query.type
67-
const size = request.query.size
67+
const size = parseInt(request.query.size)
6868
ipfs._keychain.createKey(name, type, size, (err, key) => {
6969
if (err) {
7070
return applyError(reply, err)

0 commit comments

Comments
 (0)