Skip to content

Commit fa03e4a

Browse files
committed
revert: use old library for secp256k1 functions
These should eventually switch over to using the Rust-native `k256` crate from RustCrypto, but for now, we are reverting this to allow more time to ensure there are no accidental consensus breaking changes.
1 parent f8d02cd commit fa03e4a

File tree

7 files changed

+1143
-1031
lines changed

7 files changed

+1143
-1031
lines changed

Cargo.lock

Lines changed: 3 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

stacks-common/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ slog-term = { version = "2.6.0", default-features = false }
4545
thiserror = { workspace = true }
4646

4747
# RustCrypto elliptic curve crates
48-
k256 = { version = "0.13", default-features = false, features = ["std", "serde", "ecdsa"] }
4948
p256 = { version = "0.13", default-features = false, features = ["std", "serde", "ecdsa"] }
5049

5150
# Optional dependencies
@@ -65,8 +64,12 @@ winapi = { version = "0.3", features = [
6564
], optional = true }
6665

6766
[target.'cfg(not(target_family = "wasm"))'.dependencies]
67+
secp256k1 = { version = "0.24.3", default-features = false, features = ["std","serde", "recovery"] }
6868
rusqlite = { workspace = true, optional = true }
6969

70+
[target.'cfg(target_family = "wasm")'.dependencies]
71+
libsecp256k1 = { version = "0.7.2", default-features = false, features = ["hmac", "lazy-static-context"] }
72+
7073
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(any(target_os="windows"))))'.dependencies]
7174
sha2 = { version = "0.10", features = ["asm"] }
7275

stacks-common/src/types/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ pub trait PublicKey: Clone + fmt::Debug + serde::Serialize + serde::de::Deserial
6969
pub trait PrivateKey: Clone + fmt::Debug + serde::Serialize + serde::de::DeserializeOwned {
7070
fn to_bytes(&self) -> Vec<u8>;
7171
fn sign(&self, data_hash: &[u8]) -> Result<MessageSignature, &'static str>;
72+
#[cfg(any(test, feature = "testing"))]
73+
fn sign_with_noncedata(
74+
&self,
75+
data_hash: &[u8],
76+
noncedata: &[u8; 32],
77+
) -> Result<MessageSignature, &'static str>;
7278
}
7379

7480
pub trait Address: Clone + fmt::Debug + fmt::Display {

0 commit comments

Comments
 (0)