iqlusioninc / crates

A collection of open source Rust crates from iqlusion

Home Page:https://www.iqlusion.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bip32: why can't private ExtendedKey instances convert to `ExtendedPublicKeys` with `TryFrom`?

pezcore opened this issue · comments

It seems that only public ExtendedKey instances can be converted to ExtendedPublicKey instances with TryFrom<ExtendedKey> for ExtendedPublicKey<K>. Why is that? Shouldn't ExtendedPublicKey::try_from() compute the public key even when the given ExtendedKey is private instead of returning Err(Crypto), because this conversion is cheap, unambiguous, and convenient for the user?

reference

When the secp256k1 feature is enabled (which it is by default), it could compute the public key from the private key, yes.

PRs accepted to add this, or I will get around to implementing it eventually.

Resolved by #1021