-
Notifications
You must be signed in to change notification settings - Fork 305
Add API test and fix up SecretKey
API
#842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add API test and fix up SecretKey
API
#842
Conversation
The docs for rand::StepRng say "deprecated without replacement". In fact, according to rust-random/rand#1634 which removed them, the "replacements" are SmallRng, or Pcg*, or Xoshiro*. That is, the replacement is a separate crate. `rand` exposes Xoshiro256PlusPlus as "SmallRng", if you enable a feature that enables the extra dep. Unfortunately we cannot do this for tests only, because Cargo does not support optional dev-dependencies. (Ten year old issue: rust-lang/cargo#1596 .. last comment three years ago.) Directly use rand_xoshiro instead.
This test is full of FIXMEs because our existing APIs are not very consistent, but this should at least help check that things are not getting worse.
I'd like to pull the different key types into their own modules. It will be easier if we create a subdirector for them all. In the end we will re-export everything.
Move-only, except for a couple import paths.
Deprecate the from_byte_array method, which unfortunately we just added in 0.31.x. We may want to backport yet another deprecation.
cc @tcharding these PRs are actually right in your wheelhouse. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On 44dae89 successfully ran local tests
You mean gut and re-write the whole crate with barely a worry in the world? Now you are talking my language - BOOM! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 44dae89
Mad, next secp release is going to be hot as f***. |
…tKey` API 44dae89894f8e40069f717f5746206cb83703e06 key/secret: encapsulate SecretKey in module that enforces invariants (Andrew Poelstra) 41bb44294cb883740d938b16f0874424e095c018 key: add {from,to,as}_secret_bytes methods (Andrew Poelstra) 9b84072757d3916969d7c8ed6ba08e3e749044cc move SecretKey into its own module (Andrew Poelstra) e86555ad3e2991cfa72a0fb7725b50b3a6c9f352 move key.rs to key/mod.rs (Andrew Poelstra) 0619163ea2df49f70e0d30e36186af8a2506ec18 tests: add API test (Andrew Poelstra) 4853f671312782e871baad9ae745278f0cc78cd6 test: remove deprecated StepRng (Andrew Poelstra) Pull request description: Now that we unconditionally have a global context object we can basically redo the whole API of this crate to avoid requiring these objects (although for the next release we should continue to support the old API, to make the transition easier). We know a lot more about Rust and API design than we did when we put together the old one, so we can do this in a consistent and principled way. This isn't a huge crate. We should be able to do the "main" data structures (`SecretKey', `PublicKey`, `ecdsa::Signature`, `schnorr:Signature`, `Message`) in a week or so, then cut a new release which enables context-free keygen, verification and signing. ACKs for top commit: tcharding: ACK 44dae89894f8e40069f717f5746206cb83703e06 Tree-SHA512: 60659532b7ac65c85ac0c7bf9b78d0f080d4b3f556a02623bcb2b737ab73d02bf493153f751b435c7be5041435900870868b4e18b321207d50aaceb96b2f56da
…tKey` API 44dae89894f8e40069f717f5746206cb83703e06 key/secret: encapsulate SecretKey in module that enforces invariants (Andrew Poelstra) 41bb44294cb883740d938b16f0874424e095c018 key: add {from,to,as}_secret_bytes methods (Andrew Poelstra) 9b84072757d3916969d7c8ed6ba08e3e749044cc move SecretKey into its own module (Andrew Poelstra) e86555ad3e2991cfa72a0fb7725b50b3a6c9f352 move key.rs to key/mod.rs (Andrew Poelstra) 0619163ea2df49f70e0d30e36186af8a2506ec18 tests: add API test (Andrew Poelstra) 4853f671312782e871baad9ae745278f0cc78cd6 test: remove deprecated StepRng (Andrew Poelstra) Pull request description: Now that we unconditionally have a global context object we can basically redo the whole API of this crate to avoid requiring these objects (although for the next release we should continue to support the old API, to make the transition easier). We know a lot more about Rust and API design than we did when we put together the old one, so we can do this in a consistent and principled way. This isn't a huge crate. We should be able to do the "main" data structures (`SecretKey', `PublicKey`, `ecdsa::Signature`, `schnorr:Signature`, `Message`) in a week or so, then cut a new release which enables context-free keygen, verification and signing. ACKs for top commit: tcharding: ACK 44dae89894f8e40069f717f5746206cb83703e06 Tree-SHA512: 60659532b7ac65c85ac0c7bf9b78d0f080d4b3f556a02623bcb2b737ab73d02bf493153f751b435c7be5041435900870868b4e18b321207d50aaceb96b2f56da
Now that we unconditionally have a global context object we can basically redo the whole API of this crate to avoid requiring these objects (although for the next release we should continue to support the old API, to make the transition easier).
We know a lot more about Rust and API design than we did when we put together the old one, so we can do this in a consistent and principled way. This isn't a huge crate. We should be able to do the "main" data structures (
SecretKey',
PublicKey,
ecdsa::Signature,
schnorr:Signature,
Message`) in a week or so, then cut a new release which enables context-free keygen, verification and signing.