From d79989bc954bb493685235ce47ecbe2062f5360c Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Wed, 9 Feb 2022 07:55:02 +0000 Subject: [PATCH] Remove erroneous duplicate feature When we removed the "global-context-less-secure" a duplicate feature snuck in, remove it. --- src/lib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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.