[vault] The recovery key is printed as 8 groups of 8

This commit is contained in:
2026-11-12 23:09:02 +01:00
parent 8d5d08afcb
commit 2b4a78644b
5 changed files with 53 additions and 22 deletions
+3 -2
View File
@@ -113,7 +113,8 @@ fn a_recovery_key_is_never_an_everyday_unlock() {
// It does not count as a factor: two are still needed and it is not listed.
assert_eq!(Vault::factor_ids(&bytes).unwrap().len(), 3);
// Recovering needs a real second factor and a password worth the name.
let two_passwords = Vault::recover(&bytes, &text, &pw("a new master password"), FAST, Unlock::Password(&old), "x", NOW);
let two_passwords =
Vault::recover(&bytes, &text, &pw("a new master password"), FAST, Unlock::Password(&old), "x", NOW);
assert!(matches!(two_passwords, Err(Error::NeedTwoFactors)));
let short = Vault::recover(&bytes, &text, &pw(""), FAST, device(&NEW_PC), "x", NOW);
assert!(matches!(short, Err(Error::WrongPassword) | Err(Error::FactorRejected)));
@@ -134,7 +135,7 @@ fn a_wrong_an_old_or_another_vaults_key_opens_nothing() {
let mut other = vault();
let others = other.recovery_create(NOW).unwrap();
assert!(matches!(recover(&bytes, others.expose(), "a new master password"), Err(Error::WrongRecoveryKey)));
// A key with this vault's id but other bytes (a forged sheet): the wrap decides, not the id.
// The right key with its last character changed: the check says so before the vault is tried.
let forged: String = {
let mut flat: Vec<char> = second.expose().chars().collect();
let last = flat.len() - 1;