Skip to content

Commit

Permalink
ecdsa: add serde documentation (#416)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarcieri committed Dec 4, 2021
1 parent 6fcc4c5 commit bfb896f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions ecdsa/src/lib.rs
@@ -1,5 +1,13 @@
#![doc = include_str!("../README.md")]

//! ## `serde` support
//!
//! When the `serde` feature of this crate is enabled, `Serialize` and
//! `Deserialize` impls are provided for the [`Signature`] and [`VerifyingKey`]
//! types.
//!
//! Please see type-specific documentation for more information.
//!
//! ## Interop
//!
//! Any crates which provide an implementation of ECDSA for a particular
Expand Down Expand Up @@ -114,6 +122,15 @@ pub type SignatureBytes<C> = GenericArray<u8, SignatureSize<C>>;
///
/// ASN.1 DER-encoded signatures also supported via the
/// [`Signature::from_der`] and [`Signature::to_der`] methods.
///
/// # `serde` support
///
/// When the `serde` feature of this crate is enabled, it provides support for
/// serializing and deserializing ECDSA signatures using the `Serialize` and
/// `Deserialize` traits.
///
/// The serialization uses a 64-byte fixed encoding when used with binary
/// formats, and a hexadecimal encoding when used with text formats.
#[derive(Clone, Eq, PartialEq)]
pub struct Signature<C: PrimeCurve>
where
Expand Down
9 changes: 9 additions & 0 deletions ecdsa/src/verify.rs
Expand Up @@ -30,6 +30,15 @@ use elliptic_curve::serde::{de, ser, Deserialize, Serialize};
///
/// Requires an [`elliptic_curve::ProjectiveArithmetic`] impl on the curve, and a
/// [`VerifyPrimitive`] impl on its associated `AffinePoint` type.
///
/// # `serde` support
///
/// When the `serde` feature of this crate is enabled, it provides support for
/// serializing and deserializing ECDSA signatures using the `Serialize` and
/// `Deserialize` traits.
///
/// The serialization leverages the encoding used by the [`PublicKey`] type,
/// which is a binary-oriented ASN.1 DER encoding.
#[cfg_attr(docsrs, doc(cfg(feature = "verify")))]
#[derive(Clone, Debug)]
pub struct VerifyingKey<C>
Expand Down

0 comments on commit bfb896f

Please sign in to comment.