aboutsummaryrefslogtreecommitdiff
path: root/lockchain-core
diff options
context:
space:
mode:
Diffstat (limited to 'lockchain-core')
-rw-r--r--lockchain-core/Cargo.toml13
-rw-r--r--lockchain-core/src/crypto/data.rs5
-rw-r--r--lockchain-core/src/crypto/mod.rs2
-rw-r--r--lockchain-core/src/errors/auth.rs1
-rw-r--r--lockchain-core/src/errors/crypto.rs1
-rw-r--r--lockchain-core/src/errors/data.rs1
-rw-r--r--lockchain-core/src/errors/mod.rs3
-rw-r--r--lockchain-core/src/errors/vault.rs7
-rw-r--r--lockchain-core/src/init.rs15
-rw-r--r--lockchain-core/src/lib.rs13
-rw-r--r--lockchain-core/src/meta.rs7
-rw-r--r--lockchain-core/src/record.rs3
-rw-r--r--lockchain-core/src/traits.rs12
-rw-r--r--lockchain-core/src/users/auth.rs2
-rw-r--r--lockchain-core/src/users/mod.rs2
-rw-r--r--lockchain-core/src/users/rights.rs3
-rw-r--r--lockchain-core/src/users/secrets.rs9
-rw-r--r--lockchain-core/src/users/tokens.rs3
-rw-r--r--lockchain-core/src/users/user.rs5
-rw-r--r--lockchain-core/src/users/userstore.rs3
20 files changed, 55 insertions, 55 deletions
diff --git a/lockchain-core/Cargo.toml b/lockchain-core/Cargo.toml
index 4d6694c..b7dda71 100644
--- a/lockchain-core/Cargo.toml
+++ b/lockchain-core/Cargo.toml
@@ -7,19 +7,18 @@ readme = "README.md"
license = "MIT/X11 OR Apache-2.0"
version = "0.9.1-alpha.0"
authors = ["Katharina Fey <kookie@spacekookie.de>"]
+edition = "2018"
[dependencies]
chrono = { version = "0.4", features = ["serde"] }
-serde_derive = "1.0"
+serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
-serde = "1.0"
-nix = "0.11"
-pam-auth = "0.5"
+nix = "0.13"
+pam = "0.7"
-base64 = "0.8"
-bcrypt = "0.2"
+base64 = "0.10"
+bcrypt = "0.4"
rand = "0.4"
blake2 = "0.7"
-
keybob = "0.3"
diff --git a/lockchain-core/src/crypto/data.rs b/lockchain-core/src/crypto/data.rs
index 2ee8a9a..f1ed15c 100644
--- a/lockchain-core/src/crypto/data.rs
+++ b/lockchain-core/src/crypto/data.rs
@@ -1,7 +1,8 @@
-use traits::AutoEncoder;
+use crate::traits::AutoEncoder;
+use serde::{Serialize, Deserialize};
/// Representation of encrypted data as an enecoded format
-///
+///
/// Includes all cryptographic state primitives that are
/// required to send the data over a network and decrypt on
/// the other side of a pipe.
diff --git a/lockchain-core/src/crypto/mod.rs b/lockchain-core/src/crypto/mod.rs
index 2090e69..6a1c45e 100644
--- a/lockchain-core/src/crypto/mod.rs
+++ b/lockchain-core/src/crypto/mod.rs
@@ -6,7 +6,7 @@
/// We re-export keybob's API here
mod keys {
pub use keybob::{Key, KeyType};
- use traits::{AutoEncoder, Encryptable};
+ use crate::traits::{AutoEncoder, Encryptable};
impl AutoEncoder for Key {}
impl AutoEncoder for KeyType {}
diff --git a/lockchain-core/src/errors/auth.rs b/lockchain-core/src/errors/auth.rs
index 32ce33a..4e2332f 100644
--- a/lockchain-core/src/errors/auth.rs
+++ b/lockchain-core/src/errors/auth.rs
@@ -2,6 +2,7 @@
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 a0c12a2..e33b718 100644
--- a/lockchain-core/src/errors/crypto.rs
+++ b/lockchain-core/src/errors/crypto.rs
@@ -2,6 +2,7 @@
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 519ae88..fec14ba 100644
--- a/lockchain-core/src/errors/data.rs
+++ b/lockchain-core/src/errors/data.rs
@@ -2,6 +2,7 @@
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 5cfd944..0355998 100644
--- a/lockchain-core/src/errors/mod.rs
+++ b/lockchain-core/src/errors/mod.rs
@@ -19,6 +19,7 @@ pub use self::vault::Error as VaultError;
use std::error::Error as StdError;
use std::fmt::{Display, Formatter, Result};
+use serde::{Serialize, Deserialize};
#[derive(Debug, Serialize, Deserialize)]
pub enum Error {
@@ -26,7 +27,7 @@ pub enum Error {
/// that can't be associated with a type or
/// simply need to be stubbed until more
/// information is available.
- Unknown,
+ Unknown,
/// A basic vault operation error
Vault(VaultError),
/// Errors occuring during authentication
diff --git a/lockchain-core/src/errors/vault.rs b/lockchain-core/src/errors/vault.rs
index 37d8662..5d3fb6e 100644
--- a/lockchain-core/src/errors/vault.rs
+++ b/lockchain-core/src/errors/vault.rs
@@ -2,6 +2,7 @@
use std::error::Error as StdError;
use std::fmt::{Display, Formatter, Result};
+use serde::{Serialize, Deserialize};
#[derive(Debug, Serialize, Deserialize)]
pub enum Error {
@@ -14,7 +15,7 @@ pub enum Error {
/// The provided path is invalid
InvalidPath,
/// The provided name is invalid
- ///
+ ///
/// This usually means the backing storage doesn't support some
/// character in the name which can sometimes occur if the name
/// contains special unicode characters that a filesystem doesn't
@@ -26,7 +27,7 @@ pub enum Error {
tt: Option<String>,
},
/// Vault failed it's checksum self-test
- ///
+ ///
/// This is problematic because it also means the vault was unable to correct
/// any errors. Either the backing storage has some serious issues or maybe
/// an external sync process that lockchain can't detect is still working.
@@ -38,7 +39,7 @@ pub enum Error {
/// Failed to load a vault for an unknown reason
FailedLoading,
/// Failed to close the vault properly.
- ///
+ ///
/// This could be because the backing storage is no longer available
/// or permisions to write have been revoked.
FailedClosing,
diff --git a/lockchain-core/src/init.rs b/lockchain-core/src/init.rs
index 410974a..2fad6fc 100644
--- a/lockchain-core/src/init.rs
+++ b/lockchain-core/src/init.rs
@@ -1,18 +1,19 @@
-use errors::VaultError;
-use traits::{Body, Vault};
+use crate::errors::VaultError;
+use crate::traits::{Body, Vault};
+use serde::{Serialize, Deserialize};
/// Describes the internal permission layout of a vault
-///
+///
/// ---
-///
+///
/// **Important Note** Because lockchain-core doesn't make assumptions about
/// about the existence of a cryptographic layer, the `UserStore` that
/// handles these secrets assumes they are **not** secret!
-///
+///
/// This means that only already encrypted keys should be given to the
/// generator type, because they will be written to disk **as is** by
/// certain backends!
-///
+///
/// It is in the responsibility of the library user to make sure that all
/// cryptographic operations are handled on the client side. Clear-text
/// keys that are given to a generator
@@ -21,7 +22,7 @@ use traits::{Body, Vault};
pub enum VaultType {
/// Create an all-powerful root user which can access everything
Administrated {
- ///
+ ///
secret: Vec<u8>,
},
/// Similar to `Administrated`
diff --git a/lockchain-core/src/lib.rs b/lockchain-core/src/lib.rs
index bdcebdc..bfe014f 100644
--- a/lockchain-core/src/lib.rs
+++ b/lockchain-core/src/lib.rs
@@ -56,19 +56,6 @@
//!
//! If we missed something, please let us know!
-#[macro_use]
-extern crate serde_derive;
-extern crate base64;
-extern crate bcrypt;
-extern crate blake2;
-extern crate chrono;
-extern crate keybob;
-extern crate nix;
-extern crate pam_auth;
-extern crate rand;
-extern crate serde;
-extern crate serde_json;
-
pub mod crypto;
pub mod errors;
mod meta;
diff --git a/lockchain-core/src/meta.rs b/lockchain-core/src/meta.rs
index 74b998d..c46cd95 100644
--- a/lockchain-core/src/meta.rs
+++ b/lockchain-core/src/meta.rs
@@ -4,9 +4,10 @@
//! as the normal Vault Record, without having to rely on encryption
//! or trait base security.
-use record::Payload;
+use crate::record::Payload;
use std::collections::HashMap;
-use traits::{AutoEncoder, Body};
+use crate::traits::{AutoEncoder, Body};
+use serde::{Serialize, Deserialize};
/// A simple representation of metadata for a vault or vault section
pub struct VaultMetadata {
@@ -60,7 +61,7 @@ impl MetaDomain {
}
/// Insert a single value into the body
- pub fn insert<S: Into<String>>(&mut self, key: S, value: Payload) -> &mut Self {
+ pub fn insert<S: Into<String>>(&mut self, _key: S, _value: Payload) -> &mut Self {
unimplemented!()
}
diff --git a/lockchain-core/src/record.rs b/lockchain-core/src/record.rs
index ac913b4..8f17468 100644
--- a/lockchain-core/src/record.rs
+++ b/lockchain-core/src/record.rs
@@ -10,8 +10,9 @@
//! **No secret information should ever be stored in the header**
use chrono::{DateTime, Local};
+use serde::{Serialize, Deserialize};
use std::collections::BTreeMap;
-use traits::{AutoEncoder, Body};
+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 babd489..eb7c99b 100644
--- a/lockchain-core/src/traits.rs
+++ b/lockchain-core/src/traits.rs
@@ -11,12 +11,12 @@
//! compilation work without external crates but not calling
//! functions at runtime.
-use errors::VaultError;
-use init::Generator;
-use meta::{MetaDomain, VaultMetadata};
-use record::{EncryptedBody, Header, Payload, Record};
+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 users::{Access, Token};
+use crate::users::{Access, Token};
use base64;
use serde_json::{self, Error as SerdeError};
@@ -118,7 +118,7 @@ where
T: Body,
{
/// Consumes a vault generator to construct a vault
- fn new(Generator) -> Result<Box<Self>, VaultError>;
+ fn new(_: Generator) -> Result<Box<Self>, VaultError>;
/// Load and open an existing vault
fn load(name: &str, location: &str) -> Result<Box<Self>, VaultError>;
/// Unlock the vault for a specific user
diff --git a/lockchain-core/src/users/auth.rs b/lockchain-core/src/users/auth.rs
index e5e8178..ffedb49 100644
--- a/lockchain-core/src/users/auth.rs
+++ b/lockchain-core/src/users/auth.rs
@@ -3,7 +3,7 @@
//! The way a user is authenticated is via the `lockchain` group
//! and a simple writing/ deleting of a lock file.
-use errors::AuthError;
+use crate::errors::AuthError;
/// Simple way to authenticate a user for administrative actions
///
diff --git a/lockchain-core/src/users/mod.rs b/lockchain-core/src/users/mod.rs
index 392e008..ac1c59d 100644
--- a/lockchain-core/src/users/mod.rs
+++ b/lockchain-core/src/users/mod.rs
@@ -27,4 +27,4 @@ pub use self::user::User;
pub use self::userstore::UserStore;
pub use self::rights::{Access, Role};
-pub use errors::AuthError;
+pub use crate::errors::AuthError;
diff --git a/lockchain-core/src/users/rights.rs b/lockchain-core/src/users/rights.rs
index b9ea6cd..635df3c 100644
--- a/lockchain-core/src/users/rights.rs
+++ b/lockchain-core/src/users/rights.rs
@@ -1,6 +1,7 @@
//! Permission and access system for lockchain
-use traits::AutoEncoder;
+use crate::traits::AutoEncoder;
+use serde::{Serialize, Deserialize};
/// 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 2b4d45a..6c22293 100644
--- a/lockchain-core/src/users/secrets.rs
+++ b/lockchain-core/src/users/secrets.rs
@@ -1,6 +1,7 @@
//! A secrets type module that wraps around some user content with metadata
-use traits::AutoEncoder;
+use crate::traits::AutoEncoder;
+use serde::{Serialize, Deserialize};
/// Specifies the type of secret that's used to derive a vault user secret
#[derive(Serialize, Deserialize)]
@@ -16,14 +17,14 @@ pub enum SecretType {
impl AutoEncoder for SecretType {}
/// The backing secret for user authentication
-///
+///
/// This is _always_ in a non-recoverable form, i.e. a hash
/// and salted password. **However** it does reveal something
/// about the user setup, i.e. the type of secret used.
-///
+///
/// Depending on what secret is used, there are other operations that
/// might be supported to verify operations. For example, a `Keyfile`
-/// secret can deposit the entire public key in the `content` field,
+/// secret can deposit the entire public key in the `content` field,
/// then use asymmetric operations to verify operations more thoroughly.
#[derive(Serialize, Deserialize)]
pub struct UserSecret {
diff --git a/lockchain-core/src/users/tokens.rs b/lockchain-core/src/users/tokens.rs
index 535fdb9..3f29af1 100644
--- a/lockchain-core/src/users/tokens.rs
+++ b/lockchain-core/src/users/tokens.rs
@@ -1,4 +1,5 @@
-use crypto::{Key, KeyType};
+use crate::crypto::{Key, KeyType};
+use serde::{Serialize, Deserialize};
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 1f7c9a5..beaba1a 100644
--- a/lockchain-core/src/users/user.rs
+++ b/lockchain-core/src/users/user.rs
@@ -1,9 +1,10 @@
//! User representation module
use super::rights::{Access, Role};
-use crypto::{encoding, hashing, random};
+use crate::crypto::{encoding, hashing, random};
use std::collections::HashMap;
-use traits::AutoEncoder;
+use crate::traits::AutoEncoder;
+use serde::{Serialize, Deserialize};
/// A generic user representation
///
diff --git a/lockchain-core/src/users/userstore.rs b/lockchain-core/src/users/userstore.rs
index 51d78a8..10a2858 100644
--- a/lockchain-core/src/users/userstore.rs
+++ b/lockchain-core/src/users/userstore.rs
@@ -2,7 +2,8 @@
use super::rights::Access;
use std::collections::HashMap;
-use traits::AutoEncoder;
+use crate::traits::AutoEncoder;
+use serde::{Serialize, Deserialize};
/// A thin user UserStore
///