Windows fix

This commit is contained in:
nab138
2026-02-14 15:07:31 -05:00
parent ccc8a685bf
commit adc81774b0
2 changed files with 20 additions and 1 deletions

View File

@@ -78,7 +78,8 @@ impl Sideloader {
self.storage.as_ref(),
&self.max_certs_behavior,
)
.await?;
.await
.context("Failed to retrieve certificate identity")?;
let mut app = Application::new(app_path)?;
let special = app.get_special_app();

View File

@@ -43,4 +43,22 @@ impl SideloadingStorage for KeyringStorage {
Err(e) => Err(e.into()),
}
}
// Linux doesn't seem to properly retrive binary secrets, so we don't use this implementation and instead let it fall back to base64 encoding.
// Windows fails to store the base64 encoded data because it is too long.
#[cfg(target_os = "windows")]
fn store_data(&self, key: &str, value: &[u8]) -> Result<(), Report> {
Entry::new(&self.service_name, key)?.set_secret(value)?;
Ok(())
}
#[cfg(target_os = "windows")]
fn retrieve_data(&self, key: &str) -> Result<Option<Vec<u8>>, Report> {
let entry = Entry::new(&self.service_name, key)?;
match entry.get_secret() {
Ok(secret) => Ok(Some(secret)),
Err(keyring::Error::NoEntry) => Ok(None),
Err(e) => Err(e.into()),
}
}
}