diff --git a/Cargo.toml b/Cargo.toml index 0e2649d..5321f8a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ edition = "2018" [dependencies] blake2-rfc = "0.2.18" byteorder = "1.3.4" -ed25519-dalek = "=1.0.0-pre.3" +ed25519-dalek = "1.0.1" anyhow = "1.0.26" flat-tree = "5.0.0" lazy_static = "1.4.0" diff --git a/src/crypto/key_pair.rs b/src/crypto/key_pair.rs index ad34665..53503af 100644 --- a/src/crypto/key_pair.rs +++ b/src/crypto/key_pair.rs @@ -1,6 +1,6 @@ //! Generate an `Ed25519` keypair. -pub use ed25519_dalek::{ExpandedSecretKey, Keypair, PublicKey, SecretKey, Signature}; +pub use ed25519_dalek::{ExpandedSecretKey, Keypair, PublicKey, SecretKey, Signature, Verifier}; use anyhow::{bail, ensure, Result}; use rand::rngs::{OsRng, StdRng}; diff --git a/src/prelude.rs b/src/prelude.rs index 4f304c7..eeede9a 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -1,12 +1,8 @@ //! Convenience wrapper to import all of Hypercore's core. //! //! ```rust -//! //! use hypercore::prelude::*; -//! -//! fn main () { -//! let feed = Feed::default(); -//! } +//! let feed = Feed::default(); //! ``` pub use crate::feed::Feed; // pub use feed_builder::FeedBuilder; diff --git a/src/storage/mod.rs b/src/storage/mod.rs index 96a75b6..0d5fa2b 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -16,6 +16,7 @@ use random_access_memory::RandomAccessMemory; use random_access_storage::RandomAccess; use sleep_parser::*; use std::borrow::Borrow; +use std::convert::TryFrom; use std::fmt::Debug; use std::ops::Range; use std::path::PathBuf; @@ -157,10 +158,10 @@ where } /// Search the signature stores for a `Signature`, starting at `index`. - pub fn next_signature<'a>( - &'a mut self, + pub fn next_signature( + &mut self, index: u64, - ) -> futures::future::BoxFuture<'a, Result> { + ) -> futures::future::BoxFuture<'_, Result> { let bytes = async_std::task::block_on(async { self.signatures .read(HEADER_OFFSET + 64 * index, 64) @@ -170,7 +171,7 @@ where async move { let bytes = bytes?; if not_zeroes(&bytes) { - Ok(Signature::from_bytes(&bytes)?) + Ok(Signature::try_from(&bytes[..])?) } else { Ok(self.next_signature(index + 1).await?) } @@ -187,7 +188,7 @@ where .await .map_err(|e| anyhow!(e))?; ensure!(not_zeroes(&bytes), "No signature found"); - Ok(Signature::from_bytes(&bytes)?) + Ok(Signature::try_from(&bytes[..])?) } /// Write a `Signature` to `self.Signatures`. diff --git a/tests/compat.rs b/tests/compat.rs index 59698ad..93b6ec3 100644 --- a/tests/compat.rs +++ b/tests/compat.rs @@ -4,6 +4,7 @@ use ed25519_dalek; use tempfile; +use std::convert::TryFrom; use std::fs::File; use std::io::Read; use std::path::{Path, PathBuf}; @@ -107,7 +108,7 @@ async fn deterministic_signatures() { expected_signatures ); - let compat_signature = Signature::from_bytes(&compat_signature_struct).unwrap(); + let compat_signature = Signature::try_from(&compat_signature_struct[..]).unwrap(); feed.verify(feed.len() - 1, &compat_signature) .await .expect("Could not verify compat signature of hypercore v9");