Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump secp256k1 0.28 #61

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ sha3 = "0.10"
k256 = { version = "0.13", features = ["ecdsa"], optional = true }
serde = { version = "1.0.110", features = ["derive"], optional = true }
ed25519-dalek = { version = "2.0.0", optional = true, features = ["rand_core"] }
secp256k1 = { version = "0.27", optional = true, default-features = false, features = [
secp256k1 = { version = "0.28", optional = true, default-features = false, features = [
"global-context",
] }

[dev-dependencies]
secp256k1 = { features = ["rand-std"], version = "0.27" }
secp256k1 = { features = ["rand-std"], version = "0.28" }
serde_json = { version = "1.0.95" }

[features]
Expand Down
8 changes: 3 additions & 5 deletions src/keys/rust_secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ impl EnrKey for secp256k1::SecretKey {
fn sign_v4(&self, msg: &[u8]) -> Result<Vec<u8>, SigningError> {
// take a keccak256 hash then sign.
let hash = digest(msg);
let m = secp256k1::Message::from_slice(&hash)
.map_err(|_| SigningError::new("failed to parse secp256k1 digest"))?;
let m = secp256k1::Message::from_digest(hash);
// serialize to an uncompressed 64 byte vector
let signature = {
let mut noncedata = [0; 32];
Expand Down Expand Up @@ -61,9 +60,8 @@ impl EnrPublicKey for secp256k1::PublicKey {
fn verify_v4(&self, msg: &[u8], sig: &[u8]) -> bool {
let msg = digest(msg);
if let Ok(sig) = secp256k1::ecdsa::Signature::from_compact(sig) {
if let Ok(msg) = secp256k1::Message::from_slice(&msg) {
return SECP256K1.verify_ecdsa(&msg, &sig, self).is_ok();
}
let msg = secp256k1::Message::from_digest(msg);
return SECP256K1.verify_ecdsa(&msg, &sig, self).is_ok();
}
false
}
Expand Down
Loading