Trait bip32::PrivateKey
source · pub trait PrivateKey: Sized {
type PublicKey: PublicKey;
// Required methods
fn from_bytes(bytes: &PrivateKeyBytes) -> Result<Self>;
fn to_bytes(&self) -> PrivateKeyBytes;
fn derive_child(&self, other: PrivateKeyBytes) -> Result<Self>;
fn public_key(&self) -> Self::PublicKey;
}
Expand description
Trait for key types which can be derived using BIP32.
Required Associated Types§
Required Methods§
sourcefn from_bytes(bytes: &PrivateKeyBytes) -> Result<Self>
fn from_bytes(bytes: &PrivateKeyBytes) -> Result<Self>
Initialize this key from bytes.
sourcefn to_bytes(&self) -> PrivateKeyBytes
fn to_bytes(&self) -> PrivateKeyBytes
Serialize this key as bytes.
sourcefn derive_child(&self, other: PrivateKeyBytes) -> Result<Self>
fn derive_child(&self, other: PrivateKeyBytes) -> Result<Self>
Derive a child key from a parent key and the a provided tweak value,
i.e. where other
is referred to as “I sub L” in BIP32 and sourced
from the left half of the HMAC-SHA-512 output.
sourcefn public_key(&self) -> Self::PublicKey
fn public_key(&self) -> Self::PublicKey
Get the Self::PublicKey
that corresponds to this private key.
Implementations on Foreign Types§
source§impl PrivateKey for SigningKey
Available on crate feature secp256k1
only.
impl PrivateKey for SigningKey
Available on crate feature
secp256k1
only.type PublicKey = VerifyingKey<Secp256k1>
fn from_bytes(bytes: &PrivateKeyBytes) -> Result<Self>
fn to_bytes(&self) -> PrivateKeyBytes
fn derive_child(&self, other: PrivateKeyBytes) -> Result<Self>
fn public_key(&self) -> Self::PublicKey
source§impl PrivateKey for SecretKey
Available on crate feature secp256k1
only.
impl PrivateKey for SecretKey
Available on crate feature
secp256k1
only.type PublicKey = PublicKey<Secp256k1>
fn from_bytes(bytes: &PrivateKeyBytes) -> Result<Self>
fn to_bytes(&self) -> PrivateKeyBytes
fn derive_child(&self, other: PrivateKeyBytes) -> Result<Self>
fn public_key(&self) -> Self::PublicKey
source§impl PrivateKey for SecretKey
Available on crate feature secp256k1-ffi
only.
impl PrivateKey for SecretKey
Available on crate feature
secp256k1-ffi
only.