keyfork-derive-util: minor refactor, tidy up publicness of modules
This commit is contained in:
parent
0375ce7bdf
commit
086e56bef0
|
@ -4,7 +4,7 @@ use std::{env, process::ExitCode, str::FromStr};
|
|||
|
||||
use keyfork_derive_util::{
|
||||
request::{DerivationAlgorithm, DerivationError, DerivationRequest, DerivationResponse},
|
||||
DerivationPath,
|
||||
DerivationPath, PathError,
|
||||
};
|
||||
use keyforkd_client::Client;
|
||||
|
||||
|
@ -17,7 +17,7 @@ pub enum Error {
|
|||
|
||||
/// The given path could not be parsed.
|
||||
#[error("Could not parse the given path: {0}")]
|
||||
PathFormat(#[from] keyfork_derive_util::path::Error),
|
||||
PathFormat(#[from] PathError),
|
||||
|
||||
/// The request to derive data failed.
|
||||
#[error("Unable to perform key derivation request: {0}")]
|
||||
|
|
|
@ -5,6 +5,7 @@ use std::time::{Duration, SystemTime, SystemTimeError};
|
|||
use derive_util::{
|
||||
request::{DerivationResponse, TryFromDerivationResponseError},
|
||||
DerivationIndex, ExtendedPrivateKey, PrivateKey,
|
||||
IndexError,
|
||||
};
|
||||
use ed25519_dalek::SigningKey;
|
||||
pub use keyfork_derive_util as derive_util;
|
||||
|
@ -37,7 +38,7 @@ pub enum Error {
|
|||
|
||||
/// A derivation index could not be created from the given index.
|
||||
#[error("Could not create derivation index: {0}")]
|
||||
Index(#[from] keyfork_derive_util::index::Error),
|
||||
Index(#[from] IndexError),
|
||||
|
||||
/// A derivation operation could not be performed against the private key.
|
||||
#[error("Could not perform operation against private key: {0}")]
|
||||
|
|
|
@ -28,7 +28,7 @@ impl DerivationIndex {
|
|||
/// # Examples
|
||||
/// ```rust
|
||||
/// # use keyfork_derive_util::*;
|
||||
/// let bip44 = DerivationIndex::new(44, true);
|
||||
/// let bip44 = DerivationIndex::new(44, true).unwrap();
|
||||
/// ```
|
||||
///
|
||||
/// Using a derivation index that is higher than 2^31 returns an error:
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
#![allow(clippy::module_name_repetitions, clippy::must_use_candidate)]
|
||||
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
pub mod extended_key;
|
||||
|
||||
///
|
||||
pub mod index;
|
||||
///
|
||||
pub mod path;
|
||||
///
|
||||
pub mod private_key;
|
||||
///
|
||||
pub mod public_key;
|
||||
///
|
||||
pub mod request;
|
||||
|
||||
mod index;
|
||||
mod path;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub mod private_key;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub mod public_key;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
#[doc(inline)]
|
||||
pub use crate::extended_key::{private_key::ExtendedPrivateKey, public_key::ExtendedPublicKey};
|
||||
|
||||
pub use crate::{
|
||||
extended_key::{private_key::ExtendedPrivateKey, public_key::ExtendedPublicKey},
|
||||
index::DerivationIndex,
|
||||
path::DerivationPath,
|
||||
private_key::PrivateKey,
|
||||
public_key::PublicKey,
|
||||
index::{DerivationIndex, Error as IndexError},
|
||||
path::{DerivationPath, Error as PathError},
|
||||
private_key::{PrivateKey, PrivateKeyError},
|
||||
public_key::{PublicKey, PublicKeyError},
|
||||
};
|
||||
|
|
|
@ -147,6 +147,7 @@ pub struct TestPublicKey {
|
|||
|
||||
impl TestPublicKey {
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
pub fn from_bytes(b: &[u8]) -> Self {
|
||||
Self {
|
||||
key: b.try_into().unwrap(),
|
||||
|
|
|
@ -15,7 +15,7 @@ use aes_gcm::{
|
|||
use hkdf::{Hkdf, InvalidLength as HkdfInvalidLength};
|
||||
use keyfork_derive_openpgp::derive_util::{
|
||||
request::{DerivationAlgorithm, DerivationRequest},
|
||||
DerivationPath,
|
||||
DerivationPath, PathError,
|
||||
};
|
||||
use keyfork_mnemonic_util::{Mnemonic, MnemonicFromStrError, MnemonicGenerationError, Wordlist};
|
||||
use keyfork_prompt::{
|
||||
|
@ -125,7 +125,7 @@ pub enum Error {
|
|||
|
||||
/// An error occurred while parsing a derivation path.
|
||||
#[error("Derivation path: {0}")]
|
||||
DerivationPath(#[from] keyfork_derive_openpgp::derive_util::path::Error),
|
||||
DerivationPath(#[from] PathError),
|
||||
|
||||
/// An error occurred while requesting derivation.
|
||||
#[error("Derivation request: {0}")]
|
||||
|
|
Loading…
Reference in New Issue