passing key path to all invocations

This commit is contained in:
NikVolf
2016-04-06 14:03:53 +03:00
parent d01a79f58f
commit 8b3e84f7fe
2 changed files with 14 additions and 5 deletions

View File

@@ -128,7 +128,7 @@ impl Default for AccountService {
}
impl AccountService {
/// New account service with the default location
/// New account service with the keys store in default location
pub fn new() -> Self {
let secret_store = RwLock::new(SecretStore::new());
secret_store.write().unwrap().try_import_existing();
@@ -137,6 +137,15 @@ impl AccountService {
}
}
/// New account service with the keys store in specific location
pub fn new_in(path: &Path) -> Self {
let secret_store = RwLock::new(SecretStore::new_in(path));
secret_store.write().unwrap().try_import_existing();
AccountService {
secret_store: secret_store
}
}
#[cfg(test)]
fn new_test(temp: &::devtools::RandomTempPath) -> Self {
let secret_store = RwLock::new(SecretStore::new_test(temp));