chore: rename feature flag to native-secp256k1

This commit is contained in:
rvcas 2023-02-06 14:59:58 -05:00 committed by Lucas
parent 67a2674d27
commit 08e8347317
3 changed files with 7 additions and 7 deletions

View File

@ -40,5 +40,5 @@ proptest = "1.0.0"
[features] [features]
default = ["dep:secp256k1"] default = ["dep:secp256k1"]
wasm = ["dep:k256"] native-secp256k1 = ["dep:k256"]
unstable = [] unstable = []

View File

@ -48,10 +48,10 @@ pub enum Error {
DeserialisationError(String, Value), DeserialisationError(String, Value),
#[error("Integer overflow")] #[error("Integer overflow")]
OverflowError, OverflowError,
#[cfg(not(feature = "wasm"))] #[cfg(not(feature = "native-secp256k1"))]
#[error(transparent)] #[error(transparent)]
Secp256k1(#[from] secp256k1::Error), Secp256k1(#[from] secp256k1::Error),
#[cfg(feature = "wasm")] #[cfg(feature = "native-secp256k1")]
#[error(transparent)] #[error(transparent)]
Secp256k1(#[from] k256::ecdsa::Error), Secp256k1(#[from] k256::ecdsa::Error),
} }

View File

@ -1146,7 +1146,7 @@ pub fn convert_constr_to_tag(constr: u64) -> u64 {
} }
} }
#[cfg(not(feature = "wasm"))] #[cfg(not(feature = "native-secp256k1"))]
fn verify_ecdsa(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result<Rc<Value>, Error> { fn verify_ecdsa(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result<Rc<Value>, Error> {
use secp256k1::{ecdsa::Signature, Message, PublicKey, Secp256k1}; use secp256k1::{ecdsa::Signature, Message, PublicKey, Secp256k1};
@ -1163,7 +1163,7 @@ fn verify_ecdsa(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result<R
Ok(Value::Con(Constant::Bool(valid.is_ok()).into()).into()) Ok(Value::Con(Constant::Bool(valid.is_ok()).into()).into())
} }
#[cfg(not(feature = "wasm"))] #[cfg(not(feature = "native-secp256k1"))]
fn verify_schnorr(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result<Rc<Value>, Error> { fn verify_schnorr(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result<Rc<Value>, Error> {
use secp256k1::{schnorr::Signature, Message, Secp256k1, XOnlyPublicKey}; use secp256k1::{schnorr::Signature, Message, Secp256k1, XOnlyPublicKey};
@ -1180,7 +1180,7 @@ fn verify_schnorr(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result
Ok(Value::Con(Constant::Bool(valid.is_ok()).into()).into()) Ok(Value::Con(Constant::Bool(valid.is_ok()).into()).into())
} }
#[cfg(feature = "wasm")] #[cfg(feature = "native-secp256k1")]
fn verify_ecdsa(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result<Rc<Value>, Error> { fn verify_ecdsa(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result<Rc<Value>, Error> {
use k256::ecdsa::{self, signature::Verifier}; use k256::ecdsa::{self, signature::Verifier};
@ -1193,7 +1193,7 @@ fn verify_ecdsa(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result<R
Ok(Value::Con(Constant::Bool(valid.is_ok()).into()).into()) Ok(Value::Con(Constant::Bool(valid.is_ok()).into()).into())
} }
#[cfg(feature = "wasm")] #[cfg(feature = "native-secp256k1")]
fn verify_schnorr(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result<Rc<Value>, Error> { fn verify_schnorr(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result<Rc<Value>, Error> {
use k256::schnorr::{self, signature::Verifier}; use k256::schnorr::{self, signature::Verifier};