[seal] Sealed boxes and key import: custos-seal (X25519 + XChaCha20-Poly1305, match code, at-rest sealing), custos_keys::import, Vault::factor_ids; v0.5.0
This commit is contained in:
@@ -132,6 +132,11 @@ fn a_v1_vault_upgrades_and_its_password_alone_stops_working() {
|
||||
let new = v.to_bytes().unwrap();
|
||||
assert_eq!(Vault::version_of(&new).unwrap(), 2);
|
||||
assert_eq!(Vault::factor_kinds(&new).unwrap(), [FactorKind::Password, FactorKind::Device]);
|
||||
// The header names each factor by the id the unlocked vault lists; a v1 file has none.
|
||||
let ids = Vault::factor_ids(&new).unwrap();
|
||||
let listed: Vec<(String, FactorKind)> = v.factors().into_iter().map(|f| (f.id, f.kind)).collect();
|
||||
assert_eq!(ids, listed);
|
||||
assert!(Vault::factor_ids(&old).unwrap().is_empty());
|
||||
assert!(matches!(Vault::open(&new, &p), Err(Error::NeedTwoFactors)));
|
||||
let back = open(&new, Unlock::Password(&p), Unlock::Material(FactorKind::Device, &DEVICE)).unwrap();
|
||||
assert_eq!(back.items().len(), 1);
|
||||
|
||||
Reference in New Issue
Block a user