From 7a077846c9e626e485001811da7c5fae700947d9 Mon Sep 17 00:00:00 2001 From: Sebastian Geisler Date: Tue, 22 Jan 2019 15:06:38 -0800 Subject: [PATCH] Add documentation to secret keys pointing to SerdeSecret --- src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 2f806a0..9f146e4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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); @@ -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);