Update some dependenices; Remove some useless dependencies (#1387)

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
This commit is contained in:
Qinxuan Chen
2020-01-10 21:03:59 +08:00
committed by Pierre Krieger
parent 655609dfe0
commit af464e18c5
18 changed files with 18 additions and 49 deletions

View File

@ -21,7 +21,6 @@
//! Ed25519 keys.
use ed25519_dalek as ed25519;
use failure::Fail;
use rand::RngCore;
use super::error::DecodingError;
use zeroize::Zeroize;
@ -48,7 +47,7 @@ impl Keypair {
pub fn decode(kp: &mut [u8]) -> Result<Keypair, DecodingError> {
ed25519::Keypair::from_bytes(kp)
.map(|k| { kp.zeroize(); Keypair(k) })
.map_err(|e| DecodingError::new("Ed25519 keypair").source(e.compat()))
.map_err(|e| DecodingError::new("Ed25519 keypair").source(e))
}
/// Sign a message using the private key of this keypair.
@ -120,7 +119,7 @@ impl PublicKey {
/// Decode a public key from a byte array as produced by `encode`.
pub fn decode(k: &[u8]) -> Result<PublicKey, DecodingError> {
ed25519::PublicKey::from_bytes(k)
.map_err(|e| DecodingError::new("Ed25519 public key").source(e.compat()))
.map_err(|e| DecodingError::new("Ed25519 public key").source(e))
.map(PublicKey)
}
}
@ -164,7 +163,7 @@ impl SecretKey {
pub fn from_bytes(mut sk_bytes: impl AsMut<[u8]>) -> Result<SecretKey, DecodingError> {
let sk_bytes = sk_bytes.as_mut();
let secret = ed25519::SecretKey::from_bytes(&*sk_bytes)
.map_err(|e| DecodingError::new("Ed25519 secret key").source(e.compat()))?;
.map_err(|e| DecodingError::new("Ed25519 secret key").source(e))?;
sk_bytes.zeroize();
Ok(SecretKey(secret))
}