From 08112ca642cea3809625ae0abde05dc0dc46b4f3 Mon Sep 17 00:00:00 2001 From: Dmitry Markin Date: Tue, 23 Apr 2024 19:15:05 +0300 Subject: [PATCH] Re-export `multihash` & `multiaddr` types (#79) This is a companion PR to https://github.com/paritytech/polkadot-sdk/pull/4198. --- src/crypto/ed25519.rs | 5 +++++ src/types.rs | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/crypto/ed25519.rs b/src/crypto/ed25519.rs index 852d4e0f..2d43ebf1 100644 --- a/src/crypto/ed25519.rs +++ b/src/crypto/ed25519.rs @@ -202,6 +202,11 @@ impl SecretKey { sk_bytes.zeroize(); Ok(SecretKey(secret)) } + + /// Convert this secret key to a byte array. + pub fn to_bytes(&self) -> [u8; 32] { + self.0.to_bytes() + } } #[cfg(test)] diff --git a/src/types.rs b/src/types.rs index 5b125129..8f40b78b 100644 --- a/src/types.rs +++ b/src/types.rs @@ -22,6 +22,14 @@ use rand::Rng; +// Re-export the types used in public interfaces. +pub mod multiaddr { + pub use multiaddr::{Error, Iter, Multiaddr, Onion3Addr, Protocol}; +} +pub mod multihash { + pub use multihash::{Code, Error, Multihash, MultihashDigest}; +} + pub mod protocol; /// Substream ID.