While conceptually, the peer id is highly related and mostly synonymous with "public key", the same cannot be said for "private key".
With codepaths used 99% of the time, peer ids should never contain a private key.
There is only a single peer id that contains a private key, and that is a node's own peer id.
That said, my opinion is that it's a mistake to combine the private key in the peer id.
Rather, access to a node's own private key should be exposed explicitly (as is already being done in #2303).
2.0 release is an opportunity to remove the private key from peer id.
in libp2p 1.0, the peer id encapsulates a type, multihash, public key, and a private key.
While conceptually, the peer id is highly related and mostly synonymous with "public key", the same cannot be said for "private key".
With codepaths used 99% of the time, peer ids should never contain a private key. There is only a single peer id that contains a private key, and that is a node's own peer id.
That said, my opinion is that it's a mistake to combine the private key in the peer id. Rather, access to a node's own private key should be exposed explicitly (as is already being done in #2303).
2.0 release is an opportunity to remove the private key from peer id.