Fix Secret Key decode rejecting valid keys; verify build
The first base32 symbol carries 3 data bits (26 symbols = 130 bits, 2 spare), but decode only accepted values 0-3, so ~half of generated keys failed to parse. Adds an edge-case test, rustfmt config, Cargo.lock, and on-demand cross targets instead of installing all seven in rust-toolchain.toml. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -192,7 +192,9 @@ impl VaultCore {
|
||||
.iter()
|
||||
.map(|(id, sealed)| decrypt(st, u, *id, sealed).map(|i| summary(&i)))
|
||||
.collect::<Result<Vec<_>>>()?;
|
||||
out.sort_by(|a, b| b.favorite.cmp(&a.favorite).then_with(|| a.title.to_lowercase().cmp(&b.title.to_lowercase())));
|
||||
out.sort_by(|a, b| {
|
||||
b.favorite.cmp(&a.favorite).then_with(|| a.title.to_lowercase().cmp(&b.title.to_lowercase()))
|
||||
});
|
||||
Ok(out)
|
||||
})
|
||||
}
|
||||
@@ -228,7 +230,9 @@ impl VaultCore {
|
||||
model.tags = item.tags;
|
||||
model.modified_at = now;
|
||||
|
||||
let json = zeroize::Zeroizing::new(serde_json::to_vec(&model).map_err(|e| CoreError::Internal { msg: e.to_string() })?);
|
||||
let json = zeroize::Zeroizing::new(
|
||||
serde_json::to_vec(&model).map_err(|e| CoreError::Internal { msg: e.to_string() })?,
|
||||
);
|
||||
let sealed = seal_item(st.account_id, st.vault_id, id, &u.vault_key, &json)?;
|
||||
st.items.insert(id, sealed);
|
||||
Ok(id.to_string())
|
||||
|
||||
Reference in New Issue
Block a user