mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-26 08:11:39 +00:00
Update libsecp256k1 dep to 0.3.0 (#1258)
* Update libsecp256k1 dep to 0.3.0 * Sign now cannot fail
This commit is contained in:
@ -27,7 +27,7 @@ protobuf = "2.3"
|
||||
quick-error = "1.2"
|
||||
rand = "0.6"
|
||||
rw-stream-sink = { version = "0.1.1", path = "../misc/rw-stream-sink" }
|
||||
libsecp256k1 = { version = "0.2.2", optional = true }
|
||||
libsecp256k1 = { version = "0.3.0", optional = true }
|
||||
sha2 = "0.8.0"
|
||||
smallvec = "0.6"
|
||||
tokio-executor = "0.1.4"
|
||||
@ -56,4 +56,3 @@ tokio-mock-task = "0.1"
|
||||
[features]
|
||||
default = ["secp256k1"]
|
||||
secp256k1 = ["libsecp256k1"]
|
||||
|
||||
|
@ -133,9 +133,7 @@ impl SecretKey {
|
||||
pub fn sign_hash(&self, msg: &[u8]) -> Result<Vec<u8>, SigningError> {
|
||||
let m = Message::parse_slice(msg)
|
||||
.map_err(|_| SigningError::new("failed to parse secp256k1 digest"))?;
|
||||
secp256k1::sign(&m, &self.0)
|
||||
.map(|s| s.0.serialize_der().as_ref().into())
|
||||
.map_err(|_| SigningError::new("failed to create secp256k1 signature"))
|
||||
Ok(secp256k1::sign(&m, &self.0).0.serialize_der().as_ref().into())
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,4 +188,3 @@ mod tests {
|
||||
assert_eq!(sk_bytes, [0; 32]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user