diff --git a/rust/hermes-ipfs/src/lib.rs b/rust/hermes-ipfs/src/lib.rs index 2a5cb6fb47..68f4b69e1a 100644 --- a/rust/hermes-ipfs/src/lib.rs +++ b/rust/hermes-ipfs/src/lib.rs @@ -58,6 +58,18 @@ where N: NetworkBehaviour + Send + Sync Self(IpfsBuilder::new()) } + /// Create a new `IpfsBuilder` with an existing keypair. + /// + /// ## Parameters + /// - `keypair`: An existing keypair (can be `libp2p::identity::Keypair` or compatible + /// type) + /// + /// ## Errors + /// Returns an error if the keypair is invalid. + pub fn with_keypair(keypair: impl connexa::builder::IntoKeypair) -> std::io::Result { + Ok(Self(IpfsBuilder::with_keypair(keypair)?)) + } + #[must_use] /// Set the default configuration for the IPFS node. pub fn with_default(self) -> Self {