diff options
Diffstat (limited to 'lockchain-core/src/crypto')
-rw-r--r-- | lockchain-core/src/crypto/keystore.rs | 8 | ||||
-rw-r--r-- | lockchain-core/src/crypto/mod.rs | 9 | ||||
-rw-r--r-- | lockchain-core/src/crypto/passwords/mod.rs | 7 | ||||
-rw-r--r-- | lockchain-core/src/crypto/secrets.rs | 25 | ||||
-rw-r--r-- | lockchain-core/src/crypto/store.rs | 15 | ||||
-rw-r--r-- | lockchain-core/src/crypto/utils/encoding.rs (renamed from lockchain-core/src/crypto/encoding.rs) | 0 | ||||
-rw-r--r-- | lockchain-core/src/crypto/utils/hashing.rs (renamed from lockchain-core/src/crypto/hashing.rs) | 0 | ||||
-rw-r--r-- | lockchain-core/src/crypto/utils/mod.rs | 5 | ||||
-rw-r--r-- | lockchain-core/src/crypto/utils/random.rs (renamed from lockchain-core/src/crypto/random.rs) | 0 |
9 files changed, 56 insertions, 13 deletions
diff --git a/lockchain-core/src/crypto/keystore.rs b/lockchain-core/src/crypto/keystore.rs index 0f19e30..71d7be2 100644 --- a/lockchain-core/src/crypto/keystore.rs +++ b/lockchain-core/src/crypto/keystore.rs @@ -1,4 +1,10 @@ -//! A utility keystore module for the lockchain ecosystem +//! A keystore is a specific implementation of a metadata store +//! +//! At it's core it provides three simple functions +//! +//! - Adding keys for a user +//! - Removing keys +//! - Retrieving keys use traits::{AutoEncoder, Base64AutoEncoder}; use {crypto::Key, meta::MetaDomain}; diff --git a/lockchain-core/src/crypto/mod.rs b/lockchain-core/src/crypto/mod.rs index 671cff0..ad9c0e1 100644 --- a/lockchain-core/src/crypto/mod.rs +++ b/lockchain-core/src/crypto/mod.rs @@ -2,7 +2,6 @@ //! //! -mod data; /// We re-export keybob's API here mod keys { @@ -13,11 +12,11 @@ mod keys { impl AutoEncoder for KeyType {} } -// pub mod passwords; -pub mod encoding; +mod data; +mod utils; +pub use utils::*; pub mod keystore; -pub mod hashing; -pub mod random; +pub mod store; pub use self::data::PackedData; pub use self::keystore::KeyStore; diff --git a/lockchain-core/src/crypto/passwords/mod.rs b/lockchain-core/src/crypto/passwords/mod.rs deleted file mode 100644 index 331ec9d..0000000 --- a/lockchain-core/src/crypto/passwords/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! A series of password generators for user-facing applications - - - -pub enum PwType { - -} diff --git a/lockchain-core/src/crypto/secrets.rs b/lockchain-core/src/crypto/secrets.rs new file mode 100644 index 0000000..87e2c13 --- /dev/null +++ b/lockchain-core/src/crypto/secrets.rs @@ -0,0 +1,25 @@ + +/// Specifies the type of secret that's used to derive a vault user secret +pub enum SecretType { + /// A simple password + Plain, + /// A keyfile that allows asymetric trust operations + Keyfile, + /// Signing a user password with the id of a yubikey + Combine, +} + +/// 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, +/// then use asymmetric operations to verify operations more thoroughly. +pub struct UserSecret { + type: SecretType, + content: String, +} diff --git a/lockchain-core/src/crypto/store.rs b/lockchain-core/src/crypto/store.rs new file mode 100644 index 0000000..f57359d --- /dev/null +++ b/lockchain-core/src/crypto/store.rs @@ -0,0 +1,15 @@ + +use std::collections::HashMap; + +/// A thin user keystore +/// +/// It's implementation can manage multiple keys per user, of various +/// types and constrained for limited access rights. +pub struct KeyStore { + +} + +struct StoreUser { + name: String, + HashMap< +}
\ No newline at end of file diff --git a/lockchain-core/src/crypto/encoding.rs b/lockchain-core/src/crypto/utils/encoding.rs index 0c49490..0c49490 100644 --- a/lockchain-core/src/crypto/encoding.rs +++ b/lockchain-core/src/crypto/utils/encoding.rs diff --git a/lockchain-core/src/crypto/hashing.rs b/lockchain-core/src/crypto/utils/hashing.rs index 4a24a17..4a24a17 100644 --- a/lockchain-core/src/crypto/hashing.rs +++ b/lockchain-core/src/crypto/utils/hashing.rs diff --git a/lockchain-core/src/crypto/utils/mod.rs b/lockchain-core/src/crypto/utils/mod.rs new file mode 100644 index 0000000..d57689c --- /dev/null +++ b/lockchain-core/src/crypto/utils/mod.rs @@ -0,0 +1,5 @@ +//! A collection of common cryptography utilities. + +pub mod encoding; +pub mod random; +pub mod hashing;
\ No newline at end of file diff --git a/lockchain-core/src/crypto/random.rs b/lockchain-core/src/crypto/utils/random.rs index 7d31992..7d31992 100644 --- a/lockchain-core/src/crypto/random.rs +++ b/lockchain-core/src/crypto/utils/random.rs |