Closed DebugSteven closed 4 years ago
This was supposed to be a draft PR. There isn't a way to switch it to be a draft PR after you open one so I'll leave this open until it's complete/closed.
@mystor pointed out that the serde-related compilation failure happens because serde's derive by default expects the serde crate to be called serde
, but that this can be overridden. I tested adding
#[cfg_attr(feature = "serde", serde(crate = "our_serde"))]
below each
#[cfg_attr(feature = "serde", derive(our_serde::Serialize, our_serde::Deserialize))]
and it resolved the problem.
As noted in the PR, X25519 secret keys are unreduced scalars, but the serde implementation for curve25519-dalek
Scalar
s rejects unreduced values on deserialization. I think it would be possible to use https://serde.rs/remote-derive.html to create a private stub struct which serializes the bytes of a scalar without the reduction check.
This looks great!
Start of adding support for serde serialize and deserialize