diff --git a/src/lib.rs b/src/lib.rs index c007c98..3ee86e4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -198,7 +198,7 @@ use core::{mem, fmt, str}; use ffi::{CPtr, types::AlignedType}; #[cfg(feature = "global-context")] -#[cfg_attr(docsrs, doc(cfg(any(feature = "global-context", feature = "global-context"))))] +#[cfg_attr(docsrs, doc(cfg(feature = "global-context")))] pub use context::global::SECP256K1; #[cfg(feature = "bitcoin_hashes")] @@ -458,6 +458,14 @@ impl Secp256k1 { } } +/// Generates a random keypair using the global [`SECP256K1`] context. +#[inline] +#[cfg(all(feature = "global-context", feature = "rand"))] +#[cfg_attr(docsrs, doc(cfg(all(feature = "global-context", feature = "rand"))))] +pub fn generate_keypair(rng: &mut R) -> (key::SecretKey, key::PublicKey) { + SECP256K1.generate_keypair(rng) +} + /// Utility function used to parse hex into a target u8 buffer. Returns /// the number of bytes converted or an error if it encounters an invalid /// character or unexpected end of string.