libp2p / rust-libp2p

The Rust Implementation of the libp2p networking stack.
https://libp2p.io
MIT License
4.64k stars 964 forks source link

Extract `libp2p-identity` crate #3349

Closed thomaseizinger closed 1 year ago

thomaseizinger commented 1 year ago

This issue is part of https://github.com/libp2p/rust-libp2p/issues/3271.

thomaseizinger commented 1 year ago
  • We can consider moving PeerRecord and SignedEnvelope into this crate as well or extract them into their own. I am undecided here.

Already running into the first issue as I am starting to work on this.

A PeerRecord depends on Multiaddr as well as PeerId. If we want multiaddr to depend on libp2p-identity, we can't define PeerRecord within libp2p-identity otherwise we have a circular dependency!

thomaseizinger commented 1 year ago
  • We can consider moving PeerRecord and SignedEnvelope into this crate as well or extract them into their own. I am undecided here.

Already running into the first issue as I am starting to work on this.

A PeerRecord depends on Multiaddr as well as PeerId. If we want multiaddr to depend on libp2p-identity, we can't define PeerRecord within libp2p-identity otherwise we have a circular dependency!

The solution to this turned out to be to not use the proto definition of PeerId in PeerRecord but treat it as opaque bytes instead that we parse through the functions available in libp2p-identity::PeerId.