diff --git a/Cargo.lock b/Cargo.lock index 6a3a8a7..2e707bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1758,7 +1758,7 @@ dependencies = [ [[package]] name = "keyfork-derive-util" -version = "0.1.0" +version = "0.1.1" dependencies = [ "digest", "ed25519-dalek", diff --git a/crates/derive/keyfork-derive-util/Cargo.toml b/crates/derive/keyfork-derive-util/Cargo.toml index 4c208cd..ae1d1d6 100644 --- a/crates/derive/keyfork-derive-util/Cargo.toml +++ b/crates/derive/keyfork-derive-util/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "keyfork-derive-util" -version = "0.1.0" +version = "0.1.1" edition = "2021" license = "MIT" diff --git a/crates/derive/keyfork-derive-util/src/extended_key/public_key.rs b/crates/derive/keyfork-derive-util/src/extended_key/public_key.rs index 2e9d7ba..f366429 100644 --- a/crates/derive/keyfork-derive-util/src/extended_key/public_key.rs +++ b/crates/derive/keyfork-derive-util/src/extended_key/public_key.rs @@ -11,8 +11,8 @@ const KEY_SIZE: usize = 256; /// Errors associated with creating or deriving Extended Public Keys. #[derive(Error, Clone, Debug)] pub enum Error { - /// BIP-0032 does not support deriving public keys from hardened private keys. - #[error("Public keys may not be derived when hardened")] + /// BIP-0032 does not support hardened public key derivation from parent public keys. + #[error("Hardened child public keys may not be derived from parent public keys")] HardenedIndex, /// The maximum depth for key derivation has been reached. The supported maximum depth is 255. diff --git a/crates/derive/keyfork-derive-util/src/private_key.rs b/crates/derive/keyfork-derive-util/src/private_key.rs index edd19d3..b0e9fa9 100644 --- a/crates/derive/keyfork-derive-util/src/private_key.rs +++ b/crates/derive/keyfork-derive-util/src/private_key.rs @@ -85,7 +85,7 @@ pub trait PrivateKey: Sized { /// # Errors /// /// An error may be returned if: - /// * A nonzero `other` is provided. + /// * An all-zero `other` is provided. /// * An error specific to the given algorithm was encountered. fn derive_child(&self, other: &PrivateKeyBytes) -> Result; @@ -180,7 +180,6 @@ impl PrivateKey for ed25519_dalek::SigningKey { use crate::public_key::TestPublicKey; -#[doc(hidden)] #[derive(Clone, Debug, PartialEq, Eq)] pub struct TestPrivateKey { key: [u8; 32], diff --git a/crates/derive/keyfork-derive-util/src/public_key.rs b/crates/derive/keyfork-derive-util/src/public_key.rs index d1ff170..d9c71b1 100644 --- a/crates/derive/keyfork-derive-util/src/public_key.rs +++ b/crates/derive/keyfork-derive-util/src/public_key.rs @@ -42,7 +42,7 @@ pub trait PublicKey: Sized { /// # Errors /// /// An error may be returned if: - /// * A nonzero `other` is provided. + /// * An all-zero `other` is provided. /// * An error specific to the given algorithm was encountered. fn derive_child(&self, other: PrivateKeyBytes) -> Result; @@ -142,7 +142,6 @@ impl PublicKey for VerifyingKey { } } -#[doc(hidden)] #[derive(Clone)] pub struct TestPublicKey { pub(crate) key: [u8; 33], diff --git a/crates/derive/keyfork-derive-util/src/request.rs b/crates/derive/keyfork-derive-util/src/request.rs index 42d8b4b..0df421c 100644 --- a/crates/derive/keyfork-derive-util/src/request.rs +++ b/crates/derive/keyfork-derive-util/src/request.rs @@ -57,7 +57,7 @@ pub enum DerivationAlgorithm { #[allow(missing_docs)] Secp256k1, #[doc(hidden)] - Internal, + TestAlgorithm, } impl DerivationAlgorithm { @@ -86,7 +86,7 @@ impl DerivationAlgorithm { &derived_key, )) } - Self::Internal => { + Self::TestAlgorithm => { let key = ExtendedPrivateKey::::new(seed); let derived_key = key.derive_path(path)?; Ok(DerivationResponse::with_algo_and_xprv( @@ -120,7 +120,7 @@ pub trait AsAlgorithm: PrivateKey { impl AsAlgorithm for TestPrivateKey { fn as_algorithm() -> DerivationAlgorithm { - DerivationAlgorithm::Internal + DerivationAlgorithm::TestAlgorithm } } @@ -144,7 +144,7 @@ impl DerivationRequest { /// # }; /// # fn main() -> Result<(), Box> { /// let algo: DerivationAlgorithm = // - /// # DerivationAlgorithm::Internal; + /// # DerivationAlgorithm::TestAlgorithm; /// let path: DerivationPath = // /// # DerivationPath::default(); /// let request = DerivationRequest::new(algo, &path); @@ -169,7 +169,7 @@ impl DerivationRequest { /// # }; /// # fn main() -> Result<(), Box> { /// let algo: DerivationAlgorithm = // - /// # DerivationAlgorithm::Internal; + /// # DerivationAlgorithm::TestAlgorithm; /// let path: DerivationPath = // /// # DerivationPath::default(); /// let request = DerivationRequest::new(algo, &path); @@ -199,7 +199,7 @@ impl DerivationRequest { /// # b"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", /// # )?; /// let algo: DerivationAlgorithm = // - /// # DerivationAlgorithm::Internal; + /// # DerivationAlgorithm::TestAlgorithm; /// let path: DerivationPath = // /// # DerivationPath::default(); /// let request = DerivationRequest::new(algo, &path); @@ -228,7 +228,7 @@ impl DerivationRequest { /// let seed: &[u8; 64] = // /// # b"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; /// let algo: DerivationAlgorithm = // - /// # DerivationAlgorithm::Internal; + /// # DerivationAlgorithm::TestAlgorithm; /// let path: DerivationPath = // /// # DerivationPath::default(); /// let request = DerivationRequest::new(algo, &path);