aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2018-09-16 13:18:02 +0100
committerKatharina Fey <kookie@spacekookie.de>2018-09-16 13:18:02 +0100
commitc6a21b51e6c98a033c8d4ec7b2729714fa69125f (patch)
treed715021704176ea8adf08a4959780e529a6ea7fa
parent366bfc313d84c5eb39896a3cd0a2d344740969f2 (diff)
Fixing documentation test cases
-rw-r--r--lockchain-core/src/traits.rs15
-rw-r--r--lockchain-core/src/users/tokens.rs6
-rw-r--r--lockchain-files/src/lib.rs2
-rw-r--r--lockchain-http/src/state.rs2
4 files changed, 15 insertions, 10 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,
}
diff --git a/lockchain-files/src/lib.rs b/lockchain-files/src/lib.rs
index 8332448..62147e3 100644
--- a/lockchain-files/src/lib.rs
+++ b/lockchain-files/src/lib.rs
@@ -88,7 +88,7 @@ impl<T: Body> Vault<T> for FileVault<T> {
&mut self,
token: Token,
username: &str,
- secret: &str,
+ secret: Vec<u8>,
access: Vec<Access>,
) -> Result<(), ()> {
unimplemented!()
diff --git a/lockchain-http/src/state.rs b/lockchain-http/src/state.rs
index 5cfc8ad..c89125e 100644
--- a/lockchain-http/src/state.rs
+++ b/lockchain-http/src/state.rs
@@ -16,7 +16,7 @@ use std::path::PathBuf;
/// It provides some simple query functions for handlers to work on,
/// as well as expose raw configuration fields to be written
///
-/// ```
+/// ```norun
/// let state: ApiState<B, V> = ApiState {
/// bound_scope: false,
/// working_dir: ".".into(),