This repository was archived by the owner on Feb 12, 2024. It is now read-only.
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
UnhandledPromiseRejectionWarning: Error: Key management requires '--pass ...' option #1891
Closed
Description
Version: v34.4.4
Platform: Linux 4.9.0-7-amd64 #1 SMP Debian 4.9.110-3+deb9u2 (2018-08-13) x86_64 GNU/Linux
Subsystem: libp2p-keychain
Type: Bug
Severity: ?
Description:
Empty/default passphrase on init
leads to no keychain being found.
Steps to reproduce the error:
The following code
const ipfs = require("ipfs");
const port = 1544;
const node = new ipfs({
repo: `./ipfs/${port}`,
EXPERIMENTAL: {
pubsub: true,
dht: true
},
pass: "",
});
node.on("ready", async (err, id) => {
if (err) {
conole.log(err);
}
console.log(await node.key.list())
}
results in
(node:2750) UnhandledPromiseRejectionWarning: Error: Key management requires '--pass ...' option
at fail (/home/aarnav/Desktop/code_berlin/node_modules/ipfs/src/core/components/no-keychain.js:4:9)
at NoKeychain.createKey (/home/aarnav/Desktop/code_berlin/node_modules/ipfs/src/core/components/no-keychain.js:11:18)
at Function.gen.promisify (/home/aarnav/Desktop/code_berlin/node_modules/ipfs/src/core/components/key.js:11:22)
I checked out the node
object and it's _keychain
property was NoKeyChain{}
.
Then, I tried to create a keychain object myself with libp2p-keychain
and the node's properties by following the code here:
js-ipfs/src/core/components/init.js
Lines 75 to 76 in d945fce
And voilà! I get an error:
(node:3108) UnhandledPromiseRejectionWarning: Error: passPhrase must be least 20 characters
After setting my pass
value in the node
's config to a string with more than twenty characters and reinitializing, I was able to successfully list my keys.
Also, I think this issue could add to #1138