Skip to content

Commit

Permalink
Add rustdocs describing fixed width serde
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
tcharding committed Mar 8, 2022
1 parent 51f744d commit 01b7be3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/key.rs
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 01b7be3

Please sign in to comment.