Why don't the public ed25519 and PeerID match in js-ipfs?

I’ve been playing around with js-ipfs, and noticed my public key and PeerID do not match.

Is there a reason for this?
Can I change it?
How do I get the PeerID from the ed25519 key?

I’m pretty sure I’ve seen a post on this. I’ll see if I can find it rather than repeating it but the PeerID is a protobuf containing the public key which is why they don’t match.

1 Like

It looks like createFromPrivKey(privKey) might be what you’re looking for and this documentation should tell you all you want to know about PeerIDs.

1 Like