key: Improve docs

Crypto is _hard_. Make an effort to improve the docs with a minimum of
exactly correct information.
This commit is contained in:
Tobin C. Harding 2023-08-09 12:04:34 +10:00
parent 1f9c01af18
commit aa4489c71b
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 6 additions and 3 deletions

View File

@ -21,7 +21,9 @@ use crate::{
#[cfg(feature = "hashes")] #[cfg(feature = "hashes")]
use crate::{hashes, ThirtyTwoByteHash}; use crate::{hashes, ThirtyTwoByteHash};
/// Secret 256-bit key used as `x` in an ECDSA signature. /// Secret key - a 256-bit key used to create ECDSA and Taproot signatures.
///
/// This value should be generated using a [cryptographically secure pseudorandom number generator].
/// ///
/// # Side channel attacks /// # Side channel attacks
/// ///
@ -50,6 +52,7 @@ use crate::{hashes, ThirtyTwoByteHash};
/// ``` /// ```
/// [`bincode`]: https://docs.rs/bincode /// [`bincode`]: https://docs.rs/bincode
/// [`cbor`]: https://docs.rs/cbor /// [`cbor`]: https://docs.rs/cbor
/// [cryptographically secure pseudorandom number generator]: https://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub struct SecretKey([u8; constants::SECRET_KEY_SIZE]); pub struct SecretKey([u8; constants::SECRET_KEY_SIZE]);
impl_display_secret!(SecretKey); impl_display_secret!(SecretKey);
@ -117,7 +120,7 @@ impl str::FromStr for SecretKey {
} }
} }
/// A Secp256k1 public key, used for verification of signatures. /// Public key - used to verify ECDSA signatures and to do Taproot tweaks.
/// ///
/// # Serde support /// # Serde support
/// ///
@ -1082,7 +1085,7 @@ impl CPtr for KeyPair {
fn as_mut_c_ptr(&mut self) -> *mut Self::Target { &mut self.0 } fn as_mut_c_ptr(&mut self) -> *mut Self::Target { &mut self.0 }
} }
/// An x-only public key, used for verification of schnorr signatures and serialized according to BIP-340. /// An x-only public key, used for verification of Taproot signatures and serialized according to BIP-340.
/// ///
/// # Serde support /// # Serde support
/// ///