[][src]Trait bdk::keys::GeneratableKey

pub trait GeneratableKey<Ctx: ScriptContext>: Sized {
    type Entropy: AsMut<[u8]> + Default;
    type Options;
    type Error: Debug;
    pub fn generate_with_entropy(
        options: Self::Options,
        entropy: Self::Entropy
    ) -> Result<GeneratedKey<Self, Ctx>, Self::Error>; pub fn generate(
        options: Self::Options
    ) -> Result<GeneratedKey<Self, Ctx>, Self::Error> { ... } }

Trait for keys that can be generated

The same rules about ScriptContext and ValidNetworks from ToDescriptorKey apply.

This trait is particularly useful when combined with DerivableKey: if Self implements it, the returned GeneratedKey will also implement it. The same is true for ToDescriptorKey: the generated keys can be directly used in descriptors if Self is also ToDescriptorKey.

Associated Types

type Entropy: AsMut<[u8]> + Default[src]

Type specifying the amount of entropy required e.g. [u8;32]

type Options[src]

Extra options required by the generate_with_entropy

type Error: Debug[src]

Returned error in case of failure

Loading content...

Required methods

pub fn generate_with_entropy(
    options: Self::Options,
    entropy: Self::Entropy
) -> Result<GeneratedKey<Self, Ctx>, Self::Error>
[src]

Generate a key given the extra options and the entropy

Loading content...

Provided methods

pub fn generate(
    options: Self::Options
) -> Result<GeneratedKey<Self, Ctx>, Self::Error>
[src]

Generate a key given the options with a random entropy

Loading content...

Implementations on Foreign Types

impl<Ctx: ScriptContext> GeneratableKey<Ctx> for Mnemonic[src]

This is supported on crate feature keys-bip39 only.

type Entropy = [u8; 32]

type Options = (MnemonicType, Language)

type Error = Option<ErrorKind>

impl<Ctx: ScriptContext> GeneratableKey<Ctx> for ExtendedPrivKey[src]

type Entropy = [u8; 32]

type Options = ()

type Error = Error

impl<Ctx: ScriptContext> GeneratableKey<Ctx> for PrivateKey[src]

type Entropy = [u8; 32]

type Options = PrivateKeyGenerateOptions

type Error = Error

Loading content...

Implementors

Loading content...