Closed raphaelahrens closed 2 years ago
Hi, I am not very happy with this PR so I just wanted to show you the draft and hear your opinion.
So because of the size of the arrays inside SecretKey and Signature, it is at the moment not possible to just use the derive macro. So the option was to just serialize them as Bytes and lose the type. Or to go and implement the Visitors and all that.
This was an unexpected deep dive into serde and I must say it is not nice to see how the sausage is made.
Let me know what you think.
I discovered serde_with
, which might make this easier: https://docs.rs/serde_with/latest/serde_with/
Should this PR be closed?
This change adds the serde_support feature, which when enabled adds Serialize and Deserialize implementations for
The Serialization is done manual, because of the of the large Size of the bytes array in SecretKey (64) and Signature (64) and for consistency also for PublicKey. All these Types are serialized to a NeytypeStruct holding a bytes array. While the NewtypeStruct should be ignored by the Serializer implementations
But not all do.
Only KeyPair uses the derive macro.