fix some minor bugs

- test entries for passwords at 100 entries. it's...pretty slow
at 300 passwords, about 8 seconds to scan/read-in the database.
once the database is read-in, sorting and viewing is fast. good
news is that heap usage is about 300k for that many entries,
no OOM crashes found. just slow.

- fix an unimplemented()! error

- strip out some debug
This commit is contained in:
bunnie 2022-06-24 17:23:00 +08:00
parent 847e64c46a
commit 3c82898780
2 changed files with 6 additions and 6 deletions

View file

@ -459,7 +459,7 @@ impl ActionManager {
let dict = match entry.mode {
VaultMode::Password => VAULT_PASSWORD_DICT,
VaultMode::Fido => crate::fido::U2F_APP_DICT,
VaultMode::Totp => unimplemented!(),
VaultMode::Totp => VAULT_TOTP_DICT,
};
match entry.mode {
VaultMode::Password => {
@ -885,13 +885,13 @@ impl ActionManager {
"._weird~yy%\":'test", "//WHYwhyWHY", "Xyz|zy", "foo:bar", "f🍕🍔🍟🌭d", "💎🙌", "some ノート", "笔录4u", "@u", "sane text", "Käsesoßenrührlöffel"];
let weights = [1; 21];
const TARGET_ENTRIES: usize = 35;
const TARGET_ENTRIES_PW: usize = 300;
const TARGET_ENTRIES_PW: usize = 100;
// for each database, populate up to TARGET_ENTRIES
// as this is testing code, it's written a bit more fragile in terms of error handling (fail-panic, rather than fail-dialog)
// --- passwords ---
let pws = self.pddb.borrow().list_keys(VAULT_PASSWORD_DICT, None).unwrap_or(Vec::new());
if pws.len() < TARGET_ENTRIES_PW {
let extra_count = TARGET_ENTRIES - pws.len();
let extra_count = TARGET_ENTRIES_PW - pws.len();
for _ in 0..extra_count {
let desc = random_pick::pick_multiple_from_slice(&words, &weights, 3);
let description = format!("{} {} {}", desc[0], desc[1], desc[2]);
@ -981,10 +981,10 @@ impl ActionManager {
}
let xns = xous_names::XousNames::new().unwrap();
let mut rng = ctap_crypto::rng256::XousRng256::new(&xns);
for _ in 0..extra_fido {
for index in 0..extra_fido {
use crate::ctap::data_formats::*;
let c_id = random_pick::pick_multiple_from_slice(&words, &weights, 2);
let cred_id = format!("{} {}", c_id[0], c_id[1]);
let cred_id = format!("{} {} {}", c_id[0], c_id[1], index);
let r_id = random_pick::pick_multiple_from_slice(&words, &weights, 2);
let rp_id = format!("{} {}", r_id[0], r_id[1]);
let handle = random_pick::pick_from_slice(&words, &weights).unwrap().to_string();

View file

@ -267,7 +267,7 @@ impl VaultUx {
let mut name_bytes = Vec::<u8>::new();
match style_key.read_to_end(&mut name_bytes) {
Ok(_len) => {
log::info!("name_bytes: {:?} {:?}", name_bytes, String::from_utf8(name_bytes.to_vec()));
log::debug!("name_bytes: {:?} {:?}", name_bytes, String::from_utf8(name_bytes.to_vec()));
name_to_style(&String::from_utf8(name_bytes).unwrap_or("regular".to_string()))
.unwrap_or(GlyphStyle::Regular)
},