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
Empty/default passphrase on init leads to no keychain being found.
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:
https://github.com/ipfs/js-ipfs/blob/d945fceeb09c1c4289a61edb40209271e8318d25/src/core/components/init.js#L75-L76
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 https://github.com/ipfs/js-ipfs/issues/1138
For now(until this issue is resolved), this will work if the pass param is at least 20 characters long.
Here is an example:
let ipfs = await IPFS.create({
pass: "01234567890123456789",
})
Most helpful comment
For now(until this issue is resolved), this will work if the
passparam is at least 20 characters long.Here is an example: