k256: impl new RecoverableSignPrimitive API#123
Conversation
Implements the changes made in RustCrypto/signatures#120. These changes have the `k256` always compute a `recoverable::Signature` via `RecoverableSignPrimitive` and use the blanket impl of `SignPrimitive` for `RecoverableSignPrimitive` to convert it to a regular `k256::ecdsa::Signature` in `ecdsa::signer::Signer<Secp256k1>`. Ideally the `k256::ecdsa::Signer` newtype could go away and this could all be handled by `ecdsa::signer::Signer` via blanket and conditional impls, however I'm not sure how to prevent the impls of `RandomizedSigner` from overlapping in a generic context.
|
I tried moving this into the There are various ways to solve this. One potential approach is to use two different signer types with traits to convert between them. It'd also be possible using hacks like |
Codecov Report
@@ Coverage Diff @@
## master #123 +/- ##
=======================================
Coverage 51.57% 51.57%
=======================================
Files 21 21
Lines 3488 3484 -4
=======================================
- Hits 1799 1797 -2
+ Misses 1689 1687 -2
Continue to review full report at Codecov.
|
| (*self, false) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
NOTE: this PR incorporates #122 (although I needed to deref in the else clause).
|
Going to merge this as I believe it addresses the main problem we've been discussing in #119. I think there are a lot of other ways to potentially go with this, either possibly hoisting the whole thing up into the |
Implements the changes made in RustCrypto/signatures#120.
These changes have the
k256always compute arecoverable::SignatureviaRecoverableSignPrimitiveand use the blanket impl ofSignPrimitiveforRecoverableSignPrimitiveto convert it to a regulark256::ecdsa::Signatureinecdsa::signer::Signer<Secp256k1>.Ideally the
k256::ecdsa::Signernewtype could go away and this could all be handled byecdsa::signer::Signervia blanket and conditional impls, however I'm not sure how to prevent the impls ofRandomizedSignerfrom overlapping in a generic context.