You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to have SecretKey::sing directly use an array [u8; 32] instead of slice &[u8]. This would improve the api since the message should always be 32 bytes.
I guess using a slice is a carry-over form secp256k1 library. I agree that using [u8; 32] would be more convenient and could reduce the number of Results returned. However in some cases this might trigger unnecessary copying of data, so perhaps instead we could introduce a Message type:
It might be a good approach although it would make the API a bit less user-friendly.
Since arrays are what's used I suspect that it fits the API better but then the user of the crate should manually convert a slice to a fixed-length array.
There is an impl of TryFrom for slice to array so it's not that bad.
Ah, the conversion looks ideal, I didn't know about it! Yeah, I think the Message type is not needed in that case and just having &[u8; 32] would be good enough, thanks!
Split off from #93
I guess using a slice is a carry-over form
secp256k1
library. I agree that using[u8; 32]
would be more convenient and could reduce the number ofResults
returned. However in some cases this might trigger unnecessary copying of data, so perhaps instead we could introduce aMessage
type:And take
impl Into<Message<'a>>
in the API. Wondering how ergonomic the new API would be, since the errors might sometimes be confusing.@elpiel wdyt?
The text was updated successfully, but these errors were encountered: