Upgrade ed25519-dalek to pre.4 (#1665)

* Upgrade ed25519-dalek to pre.4

* Update core/src/identity/ed25519.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
This commit is contained in:
Roman Borschel
2020-07-17 12:01:49 +02:00
committed by GitHub
parent cc3438ec37
commit 7c7d6a9d2e
3 changed files with 9 additions and 4 deletions

View File

@ -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

View File

@ -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 <admin@parity.io>"]
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"] }

View File

@ -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.