Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #430: Add convenience methods for keys
f08276a Add convenience methods for keys (Tobin Harding) b4c7fa0 Let the compiler work out int size (Tobin Harding) c612130 Borrow secret key (Tobin Harding) Pull request description: We have a bunch of `from_<key>` methods for converting between key types. To make the API more ergonomic to use we can add methods that do the same but called on a variable e.g., once applied the following are equivalent: - `let pk = PublicKey::from_keypair(kp)` - `let pk = kp.public_key()` Do this for `SecretKey`, `PublicKey`, `KeyPair`, and `XOnlyKeyPair`. Fixes: #428 ### Note to reviewers - `XOnlyPublicKey` -> `PublicKey` logic is made up by me, I could not work out how to get `libsecp256k1` to do this. - Please review the tests carefully, they include assumptions based on my current understanding of the cryptography :) ACKs for top commit: sanket1729: ACK f08276a. Thanks for going through all the iterations. apoelstra: ACK f08276a Tree-SHA512: 1503a6e570a3958110c6f24cd6d075fe5694b3b32b91a7a9d332c63aa0806198ff10bdd95e7f9de0cf73cbf4e3655c6826bd04e5044d1b019f551471b187c8ea
- Loading branch information
Showing
3 changed files
with
258 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.