[vault] The recovery key is printed as 8 groups of 8
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user