From f12fae4479c5b97ab37823d7aa58d9156e2fc3ad Mon Sep 17 00:00:00 2001 From: Katharina Date: Mon, 22 Apr 2019 02:02:08 +0200 Subject: Updating crates to 2018 edition (#9) * Updating main README * Updating lock file * Updating crate ecosystem to Rust 2018 edition --- lockchain-crypto/src/databody.rs | 7 ++++--- lockchain-crypto/src/engine.rs | 19 ++++++++----------- lockchain-crypto/src/keyfold.rs | 12 ++++++------ lockchain-crypto/src/lib.rs | 13 ++++--------- 4 files changed, 22 insertions(+), 29 deletions(-) (limited to 'lockchain-crypto/src') diff --git a/lockchain-crypto/src/databody.rs b/lockchain-crypto/src/databody.rs index 568710c..2662f51 100644 --- a/lockchain-crypto/src/databody.rs +++ b/lockchain-crypto/src/databody.rs @@ -1,12 +1,13 @@ //! A clear-text representation of a record body in memory -//! +//! //! This form is created by the `lockchain-crypto` crate and //! should only exist in ephemeral form. All actions are first //! encrypted before being written back to a persistence //! medium. -use lcc::traits::{AutoEncoder, Body}; -use lcc::Payload; +use crate::lcc::traits::{AutoEncoder, Body}; +use crate::lcc::Payload; +use serde::{Serialize, Deserialize}; use std::collections::BTreeMap; #[derive(Serialize, Deserialize)] diff --git a/lockchain-crypto/src/engine.rs b/lockchain-crypto/src/engine.rs index e80c846..fe9c94c 100644 --- a/lockchain-crypto/src/engine.rs +++ b/lockchain-crypto/src/engine.rs @@ -3,20 +3,17 @@ //! Can be initialised from scratch or with a pw/salt //! combintaion which derives a key via the `keybob` crate. -use lcc::traits::{AutoEncoder, Encryptable, EncryptionHandler}; -use lcc::{EncryptedBody, PackedData}; - -use miscreant::aead::{Aes256Siv, Algorithm}; +use crate::lcc::traits::{AutoEncoder, Encryptable, EncryptionHandler}; +use crate::lcc::{EncryptedBody, PackedData}; +use crate::lcc::crypto::{random, Key}; +use miscreant::{Aead, Aes256SivAead}; use super::databody::DataBody; -use lcc::crypto::random; -use lcc::crypto::{Key, KeyType}; - impl Encryptable for DataBody {} pub struct AesEngine { - ctx: Aes256Siv, + ctx: Aes256SivAead, _key: Option, iv: Vec, } @@ -27,7 +24,7 @@ impl AesEngine { assert!(key.len() == 64); Self { - ctx: Aes256Siv::new(&key.as_slice()), + ctx: Aes256SivAead::new(&key.as_slice()), _key: Some(key), iv: random::bytes(64), } @@ -49,7 +46,7 @@ impl AesEngine { /// Generate an Aes context from password #[deprecated] - pub fn from_pw(pw: &str, salt: &str) -> Self { + pub fn from_pw(_pw: &str, _salt: &str) -> Self { // let key = Key::from_pw(KeyType::Aes256, pw, salt); // let len = key.len(); // Self { @@ -63,7 +60,7 @@ impl AesEngine { /// Load a packed data object which contains an Aes context #[deprecated] - pub fn load(packed: PackedData, pw: &str, salt: &str) -> Option { + pub fn load(_packed: PackedData, _pw: &str, _salt: &str) -> Option { // let mut temp = Self::from_pw(pw, salt); // let k: Key = Key::decode(&String::from_utf8(temp.decrypt_primitive(&packed)?).ok()?).ok()?; diff --git a/lockchain-crypto/src/keyfold.rs b/lockchain-crypto/src/keyfold.rs index 2339a32..363ccab 100644 --- a/lockchain-crypto/src/keyfold.rs +++ b/lockchain-crypto/src/keyfold.rs @@ -1,10 +1,10 @@ //! Keyfolds map keys to encrypted keys -use lcc::crypto::{Key, KeyType}; -use lcc::traits::EncryptionHandler; -use lcc::EncryptedBody; +use crate::lcc::crypto::{Key, KeyType}; +use crate::lcc::traits::EncryptionHandler; +use crate::lcc::EncryptedBody; -use AesEngine; +use crate::AesEngine; /// Transparent key-encrypter utility /// @@ -38,11 +38,11 @@ impl Keyfold { } impl EncryptionHandler for Keyfold { - fn encrypt(&mut self, item: Key) -> EncryptedBody { + fn encrypt(&mut self, _item: Key) -> EncryptedBody { unimplemented!() } - fn decrypt(&mut self, item: EncryptedBody) -> Option { + fn decrypt(&mut self, _item: EncryptedBody) -> Option { unimplemented!() } } diff --git a/lockchain-crypto/src/lib.rs b/lockchain-crypto/src/lib.rs index 8e64a4c..a454a46 100644 --- a/lockchain-crypto/src/lib.rs +++ b/lockchain-crypto/src/lib.rs @@ -1,20 +1,15 @@ //! A shim-layer crate for lockchain encryption -//! +//! //! To get going with encrypted lockchain files, just initialise an //! AesEngine type and start working with encrypted types provided by //! some backend. -#[macro_use] -extern crate serde_derive; -extern crate serde; -extern crate miscreant; - extern crate lockchain_core as lcc; mod databody; mod engine; mod keyfold; -pub use databody::DataBody; -pub use engine::AesEngine; -pub use keyfold::Keyfold; \ No newline at end of file +pub use crate::databody::DataBody; +pub use crate::engine::AesEngine; +pub use crate::keyfold::Keyfold; \ No newline at end of file -- cgit v1.2.3