aboutsummaryrefslogtreecommitdiff
path: root/lockchain-core/src
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2019-04-22 02:17:36 +0200
committerKatharina Fey <kookie@spacekookie.de>2019-04-22 02:17:36 +0200
commit16522d90a7ad626bb36d57fbc24076bb01ce8616 (patch)
treea3b3a5bb6a5b1826ebe4807e40df1be45ff9b292 /lockchain-core/src
parentf12fae4479c5b97ab37823d7aa58d9156e2fc3ad (diff)
Running rustfmt
Diffstat (limited to 'lockchain-core/src')
-rw-r--r--lockchain-core/src/crypto/data.rs4
-rw-r--r--lockchain-core/src/crypto/encoding.rs2
-rw-r--r--lockchain-core/src/crypto/mod.rs11
-rw-r--r--lockchain-core/src/errors/auth.rs2
-rw-r--r--lockchain-core/src/errors/crypto.rs2
-rw-r--r--lockchain-core/src/errors/data.rs2
-rw-r--r--lockchain-core/src/errors/mod.rs2
-rw-r--r--lockchain-core/src/errors/vault.rs2
-rw-r--r--lockchain-core/src/init.rs2
-rw-r--r--lockchain-core/src/lib.rs4
-rw-r--r--lockchain-core/src/meta.rs4
-rw-r--r--lockchain-core/src/record.rs4
-rw-r--r--lockchain-core/src/traits.rs2
-rw-r--r--lockchain-core/src/users/auth.rs2
-rw-r--r--lockchain-core/src/users/rights.rs2
-rw-r--r--lockchain-core/src/users/secrets.rs2
-rw-r--r--lockchain-core/src/users/tokens.rs2
-rw-r--r--lockchain-core/src/users/user.rs4
-rw-r--r--lockchain-core/src/users/userstore.rs4
19 files changed, 29 insertions, 30 deletions
diff --git a/lockchain-core/src/crypto/data.rs b/lockchain-core/src/crypto/data.rs
index f1ed15c..4655a02 100644
--- a/lockchain-core/src/crypto/data.rs
+++ b/lockchain-core/src/crypto/data.rs
@@ -1,5 +1,5 @@
use crate::traits::AutoEncoder;
-use serde::{Serialize, Deserialize};
+use serde::{Deserialize, Serialize};
/// Representation of encrypted data as an enecoded format
///
@@ -13,4 +13,4 @@ pub struct PackedData {
pub data: Vec<u8>,
}
-impl AutoEncoder for PackedData {} \ No newline at end of file
+impl AutoEncoder for PackedData {}
diff --git a/lockchain-core/src/crypto/encoding.rs b/lockchain-core/src/crypto/encoding.rs
index 0c49490..bc72c02 100644
--- a/lockchain-core/src/crypto/encoding.rs
+++ b/lockchain-core/src/crypto/encoding.rs
@@ -21,4 +21,4 @@ pub fn encode_hex(data: &str) -> String {
}
return s;
-} \ No newline at end of file
+}
diff --git a/lockchain-core/src/crypto/mod.rs b/lockchain-core/src/crypto/mod.rs
index 6a1c45e..c0c0c59 100644
--- a/lockchain-core/src/crypto/mod.rs
+++ b/lockchain-core/src/crypto/mod.rs
@@ -1,24 +1,23 @@
//! Shared cryptographic primitives and utilities
-//!
-//!
-
+//!
+//!
/// We re-export keybob's API here
mod keys {
- pub use keybob::{Key, KeyType};
use crate::traits::{AutoEncoder, Encryptable};
+ pub use keybob::{Key, KeyType};
impl AutoEncoder for Key {}
impl AutoEncoder for KeyType {}
-
+
impl Encryptable for Key {}
impl Encryptable for KeyType {}
}
mod data;
pub mod encoding;
-pub mod random;
pub mod hashing;
+pub mod random;
pub use self::data::PackedData;
pub use self::keys::{Key, KeyType};
diff --git a/lockchain-core/src/errors/auth.rs b/lockchain-core/src/errors/auth.rs
index 4e2332f..c86a741 100644
--- a/lockchain-core/src/errors/auth.rs
+++ b/lockchain-core/src/errors/auth.rs
@@ -1,8 +1,8 @@
//! Athentication errors
+use serde::{Deserialize, Serialize};
use std::error::Error as StdError;
use std::fmt::{Display, Formatter, Result};
-use serde::{Serialize, Deserialize};
/// Common errors that can occur when authenticating users
#[derive(Debug, Serialize, Deserialize)]
diff --git a/lockchain-core/src/errors/crypto.rs b/lockchain-core/src/errors/crypto.rs
index e33b718..018b68d 100644
--- a/lockchain-core/src/errors/crypto.rs
+++ b/lockchain-core/src/errors/crypto.rs
@@ -1,8 +1,8 @@
//! I sell crypto and crypto accessories (errors)
+use serde::{Deserialize, Serialize};
use std::error::Error as StdError;
use std::fmt::{Display, Formatter, Result};
-use serde::{Serialize, Deserialize};
#[derive(Debug, Serialize, Deserialize)]
pub enum Error {
diff --git a/lockchain-core/src/errors/data.rs b/lockchain-core/src/errors/data.rs
index fec14ba..c23cb65 100644
--- a/lockchain-core/src/errors/data.rs
+++ b/lockchain-core/src/errors/data.rs
@@ -1,8 +1,8 @@
//! Data integrity errors
+use serde::{Deserialize, Serialize};
use std::error::Error as StdError;
use std::fmt::{Display, Formatter, Result};
-use serde::{Serialize, Deserialize};
#[derive(Debug, Serialize, Deserialize)]
pub enum Error {
diff --git a/lockchain-core/src/errors/mod.rs b/lockchain-core/src/errors/mod.rs
index 0355998..86e344f 100644
--- a/lockchain-core/src/errors/mod.rs
+++ b/lockchain-core/src/errors/mod.rs
@@ -17,9 +17,9 @@ pub use self::crypto::Error as CryptoError;
pub use self::data::Error as DataError;
pub use self::vault::Error as VaultError;
+use serde::{Deserialize, Serialize};
use std::error::Error as StdError;
use std::fmt::{Display, Formatter, Result};
-use serde::{Serialize, Deserialize};
#[derive(Debug, Serialize, Deserialize)]
pub enum Error {
diff --git a/lockchain-core/src/errors/vault.rs b/lockchain-core/src/errors/vault.rs
index 5d3fb6e..475242c 100644
--- a/lockchain-core/src/errors/vault.rs
+++ b/lockchain-core/src/errors/vault.rs
@@ -1,8 +1,8 @@
//! Vault workflow and I/O errors
+use serde::{Deserialize, Serialize};
use std::error::Error as StdError;
use std::fmt::{Display, Formatter, Result};
-use serde::{Serialize, Deserialize};
#[derive(Debug, Serialize, Deserialize)]
pub enum Error {
diff --git a/lockchain-core/src/init.rs b/lockchain-core/src/init.rs
index 2fad6fc..8fa2ccc 100644
--- a/lockchain-core/src/init.rs
+++ b/lockchain-core/src/init.rs
@@ -1,6 +1,6 @@
use crate::errors::VaultError;
use crate::traits::{Body, Vault};
-use serde::{Serialize, Deserialize};
+use serde::{Deserialize, Serialize};
/// Describes the internal permission layout of a vault
///
diff --git a/lockchain-core/src/lib.rs b/lockchain-core/src/lib.rs
index bfe014f..385f674 100644
--- a/lockchain-core/src/lib.rs
+++ b/lockchain-core/src/lib.rs
@@ -66,14 +66,14 @@ pub mod users;
mod init;
pub use self::crypto::PackedData;
+pub use self::init::{Generator, VaultType};
pub use self::meta::{MetaDomain, VaultMetadata};
pub use self::record::{EncryptedBody, Header, Payload, Record};
-pub use self::init::{VaultType, Generator};
/// Export commonly used types via the prelude
pub mod prelude {
pub use super::crypto::PackedData;
+ pub use super::init::{Generator, VaultType};
pub use super::meta::{MetaDomain, VaultMetadata};
pub use super::record::{EncryptedBody, Header, Payload, Record};
- pub use super::init::{VaultType, Generator};
}
diff --git a/lockchain-core/src/meta.rs b/lockchain-core/src/meta.rs
index c46cd95..91c7f39 100644
--- a/lockchain-core/src/meta.rs
+++ b/lockchain-core/src/meta.rs
@@ -5,9 +5,9 @@
//! or trait base security.
use crate::record::Payload;
-use std::collections::HashMap;
use crate::traits::{AutoEncoder, Body};
-use serde::{Serialize, Deserialize};
+use serde::{Deserialize, Serialize};
+use std::collections::HashMap;
/// A simple representation of metadata for a vault or vault section
pub struct VaultMetadata {
diff --git a/lockchain-core/src/record.rs b/lockchain-core/src/record.rs
index 8f17468..a41f181 100644
--- a/lockchain-core/src/record.rs
+++ b/lockchain-core/src/record.rs
@@ -9,10 +9,10 @@
//!
//! **No secret information should ever be stored in the header**
+use crate::traits::{AutoEncoder, Body};
use chrono::{DateTime, Local};
-use serde::{Serialize, Deserialize};
+use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
-use crate::traits::{AutoEncoder, Body};
/// An enum that wraps around all possible data types to store
/// as the value of a vault record.
diff --git a/lockchain-core/src/traits.rs b/lockchain-core/src/traits.rs
index eb7c99b..d58707b 100644
--- a/lockchain-core/src/traits.rs
+++ b/lockchain-core/src/traits.rs
@@ -15,8 +15,8 @@ use crate::errors::VaultError;
use crate::init::Generator;
use crate::meta::{MetaDomain, VaultMetadata};
use crate::record::{EncryptedBody, Header, Payload, Record};
-use serde::{de::DeserializeOwned, Serialize};
use crate::users::{Access, Token};
+use serde::{de::DeserializeOwned, Serialize};
use base64;
use serde_json::{self, Error as SerdeError};
diff --git a/lockchain-core/src/users/auth.rs b/lockchain-core/src/users/auth.rs
index ffedb49..8b18de6 100644
--- a/lockchain-core/src/users/auth.rs
+++ b/lockchain-core/src/users/auth.rs
@@ -24,4 +24,4 @@ pub fn pam_authenticate(username: &str, password: &str) -> Result<(), AuthError>
// pub fn yubikey_authenticate(username: &str, yubi_id: &str) -> Result<(), AuthError> {
// unimplemented!()
-// } \ No newline at end of file
+// }
diff --git a/lockchain-core/src/users/rights.rs b/lockchain-core/src/users/rights.rs
index 635df3c..4d4a7a7 100644
--- a/lockchain-core/src/users/rights.rs
+++ b/lockchain-core/src/users/rights.rs
@@ -1,7 +1,7 @@
//! Permission and access system for lockchain
use crate::traits::AutoEncoder;
-use serde::{Serialize, Deserialize};
+use serde::{Deserialize, Serialize};
/// Specifies access to a resource
#[derive(Hash, Serialize, Deserialize, Clone, PartialEq, Eq)]
diff --git a/lockchain-core/src/users/secrets.rs b/lockchain-core/src/users/secrets.rs
index 6c22293..64f887d 100644
--- a/lockchain-core/src/users/secrets.rs
+++ b/lockchain-core/src/users/secrets.rs
@@ -1,7 +1,7 @@
//! A secrets type module that wraps around some user content with metadata
use crate::traits::AutoEncoder;
-use serde::{Serialize, Deserialize};
+use serde::{Deserialize, Serialize};
/// Specifies the type of secret that's used to derive a vault user secret
#[derive(Serialize, Deserialize)]
diff --git a/lockchain-core/src/users/tokens.rs b/lockchain-core/src/users/tokens.rs
index 3f29af1..c5b3655 100644
--- a/lockchain-core/src/users/tokens.rs
+++ b/lockchain-core/src/users/tokens.rs
@@ -1,5 +1,5 @@
use crate::crypto::{Key, KeyType};
-use serde::{Serialize, Deserialize};
+use serde::{Deserialize, Serialize};
use std::borrow::Cow;
/// An authentication token that can be compared in constant time
diff --git a/lockchain-core/src/users/user.rs b/lockchain-core/src/users/user.rs
index beaba1a..9538708 100644
--- a/lockchain-core/src/users/user.rs
+++ b/lockchain-core/src/users/user.rs
@@ -2,9 +2,9 @@
use super::rights::{Access, Role};
use crate::crypto::{encoding, hashing, random};
-use std::collections::HashMap;
use crate::traits::AutoEncoder;
-use serde::{Serialize, Deserialize};
+use serde::{Deserialize, Serialize};
+use std::collections::HashMap;
/// A generic user representation
///
diff --git a/lockchain-core/src/users/userstore.rs b/lockchain-core/src/users/userstore.rs
index 10a2858..ae76900 100644
--- a/lockchain-core/src/users/userstore.rs
+++ b/lockchain-core/src/users/userstore.rs
@@ -1,9 +1,9 @@
//! Merging `KeyStore` and `Userstore` into the same concept
use super::rights::Access;
-use std::collections::HashMap;
use crate::traits::AutoEncoder;
-use serde::{Serialize, Deserialize};
+use serde::{Deserialize, Serialize};
+use std::collections::HashMap;
/// A thin user UserStore
///