aboutsummaryrefslogtreecommitdiff
path: root/lockchain-core/src/users/store.rs
blob: d400668f0bc9c1e4eaca215de1eb7ed1f178a9b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use super::rights::Access;
use super::secrets::SecretType;
use crypto::Key;
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 {
    store: HashMap<String, StoreUser>,
}

struct StoreUser {
    name: String,
    keys: HashMap<Access, Key>,
}

impl KeyStore {
    /// Create a new, empty keystore
    ///
    /// This is most likely *not* what you want. Instead, transform
    /// a `MetaData` object into a keystore.
    pub fn new() -> Self {
        Self {
            store: HashMap::new(),
        }
    }

    pub fn add_user(&mut self) {}

    pub fn rm_user(&mut self) {}

    pub fn add_key(&mut self, user: String, k: Key, access: Access) {}

    pub fn get_key(&self, user: String, access: Access) -> &Key {
        unimplemented!()
    }
}