From 01b7be3f3adbc8ca34108749ee3f14964ce135dd Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Tue, 8 Mar 2022 12:01:55 +1100 Subject: [PATCH] Add rustdocs describing fixed width serde We recently added fixed width serialization for some types however serialization is only fixed width when data is serialized with the `bincode` crate. Add rustdocs describing fixed width serde to `SecretKey`, `PublicKey`, and `XOnlyPublicKey` (`KeyPair` is already done). --- src/key.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/key.rs b/src/key.rs index 2c65e2cd3..fc5b649e7 100644 --- a/src/key.rs +++ b/src/key.rs @@ -38,6 +38,12 @@ use schnorr; /// Secret 256-bit key used as `x` in an ECDSA signature. /// +/// # Serde support +/// +/// Implements de/serialization with the `serde` feature enabled. Serialized data is fixed width (32 +/// bytes) if you use `bincode` to do serialization, other binary formats may add metadata to the +/// serialized data (e.g. cbor and tycho). +/// /// # Examples /// /// Basic usage: @@ -73,6 +79,12 @@ pub const ONE_KEY: SecretKey = SecretKey([0, 0, 0, 0, 0, 0, 0, 0, /// A Secp256k1 public key, used for verification of signatures. /// +/// # Serde support +/// +/// Implements de/serialization with the `serde` feature enabled. Serialized data is fixed width (33 +/// bytes) if you use `bincode` to do serialization, other binary formats may add metadata to the +/// serialized data (e.g. cbor and tycho). +/// /// # Examples /// /// Basic usage: @@ -971,6 +983,12 @@ impl<'de> ::serde::Deserialize<'de> for KeyPair { /// An x-only public key, used for verification of Schnorr signatures and serialized according to BIP-340. /// +/// # Serde support +/// +/// Implements de/serialization with the `serde` feature enabled. Serialized data is fixed width (32 +/// bytes) if you use `bincode` to do serialization, other binary formats may add metadata to the +/// serialized data (e.g. cbor and tycho). +/// /// # Examples /// /// Basic usage: