diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 2b8b6763..14c8889d 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.20.1 [2020-17-17] + +- Update ed25519-dalek dependency. + # 0.20.0 [2020-07-01] - Conditional compilation fixes for the `wasm32-wasi` target diff --git a/core/Cargo.toml b/core/Cargo.toml index 137cb86c..f242a45f 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-core" edition = "2018" description = "Core traits and structs of libp2p" -version = "0.20.0" +version = "0.20.1" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -12,7 +12,7 @@ categories = ["network-programming", "asynchronous"] [dependencies] asn1_der = "0.6.1" bs58 = "0.3.0" -ed25519-dalek = "1.0.0-pre.3" +ed25519-dalek = "1.0.0-pre.4" either = "1.5" fnv = "1.0" futures = { version = "0.3.1", features = ["executor", "thread-pool"] } diff --git a/core/src/identity/ed25519.rs b/core/src/identity/ed25519.rs index f68e5d03..089fb360 100644 --- a/core/src/identity/ed25519.rs +++ b/core/src/identity/ed25519.rs @@ -20,8 +20,9 @@ //! Ed25519 keys. -use ed25519_dalek as ed25519; +use ed25519_dalek::{self as ed25519, Signer as _, Verifier as _}; use rand::RngCore; +use std::convert::TryFrom; use super::error::DecodingError; use zeroize::Zeroize; use core::fmt; @@ -107,7 +108,7 @@ pub struct PublicKey(ed25519::PublicKey); impl PublicKey { /// Verify the Ed25519 signature on a message using the public key. pub fn verify(&self, msg: &[u8], sig: &[u8]) -> bool { - ed25519::Signature::from_bytes(sig).and_then(|s| self.0.verify(msg, &s)).is_ok() + ed25519::Signature::try_from(sig).and_then(|s| self.0.verify(msg, &s)).is_ok() } /// Encode the public key into a byte array in compressed form, i.e.