[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:
2026-11-02 18:05:00 +01:00
parent 7893dd199c
commit 7a7a628fa5
16 changed files with 566 additions and 25 deletions
+10
View File
@@ -479,6 +479,16 @@ impl Vault {
Ok(header.factor_slots().iter().filter_map(|s| FactorKind::from_code(s.kind)).collect())
}
/// The factors a vault file has, from its header (no key needed): id (32 hex digits) and type. The app
/// asks the TOTP service and paired devices for a factor by this id.
pub fn factor_ids(bytes: &[u8]) -> Result<Vec<(String, FactorKind)>, Error> {
let (header, _) = Header::parse(bytes)?;
if header.version == VERSION {
return Ok(Vec::new());
}
Ok(header.factor_slots().iter().filter_map(|s| Some((hex(&s.id), FactorKind::from_code(s.kind)?))).collect())
}
pub fn is_machine_store(bytes: &[u8]) -> Result<bool, Error> {
Ok(Header::parse(bytes)?.0.is_machine_store())
}