mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-23 14:51:34 +00:00
feat(core): remove deprecated identity
module
Related: #3647. Pull-Request: #4040.
This commit is contained in:
@ -9,10 +9,6 @@
|
|||||||
- Remove deprecated symbols related to upgrades.
|
- Remove deprecated symbols related to upgrades.
|
||||||
See [PR 3867].
|
See [PR 3867].
|
||||||
|
|
||||||
[PR 3567]: https://github.com/libp2p/rust-libp2p/pull/3567
|
|
||||||
[PR 3715]: https://github.com/libp2p/rust-libp2p/pull/3715
|
|
||||||
[PR 3867]: https://github.com/libp2p/rust-libp2p/pull/3867
|
|
||||||
|
|
||||||
- Enforce protocol names to be valid UTF8 strings as required by the [spec].
|
- Enforce protocol names to be valid UTF8 strings as required by the [spec].
|
||||||
We delete the `ProtocolName` trait and replace it with a requirement for `AsRef<str>`.
|
We delete the `ProtocolName` trait and replace it with a requirement for `AsRef<str>`.
|
||||||
See [PR 3746]
|
See [PR 3746]
|
||||||
@ -27,11 +23,19 @@
|
|||||||
These are implementation details that should not be depended on.
|
These are implementation details that should not be depended on.
|
||||||
See [PR 3915].
|
See [PR 3915].
|
||||||
|
|
||||||
|
- Remove deprecated `identity` module.
|
||||||
|
Depend on `libp2p-identity` directly instead or import it via the `libp2p::identity` re-export.
|
||||||
|
See [PR 4040].
|
||||||
|
|
||||||
[spec]: https://github.com/libp2p/specs/blob/master/connections/README.md#multistream-select
|
[spec]: https://github.com/libp2p/specs/blob/master/connections/README.md#multistream-select
|
||||||
|
[PR 3567]: https://github.com/libp2p/rust-libp2p/pull/3567
|
||||||
|
[PR 3715]: https://github.com/libp2p/rust-libp2p/pull/3715
|
||||||
[PR 3746]: https://github.com/libp2p/rust-libp2p/pull/3746
|
[PR 3746]: https://github.com/libp2p/rust-libp2p/pull/3746
|
||||||
[PR 3883]: https://github.com/libp2p/rust-libp2p/pull/3883
|
|
||||||
[PR 3814]: https://github.com/libp2p/rust-libp2p/pull/3814
|
[PR 3814]: https://github.com/libp2p/rust-libp2p/pull/3814
|
||||||
|
[PR 3867]: https://github.com/libp2p/rust-libp2p/pull/3867
|
||||||
|
[PR 3883]: https://github.com/libp2p/rust-libp2p/pull/3883
|
||||||
[PR 3915]: https://github.com/libp2p/rust-libp2p/pull/3915
|
[PR 3915]: https://github.com/libp2p/rust-libp2p/pull/3915
|
||||||
|
[PR 4040]: https://github.com/libp2p/rust-libp2p/pull/4040
|
||||||
|
|
||||||
## 0.39.2
|
## 0.39.2
|
||||||
|
|
||||||
|
@ -39,11 +39,9 @@ libp2p-mplex = { workspace = true }
|
|||||||
libp2p-noise = { workspace = true }
|
libp2p-noise = { workspace = true }
|
||||||
multihash = { version = "0.17.0", default-features = false, features = ["arb"] }
|
multihash = { version = "0.17.0", default-features = false, features = ["arb"] }
|
||||||
quickcheck = { workspace = true }
|
quickcheck = { workspace = true }
|
||||||
|
libp2p-identity = { workspace = true, features = ["ed25519"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
secp256k1 = [ "libp2p-identity/secp256k1" ]
|
|
||||||
ecdsa = [ "libp2p-identity/ecdsa" ]
|
|
||||||
rsa = [ "libp2p-identity/rsa" ]
|
|
||||||
serde = ["multihash/serde-codec", "dep:serde", "libp2p-identity/serde"]
|
serde = ["multihash/serde-codec", "dep:serde", "libp2p-identity/serde"]
|
||||||
|
|
||||||
# Passing arguments to the docsrs builder in order to properly document cfg's.
|
# Passing arguments to the docsrs builder in order to properly document cfg's.
|
||||||
|
@ -22,10 +22,6 @@
|
|||||||
//!
|
//!
|
||||||
//! The main concepts of libp2p-core are:
|
//! The main concepts of libp2p-core are:
|
||||||
//!
|
//!
|
||||||
//! - A [`PeerId`] is a unique global identifier for a node on the network.
|
|
||||||
//! Each node must have a different [`PeerId`]. Normally, a [`PeerId`] is the
|
|
||||||
//! hash of the public key used to negotiate encryption on the
|
|
||||||
//! communication channel, thereby guaranteeing that they cannot be spoofed.
|
|
||||||
//! - The [`Transport`] trait defines how to reach a remote node or listen for
|
//! - The [`Transport`] trait defines how to reach a remote node or listen for
|
||||||
//! incoming remote connections. See the [`transport`] module.
|
//! incoming remote connections. See the [`transport`] module.
|
||||||
//! - The [`StreamMuxer`] trait is implemented on structs that hold a connection
|
//! - The [`StreamMuxer`] trait is implemented on structs that hold a connection
|
||||||
@ -49,55 +45,6 @@ mod proto {
|
|||||||
pub use multiaddr;
|
pub use multiaddr;
|
||||||
pub type Negotiated<T> = multistream_select::Negotiated<T>;
|
pub type Negotiated<T> = multistream_select::Negotiated<T>;
|
||||||
|
|
||||||
#[deprecated(since = "0.39.0", note = "Depend on `libp2p-identity` instead.")]
|
|
||||||
pub mod identity {
|
|
||||||
pub use libp2p_identity::Keypair;
|
|
||||||
pub use libp2p_identity::PublicKey;
|
|
||||||
|
|
||||||
pub mod ed25519 {
|
|
||||||
pub use libp2p_identity::ed25519::Keypair;
|
|
||||||
pub use libp2p_identity::ed25519::PublicKey;
|
|
||||||
pub use libp2p_identity::ed25519::SecretKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "ecdsa")]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.39.0",
|
|
||||||
note = "The `ecdsa` feature-flag is deprecated and will be removed in favor of `libp2p-identity`."
|
|
||||||
)]
|
|
||||||
pub mod ecdsa {
|
|
||||||
pub use libp2p_identity::ecdsa::Keypair;
|
|
||||||
pub use libp2p_identity::ecdsa::PublicKey;
|
|
||||||
pub use libp2p_identity::ecdsa::SecretKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "secp256k1")]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.39.0",
|
|
||||||
note = "The `secp256k1` feature-flag is deprecated and will be removed in favor of `libp2p-identity`."
|
|
||||||
)]
|
|
||||||
pub mod secp256k1 {
|
|
||||||
pub use libp2p_identity::secp256k1::Keypair;
|
|
||||||
pub use libp2p_identity::secp256k1::PublicKey;
|
|
||||||
pub use libp2p_identity::secp256k1::SecretKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "rsa")]
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.39.0",
|
|
||||||
note = "The `rsa` feature-flag is deprecated and will be removed in favor of `libp2p-identity`."
|
|
||||||
)]
|
|
||||||
pub mod rsa {
|
|
||||||
pub use libp2p_identity::rsa::Keypair;
|
|
||||||
pub use libp2p_identity::rsa::PublicKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod error {
|
|
||||||
pub use libp2p_identity::DecodingError;
|
|
||||||
pub use libp2p_identity::SigningError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mod translation;
|
mod translation;
|
||||||
|
|
||||||
pub mod connection;
|
pub mod connection;
|
||||||
@ -108,15 +55,6 @@ pub mod signed_envelope;
|
|||||||
pub mod transport;
|
pub mod transport;
|
||||||
pub mod upgrade;
|
pub mod upgrade;
|
||||||
|
|
||||||
#[deprecated(since = "0.39.0", note = "Depend on `libp2p-identity` instead.")]
|
|
||||||
pub type PublicKey = libp2p_identity::PublicKey;
|
|
||||||
|
|
||||||
#[deprecated(since = "0.39.0", note = "Depend on `libp2p-identity` instead.")]
|
|
||||||
pub type PeerId = libp2p_identity::PeerId;
|
|
||||||
|
|
||||||
#[deprecated(since = "0.39.0", note = "Depend on `libp2p-identity` instead.")]
|
|
||||||
pub type ParseError = libp2p_identity::ParseError;
|
|
||||||
|
|
||||||
pub use connection::{ConnectedPoint, Endpoint};
|
pub use connection::{ConnectedPoint, Endpoint};
|
||||||
pub use multiaddr::Multiaddr;
|
pub use multiaddr::Multiaddr;
|
||||||
pub use multihash;
|
pub use multihash;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
//! Error types that can result from gossipsub.
|
//! Error types that can result from gossipsub.
|
||||||
|
|
||||||
use libp2p_core::identity::error::SigningError;
|
use libp2p_identity::SigningError;
|
||||||
|
|
||||||
/// Error associated with publishing a gossipsub message.
|
/// Error associated with publishing a gossipsub message.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
//! encoded) by setting the `hash_topics` configuration parameter to true.
|
//! encoded) by setting the `hash_topics` configuration parameter to true.
|
||||||
//!
|
//!
|
||||||
//! - **Sequence Numbers** - A message on the gossipsub network is identified by the source
|
//! - **Sequence Numbers** - A message on the gossipsub network is identified by the source
|
||||||
//! [`libp2p_core::PeerId`] and a nonce (sequence number) of the message. The sequence numbers in
|
//! [`PeerId`](libp2p_identity::PeerId) and a nonce (sequence number) of the message. The sequence numbers in
|
||||||
//! this implementation are sent as raw bytes across the wire. They are 64-bit big-endian unsigned
|
//! this implementation are sent as raw bytes across the wire. They are 64-bit big-endian unsigned
|
||||||
//! integers. When messages are signed, they are monotonically increasing integers starting from a
|
//! integers. When messages are signed, they are monotonically increasing integers starting from a
|
||||||
//! random value and wrapping around u64::MAX. When messages are unsigned, they are chosen at random.
|
//! random value and wrapping around u64::MAX. When messages are unsigned, they are chosen at random.
|
||||||
@ -83,7 +83,7 @@
|
|||||||
//!
|
//!
|
||||||
//! The [`Behaviour`] struct implements the [`libp2p_swarm::NetworkBehaviour`] trait allowing it to
|
//! The [`Behaviour`] struct implements the [`libp2p_swarm::NetworkBehaviour`] trait allowing it to
|
||||||
//! act as the routing behaviour in a [`libp2p_swarm::Swarm`]. This struct requires an instance of
|
//! act as the routing behaviour in a [`libp2p_swarm::Swarm`]. This struct requires an instance of
|
||||||
//! [`libp2p_core::PeerId`] and [`Config`].
|
//! [`PeerId`](libp2p_identity::PeerId) and [`Config`].
|
||||||
//!
|
//!
|
||||||
//! [`Behaviour`]: struct.Behaviour.html
|
//! [`Behaviour`]: struct.Behaviour.html
|
||||||
|
|
||||||
|
@ -515,7 +515,7 @@ mod tests {
|
|||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::{Behaviour, ConfigBuilder};
|
use crate::{Behaviour, ConfigBuilder};
|
||||||
use crate::{IdentTopic as Topic, Version};
|
use crate::{IdentTopic as Topic, Version};
|
||||||
use libp2p_core::identity::Keypair;
|
use libp2p_identity::Keypair;
|
||||||
use quickcheck::*;
|
use quickcheck::*;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -48,10 +48,11 @@ use thiserror::Error;
|
|||||||
/// 1. Establish relayed connections by dialing `/p2p-circuit` addresses.
|
/// 1. Establish relayed connections by dialing `/p2p-circuit` addresses.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # use libp2p_core::{Multiaddr, multiaddr::{Protocol}, Transport, PeerId};
|
/// # use libp2p_core::{Multiaddr, multiaddr::{Protocol}, Transport};
|
||||||
/// # use libp2p_core::transport::memory::MemoryTransport;
|
/// # use libp2p_core::transport::memory::MemoryTransport;
|
||||||
/// # use libp2p_core::transport::choice::OrTransport;
|
/// # use libp2p_core::transport::choice::OrTransport;
|
||||||
/// # use libp2p_relay as relay;
|
/// # use libp2p_relay as relay;
|
||||||
|
/// # use libp2p_identity::PeerId;
|
||||||
/// let actual_transport = MemoryTransport::default();
|
/// let actual_transport = MemoryTransport::default();
|
||||||
/// let (relay_transport, behaviour) = relay::client::new(
|
/// let (relay_transport, behaviour) = relay::client::new(
|
||||||
/// PeerId::random(),
|
/// PeerId::random(),
|
||||||
@ -70,10 +71,11 @@ use thiserror::Error;
|
|||||||
/// 3. Listen for incoming relayed connections via specific relay.
|
/// 3. Listen for incoming relayed connections via specific relay.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # use libp2p_core::{Multiaddr, multiaddr::{Protocol}, transport::ListenerId, Transport, PeerId};
|
/// # use libp2p_core::{Multiaddr, multiaddr::{Protocol}, transport::ListenerId, Transport};
|
||||||
/// # use libp2p_core::transport::memory::MemoryTransport;
|
/// # use libp2p_core::transport::memory::MemoryTransport;
|
||||||
/// # use libp2p_core::transport::choice::OrTransport;
|
/// # use libp2p_core::transport::choice::OrTransport;
|
||||||
/// # use libp2p_relay as relay;
|
/// # use libp2p_relay as relay;
|
||||||
|
/// # use libp2p_identity::PeerId;
|
||||||
/// # let relay_id = PeerId::random();
|
/// # let relay_id = PeerId::random();
|
||||||
/// # let local_peer_id = PeerId::random();
|
/// # let local_peer_id = PeerId::random();
|
||||||
/// let actual_transport = MemoryTransport::default();
|
/// let actual_transport = MemoryTransport::default();
|
||||||
|
@ -22,10 +22,9 @@ use async_trait::async_trait;
|
|||||||
use futures::future::Either;
|
use futures::future::Either;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use libp2p_core::{
|
use libp2p_core::{
|
||||||
identity::Keypair, multiaddr::Protocol, transport::MemoryTransport, upgrade::Version,
|
multiaddr::Protocol, transport::MemoryTransport, upgrade::Version, Multiaddr, Transport,
|
||||||
Multiaddr, Transport,
|
|
||||||
};
|
};
|
||||||
use libp2p_identity::PeerId;
|
use libp2p_identity::{Keypair, PeerId};
|
||||||
use libp2p_plaintext::PlainText2Config;
|
use libp2p_plaintext::PlainText2Config;
|
||||||
use libp2p_swarm::dial_opts::PeerCondition;
|
use libp2p_swarm::dial_opts::PeerCondition;
|
||||||
use libp2p_swarm::{
|
use libp2p_swarm::{
|
||||||
|
@ -395,9 +395,10 @@ where
|
|||||||
/// ```
|
/// ```
|
||||||
/// # use libp2p_swarm::SwarmBuilder;
|
/// # use libp2p_swarm::SwarmBuilder;
|
||||||
/// # use libp2p_swarm::dial_opts::{DialOpts, PeerCondition};
|
/// # use libp2p_swarm::dial_opts::{DialOpts, PeerCondition};
|
||||||
/// # use libp2p_core::{Multiaddr, PeerId, Transport};
|
/// # use libp2p_core::{Multiaddr, Transport};
|
||||||
/// # use libp2p_core::transport::dummy::DummyTransport;
|
/// # use libp2p_core::transport::dummy::DummyTransport;
|
||||||
/// # use libp2p_swarm::dummy;
|
/// # use libp2p_swarm::dummy;
|
||||||
|
/// # use libp2p_identity::PeerId;
|
||||||
/// #
|
/// #
|
||||||
/// let mut swarm = SwarmBuilder::without_executor(
|
/// let mut swarm = SwarmBuilder::without_executor(
|
||||||
/// DummyTransport::new().boxed(),
|
/// DummyTransport::new().boxed(),
|
||||||
|
@ -31,9 +31,9 @@ pub enum PlainTextError {
|
|||||||
InvalidPayload(DecodeError),
|
InvalidPayload(DecodeError),
|
||||||
|
|
||||||
/// Failed to parse public key from bytes in protobuf message.
|
/// Failed to parse public key from bytes in protobuf message.
|
||||||
InvalidPublicKey(libp2p_core::identity::error::DecodingError),
|
InvalidPublicKey(libp2p_identity::DecodingError),
|
||||||
|
|
||||||
/// Failed to parse the [`PeerId`](libp2p_core::PeerId) from bytes in the protobuf message.
|
/// Failed to parse the [`PeerId`](libp2p_identity::PeerId) from bytes in the protobuf message.
|
||||||
InvalidPeerId(libp2p_core::multihash::Error),
|
InvalidPeerId(libp2p_core::multihash::Error),
|
||||||
|
|
||||||
/// The peer id of the exchange isn't consistent with the remote public key.
|
/// The peer id of the exchange isn't consistent with the remote public key.
|
||||||
@ -93,8 +93,8 @@ impl From<DecodeError> for PlainTextError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<libp2p_core::identity::error::DecodingError> for PlainTextError {
|
impl From<libp2p_identity::DecodingError> for PlainTextError {
|
||||||
fn from(err: libp2p_core::identity::error::DecodingError) -> PlainTextError {
|
fn from(err: libp2p_identity::DecodingError) -> PlainTextError {
|
||||||
PlainTextError::InvalidPublicKey(err)
|
PlainTextError::InvalidPublicKey(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ rand = "0.8"
|
|||||||
pin-project = "1.1.0"
|
pin-project = "1.1.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
libp2p-core = { workspace = true, features = ["rsa", "ecdsa", "secp256k1"] }
|
libp2p-core = { workspace = true }
|
||||||
libp2p-identity = { workspace = true, features = ["ed25519"] }
|
libp2p-identity = { workspace = true, features = ["ed25519", "rsa", "ecdsa", "secp256k1"] }
|
||||||
libp2p-noise = { workspace = true }
|
libp2p-noise = { workspace = true }
|
||||||
libp2p-swarm = { workspace = true, features = ["tokio"] }
|
libp2p-swarm = { workspace = true, features = ["tokio"] }
|
||||||
libp2p-tcp = { workspace = true, features = ["tokio"] }
|
libp2p-tcp = { workspace = true, features = ["tokio"] }
|
||||||
|
@ -59,7 +59,7 @@ impl Transport {
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use libp2p_core::identity;
|
/// use libp2p_identity as identity;
|
||||||
/// use rand::thread_rng;
|
/// use rand::thread_rng;
|
||||||
/// use libp2p_webrtc::tokio::{Transport, Certificate};
|
/// use libp2p_webrtc::tokio::{Transport, Certificate};
|
||||||
///
|
///
|
||||||
|
Reference in New Issue
Block a user