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§

source

type PublicKey: PublicKey

Public key type which corresponds to this private key.

Required Methods§

source

fn from_bytes(bytes: &PrivateKeyBytes) -> Result<Self>

Initialize this key from bytes.

source

fn to_bytes(&self) -> PrivateKeyBytes

Serialize this key as bytes.

source

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.

source

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.
§

type PublicKey = VerifyingKey<Secp256k1>

source§

fn from_bytes(bytes: &PrivateKeyBytes) -> Result<Self>

source§

fn to_bytes(&self) -> PrivateKeyBytes

source§

fn derive_child(&self, other: PrivateKeyBytes) -> Result<Self>

source§

fn public_key(&self) -> Self::PublicKey

source§

impl PrivateKey for SecretKey

Available on crate feature secp256k1 only.
source§

impl PrivateKey for SecretKey

Available on crate feature secp256k1-ffi only.

Implementors§