diff --git a/unix_integration/src/daemon.rs b/unix_integration/src/daemon.rs
index a5eb1fdb8..c88e5ca7c 100644
--- a/unix_integration/src/daemon.rs
+++ b/unix_integration/src/daemon.rs
@@ -759,8 +759,8 @@ async fn main() -> ExitCode {
}
};
- // With the assistance of the db, setup the hsm and it's machine key.
- let db_txn = db.write().await;
+ // With the assistance of the DB, setup the HSM and its machine key.
+ let mut db_txn = db.write().await;
let loadable_machine_key = match db_txn.get_hsm_machine_key() {
Ok(Some(lmk)) => lmk,
diff --git a/unix_integration/src/db.rs b/unix_integration/src/db.rs
index 19426a750..dce3bc8f5 100644
--- a/unix_integration/src/db.rs
+++ b/unix_integration/src/db.rs
@@ -25,6 +25,15 @@ pub trait Cache {
async fn write<'db>(&'db self) -> Self::Txn<'db>;
}
+#[async_trait]
+pub trait KeyStore {
+ type Txn<'db>
+ where
+ Self: 'db;
+
+ async fn write_keystore<'db>(&'db self) -> Self::Txn<'db>;
+}
+
#[derive(Debug)]
pub enum CacheError {
Cryptography,
@@ -37,32 +46,35 @@ pub enum CacheError {
}
pub trait CacheTxn {
- fn migrate(&self) -> Result<(), CacheError>;
+ fn migrate(&mut self) -> Result<(), CacheError>;
fn commit(self) -> Result<(), CacheError>;
- fn invalidate(&self) -> Result<(), CacheError>;
+ fn invalidate(&mut self) -> Result<(), CacheError>;
- fn clear(&self) -> Result<(), CacheError>;
+ fn clear(&mut self) -> Result<(), CacheError>;
- fn get_hsm_machine_key(&self) -> Result