fix key deletion in fido2

This commit is contained in:
bunnie 2023-01-25 22:36:15 +08:00
parent 8974a86f24
commit e9ae3fe72b

View file

@ -502,14 +502,18 @@ impl<'a> ActionManager<'a> {
if choice.is_none() { if choice.is_none() {
// we're dealing with FIDO stuff, use the custom code path // we're dealing with FIDO stuff, use the custom code path
match self.pddb.borrow().get(U2F_APP_DICT, entry.key_name.as_str().unwrap_or("UTF8-error"), let dictionary = match entry.key_name.as_str().unwrap_or("UTF8-error").parse::<usize>() {
None, false, false, None, None::<fn()> Ok(fido_key) => persistent_store::store::OPENSK2_DICT,
Err(_) => U2F_APP_DICT,
};
match self.pddb.borrow().get(dictionary, entry.key_name.as_str().unwrap_or("UTF8-error"),
None, false, false, None, None::<fn()>
) { ) {
Ok(candidate) => { Ok(candidate) => {
let attr = candidate.attributes().expect("couldn't get key attributes"); let attr = candidate.attributes().expect("couldn't get key attributes");
match self.pddb.borrow() match self.pddb.borrow()
.delete_key( .delete_key(
U2F_APP_DICT, dictionary,
entry.key_name.as_str().unwrap_or("UTF8-error"), entry.key_name.as_str().unwrap_or("UTF8-error"),
Some(&attr.basis) Some(&attr.basis)
) { ) {
@ -519,7 +523,7 @@ impl<'a> ActionManager<'a> {
Err(e) => self.report_err(t!("vault.error.internal_error", xous::LANG), Some(e)), Err(e) => self.report_err(t!("vault.error.internal_error", xous::LANG), Some(e)),
} }
} }
Err(e) => { Err(e) => {
self.report_err(t!("vault.error.not_found", xous::LANG), Some(e)); self.report_err(t!("vault.error.not_found", xous::LANG), Some(e));
} }
} }