]> Untitled Git - bdk/commit
[keys] Improve the API of `DerivableKey`
authorAlekos Filini <alekos.filini@gmail.com>
Tue, 26 Jan 2021 16:48:44 +0000 (11:48 -0500)
committerAlekos Filini <alekos.filini@gmail.com>
Fri, 29 Jan 2021 20:21:36 +0000 (15:21 -0500)
commitccbbad3e9e5b09c0bf681b527348ad9dd9e2bc4b
tree54b078b9ae441d96367646800e9a13f2502abb6c
parenteb96ac374ba070aeba877073815de7a1fd25b18f
[keys] Improve the API of `DerivableKey`

A new `ExtendedKey` type has been added, which is basically an enum of
`bip32::ExtendedPubKey` and `bip32::ExtendedPrivKey`, with some extra metadata
regarding the `ScriptContext`.

This type has some methods that make it very easy to extract its content as
either an `xprv` or `xpub`.

The `DerivableKey` trait has been updated so that the user now only has to
implement a method (`DerivableKey::into_extended_key()`) to perform the
conversion into an `ExtendedKey`.

The method that was previously called `add_metadata()` has now been renamed
to `into_descriptor_key()`, and it has
a blanket implementation.
CHANGELOG.md
src/keys/bip39.rs
src/keys/mod.rs