27 Commits

Author SHA1 Message Date
Alekos Filini
ccbbad3e9e
[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.
2021-01-29 15:21:36 -05:00
Alekos Filini
bf04a2cf69
descriptor: Use DescriptorError instead of Error when reasonable
Change the return type of the `descriptor!()` macro and `ToWalletDescriptor` to
avoid having to map errors.

Also introduce more checks to validate descriptors built using the macro.
2021-01-12 12:21:22 +01:00
Steve Myers
aa31c96821
[ci] Fail 'Build docs' job if warnings 2021-01-04 16:39:11 -08:00
Alekos Filini
63aabe203f
Merge commit 'refs/pull/235/head' of github.com:bitcoindevkit/bdk 2020-12-18 10:41:37 +01:00
Steve Myers
2325a1fcc2
[docs] Format code in docs with '--config format_code_in_doc_comments=true' 2020-12-16 15:12:51 -08:00
Steve Myers
fb5c70fc64
[docs] Replace all 'allow(missing_docs)' with basic docs 2020-12-16 15:12:49 -08:00
Alekos Filini
713411ea5d
[keys] impl ToDescriptorKey for &str 2020-12-16 19:06:02 +01:00
Alekos Filini
c0a92bd084
[keys] Replace (Fingerprint, DerivationPath) with KeySource 2020-12-11 11:16:41 +01:00
Alekos Filini
1a90832f3a
[docs] Add the docs to the keys module 2020-12-11 11:16:39 +01:00
Riccardo Casatta
81519555cf
generalize impl_error! macro so that used for other errors type 2020-12-04 11:23:01 +01:00
Alekos Filini
6f4d2846d3
[descriptor] Add support for sortedmulti in descriptor! 2020-11-17 23:57:33 +01:00
Alekos Filini
7a42c5e095
Switch to "mainline" rust-miniscript 2020-11-17 23:57:28 +01:00
Alekos Filini
ac18fb119f
[keys] Add a shortcut to generate keys with the default options 2020-11-13 17:43:57 +01:00
Alekos Filini
f2edee0e2e
[keys] impl ToDescriptorKey for GeneratedKey 2020-11-13 17:29:01 +01:00
Alekos Filini
f4affbd039
[keys] impl GeneratableKey for bitcoin::PrivateKey 2020-11-13 17:27:19 +01:00
Steve Myers
4f7355ec82
[ci] Fix all-keys and cli-utils tests 2020-10-28 21:34:04 -07:00
Steve Myers
e31f5306d2
[descriptor] Add descriptor macro tests 2020-10-26 12:48:23 -07:00
Alekos Filini
100f0aaa0a
Bump rust-bitcoin to 0.25, fix Cargo dependencies
Closes #112, closes #113, closes #124
2020-10-13 10:39:48 +02:00
Steve Myers
aea9abff8a
[ci] Fix clippy warnings, enable clippy checks 2020-10-10 10:31:07 -07:00
LLFourn
490c88934e [keys] Less convoluted entropy generation
Since const generics aren't in rust yet you have to find some awkward
workarounds. This improves the workaround for specifying entropy length.
2020-09-30 20:05:17 +10:00
Alekos Filini
82251a8de4
[keys] Fix entropy generation 2020-09-24 15:59:46 +02:00
Alekos Filini
b294b11c54
[keys] Add a trait for keys that can be generated 2020-09-24 09:53:56 +02:00
Alekos Filini
c93cd1414a
[descriptor] Add descriptor templates, add DerivableKey 2020-09-24 09:53:54 +02:00
Alekos Filini
c51ba4a99f
[keys] Add a way to restrict the networks in which keys are valid
Thanks to the `ToWalletDescriptor` trait we can also very easily validate the checksum
for descriptors that are loaded from strings, if they contain one. Fixes #20.
2020-09-24 09:53:51 +02:00
Alekos Filini
bc8acaf088
[keys] Take ScriptContext into account when converting keys 2020-09-24 09:53:48 +02:00
Alekos Filini
ab9d964868
[keys] Add BIP39 support 2020-09-24 09:53:46 +02:00
Alekos Filini
751a553925
[descriptor] Improve the descriptor macro, add traits for key and descriptor types 2020-09-24 09:53:42 +02:00