Key load avoid warning (#1303)
* avoid warning with key * fix intendations * more intendation fix * ok() instead of expect()
This commit is contained in:
parent
1baa150086
commit
b4aae6bd9c
@ -627,7 +627,10 @@ impl KeyDirectory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Checks if key exists
|
||||||
|
pub fn exists(&self, id: &Uuid) -> bool {
|
||||||
|
KeyDirectory::load_key(&self.key_path(id)).is_ok()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -348,6 +348,10 @@ impl SecretStore {
|
|||||||
|
|
||||||
garbage_lock.shrink_to_fit();
|
garbage_lock.shrink_to_fit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn exists(&self, key: &H128) -> bool {
|
||||||
|
self.directory.exists(key)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn derive_key_iterations(password: &str, salt: &H256, c: u32) -> (Bytes, Bytes) {
|
fn derive_key_iterations(password: &str, salt: &H256, c: u32) -> (Bytes, Bytes) {
|
||||||
@ -408,7 +412,7 @@ impl EncryptedHashMap<H128> for SecretStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn insert<Value: FromRawBytesVariable + BytesConvertable>(&mut self, key: H128, value: Value, password: &str) -> Option<Value> {
|
fn insert<Value: FromRawBytesVariable + BytesConvertable>(&mut self, key: H128, value: Value, password: &str) -> Option<Value> {
|
||||||
let previous = if let Ok(previous_value) = self.get(&key, password) { Some(previous_value) } else { None };
|
let previous = if !self.exists(&key) { None } else { self.get(&key, password).ok() };
|
||||||
|
|
||||||
// crypto random initiators
|
// crypto random initiators
|
||||||
let salt = H256::random();
|
let salt = H256::random();
|
||||||
|
Loading…
Reference in New Issue
Block a user