burrito_secrets/waiters/
mod.rs1use crate::database::Entry;
7
8pub mod sensitive_text;
9pub mod burrito_box;
10pub mod recursive;
11pub mod burrito_box_sym;
12
13pub trait Waiter: Sized {
14 fn name() -> String;
15 fn version() -> String;
16 fn into_entry(self) -> Entry;
17 fn from_entry(entry: Entry) -> anyhow::Result<Self>;
18
19 fn verify_version(cmp: &Entry) -> anyhow::Result<()> {
20 use anyhow::bail;
21
22 let cmp = cmp.get_str("version")?;
23
24 if cmp != Self::version() {
25 bail!("Version mismatch: expected {}, got {}", Self::version(), cmp);
26 }
27
28 Ok(())
29 }
30}