Add documentation to secret keys pointing to SerdeSecret

This commit is contained in:
Sebastian Geisler 2019-01-22 15:06:38 -08:00
parent ce1c30f9b4
commit 7a077846c9
1 changed files with 10 additions and 0 deletions

View File

@ -254,6 +254,11 @@ impl SignatureShare {
/// A secret key; wraps a single prime field element. The field element is
/// heap allocated to avoid any stack copying that result when passing
/// `SecretKey`s between stack frames.
///
/// # Serde integration
/// `SecretKey` implements `Deserialize` but not `Serialize` to avoid accidental
/// serialization in insecure contexts. To enable both use the `::serde_impl::SerdeSecret`
/// wrapper which implements both `Deserialize` and `Serialize`.
#[derive(PartialEq, Eq)]
pub struct SecretKey(Box<Fr>);
@ -364,6 +369,11 @@ impl SecretKey {
}
/// A secret key share.
///
/// # Serde integration
/// `SecretKeyShare` implements `Deserialize` but not `Serialize` to avoid accidental
/// serialization in insecure contexts. To enable both use the `::serde_impl::SerdeSecret`
/// wrapper which implements both `Deserialize` and `Serialize`.
#[derive(Clone, PartialEq, Eq, Default)]
pub struct SecretKeyShare(SecretKey);