Removing existing secrets before creating a new one

This commit is contained in:
Daniel García Moreno 2017-08-18 17:52:36 +02:00
parent 6bb87944af
commit 96c94f1797

View file

@ -147,6 +147,14 @@ impl AppOp {
let ss = SecretService::new(EncryptionType::Dh)?;
let collection = ss.get_default_collection()?;
// deleting previous items
let allpass = collection.get_all_items()?;
let passwds = allpass.iter()
.filter(|x| x.get_label().unwrap_or(String::from("")) == "guillotine");
for p in passwds {
p.delete()?;
}
// create new item
collection.create_item(
"guillotine", // label