Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat: add encrypt settings toggle in Privacy > Security

Louis Beaumontca7caa1dc93c
diff --git a/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx b/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx
index 07e6b51c3..f4e7f7cb1 100644
--- a/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx
@@ -386,7 +386,7 @@ export function PrivacySection() {
)}
</div>
- {/* API Authentication */}
+ {/* Security */}
<div className="space-y-2">
<h2 className="text-xs font-semibold text-muted-foreground uppercase tracking-wider px-1">
Security
@@ -414,6 +414,29 @@ export function PrivacySection() {
</div>
</CardContent>
</Card>
+ <Card className="border-border bg-card">
+ <CardContent className="px-3 py-2.5">
+ <div className="flex items-center justify-between">
+ <div className="flex items-center space-x-2.5">
+ <Shield className="h-4 w-4 text-muted-foreground shrink-0" />
+ <div>
+ <h3 className="text-sm font-medium text-foreground">
+ encrypt settings at rest
+ </h3>
+ <p className="text-xs text-muted-foreground mt-0.5">
+ encrypt store.bin with a key stored in your OS keychain. requires keychain access.
+ </p>
+ </div>
+ </div>
+ <Switch
+ checked={settings.encryptStore ?? false}
+ onCheckedChange={(checked) => {
+ handleSettingsChange({ encryptStore: checked });
+ }}
+ />
+ </div>
+ </CardContent>
+ </Card>
</div>
{/* Offline Mode */}
diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
index aa51bd1d0..3ef90f72e 100644
--- a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
+++ b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
@@ -190,6 +190,7 @@ export type Settings = SettingsStore & {
recordMode: string;
}>;
apiAuth?: boolean;
+ encryptStore?: boolean;
}
export function getEffectiveFilters(settings: Settings) {
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/store.rs b/apps/screenpipe-app-tauri/src-tauri/src/store.rs
index 4fa0dcf24..9363ee521 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/store.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/store.rs
@@ -120,9 +120,31 @@ fn encrypt_store_file(path: &Path) {
}
/// Re-encrypt store.bin on disk. Called after the Tauri store plugin writes plain JSON.
+/// Also syncs the .encrypt-store flag file from the encryptStore setting.
pub fn reencrypt_store_file(app: &AppHandle) {
if let Ok(base_dir) = get_base_dir(app, None) {
- encrypt_store_file(&base_dir.join("store.bin"));
+ // Sync the flag file from the store's encryptStore setting
+ let flag_path = base_dir.join(".encrypt-store");
+ let store_path = base_dir.join("store.bin");
+
+ // Read the setting from the store JSON on disk
+ let encrypt_enabled = std::fs::read(&store_path)
+ .ok()
+ .and_then(|data| serde_json::from_slice::<serde_json::Value>(&data).ok())
+ .and_then(|json| {
+ json.get("settings")
+ .and_then(|s| s.get("encryptStore"))
+ .and_then(|v| v.as_bool())
+ })
+ .unwrap_or(false);
+
+ if encrypt_enabled && !flag_path.exists() {
+ let _ = std::fs::write(&flag_path, b"");
+ } else if !encrypt_enabled && flag_path.exists() {
+ let _ = std::fs::remove_file(&flag_path);
+ }
+
+ encrypt_store_file(&store_path);
}
}
diff --git a/crates/screenpipe-config/src/recording.rs b/crates/screenpipe-config/src/recording.rs
index 180f0b9ba..b742b37e6 100644
--- a/crates/screenpipe-config/src/recording.rs
+++ b/crates/screenpipe-config/src/recording.rs
@@ -257,6 +257,10 @@ pub struct RecordingSettings {
/// Require authentication for remote (non-localhost) API access.
#[serde(rename = "apiAuth", default)]
pub api_auth: bool,
+
+ /// Encrypt store.bin at rest using OS keychain-stored key.
+ #[serde(rename = "encryptStore", default)]
+ pub encrypt_store: bool,
}
impl RecordingSettings {
@@ -334,6 +338,7 @@ impl Default for RecordingSettings {
schedule_enabled: false,
schedule_rules: vec![],
api_auth: false,
+ encrypt_store: false,
}
}
}