[vault] Format v2: factor, pair and single slots; open_with any two factors; upgrade from v1; key-pair item type

This commit is contained in:
2026-11-02 15:45:55 +01:00
parent df6565941e
commit 02c6795f53
5 changed files with 753 additions and 39 deletions
+14 -1
View File
@@ -16,16 +16,19 @@ pub enum ItemType {
Wifi,
SecureNote,
Card,
/// A signing or SSH key pair (docs/FACTORS.md, "The key-pair item type").
KeyPair,
}
impl ItemType {
pub const ALL: [ItemType; 6] = [
pub const ALL: [ItemType; 7] = [
ItemType::WebLogin,
ItemType::ApiCredential,
ItemType::LocalApp,
ItemType::Wifi,
ItemType::SecureNote,
ItemType::Card,
ItemType::KeyPair,
];
pub fn label(self) -> &'static str {
@@ -36,6 +39,7 @@ impl ItemType {
ItemType::Wifi => "Wi-Fi",
ItemType::SecureNote => "Secure note",
ItemType::Card => "Card",
ItemType::KeyPair => "Key pair",
}
}
@@ -59,6 +63,15 @@ impl ItemType {
ItemType::Card => {
&[("cardholder", false), ("number", true), ("expiry", false), ("cvv", true), ("pin", true)]
}
ItemType::KeyPair => &[
("algorithm", false),
("public-key", false),
("public-pem", false),
("private-key", true),
("private-openssh", true),
("fingerprint", false),
("comment", false),
],
}
}
}