aboutsummaryrefslogtreecommitdiff
path: root/lockchain-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'lockchain-core/src')
-rw-r--r--lockchain-core/src/traits.rs15
-rw-r--r--lockchain-core/src/users/tokens.rs6
2 files changed, 13 insertions, 8 deletions
diff --git a/lockchain-core/src/traits.rs b/lockchain-core/src/traits.rs
index 9cd77b0..a3af268 100644
--- a/lockchain-core/src/traits.rs
+++ b/lockchain-core/src/traits.rs
@@ -55,10 +55,8 @@ pub trait LoadRecord<T: Body> {
/// Additional functions might be added to this trait further down
/// the road but for now, it's really just a marker that you can easily
/// implement for any type that's also `AutoEncoder`
-///
-/// ```rust, norun
-/// impl Encryptable for YourSpecialType {}
-/// ```
+///
+// TODO: Add documentation test code in again
pub trait Encryptable: AutoEncoder {}
/// A base trait that describes the basic functionality of
@@ -132,15 +130,22 @@ where
/// End a specific user session
fn deauthenticate(&mut self, username: &str, _: Token);
/// Create a new user with a list of initial access rights
+ ///
+ /// **Important Note** A backend can make no guarantee for the safety
+ /// of it's persistence. This means that a client library author is
+ /// responsible for encrypting all required secrets **before** submitting
+ /// them to a vault backend!
fn create_user(
&mut self,
token: Token,
username: &str,
- secret: &str,
+ secret: Vec<u8>,
access: Vec<Access>,
) -> Result<(), ()>;
/// Delete a user
fn delete_user(&mut self, token: Token, username: &str);
+ // / Modify user data, if authenticated as said user
+ // fn modify_user(&mut self, token: Token, username: &str) -> Option<&mut User>;
/// Get basic vault metadata
fn metadata(&self) -> VaultMetadata;
diff --git a/lockchain-core/src/users/tokens.rs b/lockchain-core/src/users/tokens.rs
index 1c62c7a..535fdb9 100644
--- a/lockchain-core/src/users/tokens.rs
+++ b/lockchain-core/src/users/tokens.rs
@@ -4,14 +4,14 @@ use std::borrow::Cow;
/// An authentication token that can be compared in constant time
///
/// ```
-/// use lockchain_core::users::auth::Token;
+/// use lockchain_core::users::Token;
/// let t1 = Token::new();
/// let t2 = Token::new();
///
/// // Will fail, but no expose failure length
-/// assert_eq!(t1, t2);
+/// assert!(t1 != t2);
/// ```
-#[derive(PartialEq, Eq, Serialize, Deserialize, Clone)]
+#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
pub struct Token {
inner: Key,
}