Init js-ipfs node with ed25519 key pair

It looks from the documentation and conversations on github that using ed25519 instead of RSA for node IDs is possible, but not the default. However, I can’t seem to find how to actually do it, and even creating one with the ‘js-libp2p-crypto’ package gives me an “invalid type” error. Does anyone have any advice?

Also, is this the right place to ask this question or should I go to GitHub issues or the IRC channel?

1 Like

Since you can feed a PeerId into the privateKey option of the init.options of an IPFS node, you should be able to do this by instantiating a new PeerId with an 'ed25519' keypair:

const privateKey = await PeerId.create({ keyType: 'ed25519' })
const node = new IPFS({
  init: { privateKey }
})

Update (for the record): It wasn’t quite that simple. See this issue for the solution.