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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
feat(secrets): migrate credentials from connections.json to encrypted SecretStore
Louis Beaumont7cc41ebdc5a4
diff --git a/crates/screenpipe-connect/src/connections/airtable.rs b/crates/screenpipe-connect/src/connections/airtable.rsindex bee4011b5..821b6590c 100644--- a/crates/screenpipe-connect/src/connections/airtable.rs+++ b/crates/screenpipe-connect/src/connections/airtable.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -50,7 +51,7 @@ impl Integration for Airtable {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let api_token = require_str(creds, "api_token")?;let resp: Value = client.get("https://api.airtable.com/v0/meta/bases")diff --git a/crates/screenpipe-connect/src/connections/asana.rs b/crates/screenpipe-connect/src/connections/asana.rsindex 2d6894580..84fa6fd80 100644--- a/crates/screenpipe-connect/src/connections/asana.rs+++ b/crates/screenpipe-connect/src/connections/asana.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -41,7 +42,7 @@ impl Integration for Asana {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let token = require_str(creds, "api_token")?.trim();let resp = client.get("https://app.asana.com/api/1.0/users/me")diff --git a/crates/screenpipe-connect/src/connections/brex.rs b/crates/screenpipe-connect/src/connections/brex.rsindex 198f51fbb..a10ba6900 100644--- a/crates/screenpipe-connect/src/connections/brex.rs+++ b/crates/screenpipe-connect/src/connections/brex.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -41,7 +42,7 @@ impl Integration for Brex {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let api_token = require_str(creds, "api_token")?;let resp: Value = client.get("https://platform.brexapis.com/v2/accounts")diff --git a/crates/screenpipe-connect/src/connections/calcom.rs b/crates/screenpipe-connect/src/connections/calcom.rsindex bc9bd832b..dcf661408 100644--- a/crates/screenpipe-connect/src/connections/calcom.rs+++ b/crates/screenpipe-connect/src/connections/calcom.rs@@ -6,6 +6,7 @@ use super::{Category, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use crate::oauth::{self, OAuthConfig};use anyhow::{anyhow, Result};use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};// To activate OAuth: register a Cal.com OAuth client at https://developer.cal.com/@@ -50,8 +51,8 @@ impl Integration for CalCom {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, _creds: &Map<String, Value>) -> Result<String> {- let token = oauth::read_oauth_token("calcom")+ async fn test(&self, client: &reqwest::Client, _creds: &Map<String, Value>, secret_store: Option<&SecretStore>) -> Result<String> {+ let token = oauth::read_oauth_token_instance(secret_store, "calcom", None).await.ok_or_else(|| anyhow!("not connected — use 'Connect with Cal.com' button"))?;let resp: Value = clientdiff --git a/crates/screenpipe-connect/src/connections/calendly.rs b/crates/screenpipe-connect/src/connections/calendly.rsindex fd88b9126..7e61d27e0 100644--- a/crates/screenpipe-connect/src/connections/calendly.rs+++ b/crates/screenpipe-connect/src/connections/calendly.rs@@ -6,6 +6,7 @@ use super::{Category, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use crate::oauth::{self, OAuthConfig};use anyhow::{anyhow, Result};use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};// To activate OAuth: register a Calendly OAuth app at https://developer.calendly.com/@@ -50,8 +51,8 @@ impl Integration for Calendly {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, _creds: &Map<String, Value>) -> Result<String> {- let token = oauth::read_oauth_token("calendly")+ async fn test(&self, client: &reqwest::Client, _creds: &Map<String, Value>, secret_store: Option<&SecretStore>) -> Result<String> {+ let token = oauth::read_oauth_token_instance(secret_store, "calendly", None).await.ok_or_else(|| anyhow!("not connected — use 'Connect with Calendly' button"))?;let resp: Value = clientdiff --git a/crates/screenpipe-connect/src/connections/clickup.rs b/crates/screenpipe-connect/src/connections/clickup.rsindex daeb2f6e6..d5a786499 100644--- a/crates/screenpipe-connect/src/connections/clickup.rs+++ b/crates/screenpipe-connect/src/connections/clickup.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -42,7 +43,7 @@ impl Integration for ClickUp {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let api_key = require_str(creds, "api_key")?;let resp: Value = client.get("https://api.clickup.com/api/v2/user")diff --git a/crates/screenpipe-connect/src/connections/confluence.rs b/crates/screenpipe-connect/src/connections/confluence.rsindex 508dc7a3d..df5f7c6ba 100644--- a/crates/screenpipe-connect/src/connections/confluence.rs+++ b/crates/screenpipe-connect/src/connections/confluence.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -58,7 +59,7 @@ impl Integration for Confluence {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let domain = require_str(creds, "domain")?.trim_end_matches('/');let email = require_str(creds, "email")?;let api_token = require_str(creds, "api_token")?;diff --git a/crates/screenpipe-connect/src/connections/discord.rs b/crates/screenpipe-connect/src/connections/discord.rsindex 97d4870ff..6d9dcf32c 100644--- a/crates/screenpipe-connect/src/connections/discord.rs+++ b/crates/screenpipe-connect/src/connections/discord.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{json, Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -30,7 +31,7 @@ impl Integration for Discord {&DEF}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let url = require_str(creds, "webhook_url")?;client.post(url)diff --git a/crates/screenpipe-connect/src/connections/email.rs b/crates/screenpipe-connect/src/connections/email.rsindex 266dc9089..de01011e9 100644--- a/crates/screenpipe-connect/src/connections/email.rs+++ b/crates/screenpipe-connect/src/connections/email.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -67,7 +68,7 @@ impl Integration for Email {&DEF}- async fn test(&self, _client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, _client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {use lettre::transport::smtp::authentication::Credentials;use lettre::{message::header::ContentType, Message, SmtpTransport, Transport};diff --git a/crates/screenpipe-connect/src/connections/github_issues.rs b/crates/screenpipe-connect/src/connections/github_issues.rsindex 6677cef47..e9af972bd 100644--- a/crates/screenpipe-connect/src/connections/github_issues.rs+++ b/crates/screenpipe-connect/src/connections/github_issues.rs@@ -6,6 +6,7 @@ use super::{Category, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use crate::oauth::{self, OAuthConfig};use anyhow::{anyhow, Result};use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};const GITHUB_CLIENT_ID: &str = "Ov23li9IT9uV0S9ql2ne";@@ -50,8 +51,8 @@ impl Integration for GithubIssues {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, _creds: &Map<String, Value>) -> Result<String> {- let token = oauth::read_oauth_token("github")+ async fn test(&self, client: &reqwest::Client, _creds: &Map<String, Value>, secret_store: Option<&SecretStore>) -> Result<String> {+ let token = oauth::read_oauth_token_instance(secret_store, "github", None).await.ok_or_else(|| anyhow!("not connected — use 'Connect with GitHub' button"))?;let resp: Value = clientdiff --git a/crates/screenpipe-connect/src/connections/glean.rs b/crates/screenpipe-connect/src/connections/glean.rsindex cbeb14a6c..148ee2a10 100644--- a/crates/screenpipe-connect/src/connections/glean.rs+++ b/crates/screenpipe-connect/src/connections/glean.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -61,7 +62,7 @@ impl Integration for Glean {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let instance = require_str(creds, "instance")?;let token = require_str(creds, "indexing_token")?;let resp: Value = clientdiff --git a/crates/screenpipe-connect/src/connections/gmail.rs b/crates/screenpipe-connect/src/connections/gmail.rsindex e647efc92..4694b7e9b 100644--- a/crates/screenpipe-connect/src/connections/gmail.rs+++ b/crates/screenpipe-connect/src/connections/gmail.rs@@ -6,6 +6,7 @@ use super::{Category, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use crate::oauth::{self, OAuthConfig};use anyhow::{anyhow, Result};use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};// To activate OAuth: register a Google OAuth 2.0 client at https://console.cloud.google.com/@@ -64,8 +65,8 @@ impl Integration for Gmail {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, _creds: &Map<String, Value>) -> Result<String> {- let token = oauth::get_valid_token(client, "gmail")+ async fn test(&self, client: &reqwest::Client, _creds: &Map<String, Value>, secret_store: Option<&SecretStore>) -> Result<String> {+ let token = oauth::get_valid_token_instance(secret_store, client, "gmail", None).await.ok_or_else(|| anyhow!("not connected — use 'Connect with Gmail' button"))?;diff --git a/crates/screenpipe-connect/src/connections/google_calendar.rs b/crates/screenpipe-connect/src/connections/google_calendar.rsindex b9f36dca7..1ee17dad1 100644--- a/crates/screenpipe-connect/src/connections/google_calendar.rs+++ b/crates/screenpipe-connect/src/connections/google_calendar.rs@@ -6,6 +6,7 @@ use super::{Category, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use crate::oauth::{self, OAuthConfig};use anyhow::{anyhow, Result};use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};// Same GCP project as Gmail but different OAuth client.@@ -61,8 +62,8 @@ impl Integration for GoogleCalendar {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, _creds: &Map<String, Value>) -> Result<String> {- let token = oauth::get_valid_token(client, "google-calendar")+ async fn test(&self, client: &reqwest::Client, _creds: &Map<String, Value>, secret_store: Option<&SecretStore>) -> Result<String> {+ let token = oauth::get_valid_token_instance(secret_store, client, "google-calendar", None).await.ok_or_else(|| anyhow!("not connected — use 'Connect Google Calendar' button"))?;diff --git a/crates/screenpipe-connect/src/connections/granola.rs b/crates/screenpipe-connect/src/connections/granola.rsindex 9320273cd..8390555d6 100644--- a/crates/screenpipe-connect/src/connections/granola.rs+++ b/crates/screenpipe-connect/src/connections/granola.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -41,7 +42,7 @@ impl Integration for Granola {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let api_key = require_str(creds, "api_key")?;let resp: Value = client.get("https://public-api.granola.ai/v1/notes")diff --git a/crates/screenpipe-connect/src/connections/hubspot.rs b/crates/screenpipe-connect/src/connections/hubspot.rsindex 2a52a3289..fbe4da9f3 100644--- a/crates/screenpipe-connect/src/connections/hubspot.rs+++ b/crates/screenpipe-connect/src/connections/hubspot.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -41,7 +42,7 @@ impl Integration for HubSpot {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let api_token = require_str(creds, "api_token")?;client.get("https://api.hubapi.com/crm/v3/objects/contacts?limit=1")diff --git a/crates/screenpipe-connect/src/connections/intercom.rs b/crates/screenpipe-connect/src/connections/intercom.rsindex c1cbc6234..6cd290048 100644--- a/crates/screenpipe-connect/src/connections/intercom.rs+++ b/crates/screenpipe-connect/src/connections/intercom.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -41,7 +42,7 @@ impl Integration for Intercom {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let api_token = require_str(creds, "api_token")?;let resp: Value = client.get("https://api.intercom.io/me")diff --git a/crates/screenpipe-connect/src/connections/jira.rs b/crates/screenpipe-connect/src/connections/jira.rsindex 04c5a60a0..51ad88421 100644--- a/crates/screenpipe-connect/src/connections/jira.rs+++ b/crates/screenpipe-connect/src/connections/jira.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -58,7 +59,7 @@ impl Integration for Jira {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let domain = require_str(creds, "domain")?;let email = require_str(creds, "email")?;let api_token = require_str(creds, "api_token")?;diff --git a/crates/screenpipe-connect/src/connections/limitless.rs b/crates/screenpipe-connect/src/connections/limitless.rsindex d49bf1794..7d2dc35bd 100644--- a/crates/screenpipe-connect/src/connections/limitless.rs+++ b/crates/screenpipe-connect/src/connections/limitless.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -42,7 +43,7 @@ impl Integration for Limitless {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let api_key = require_str(creds, "api_key")?;let resp: Value = client.get("https://api.limitless.ai/v1/lifelogs?limit=1")diff --git a/crates/screenpipe-connect/src/connections/linear.rs b/crates/screenpipe-connect/src/connections/linear.rsindex 6f0ab2088..011cb4eea 100644--- a/crates/screenpipe-connect/src/connections/linear.rs+++ b/crates/screenpipe-connect/src/connections/linear.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{json, Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -42,7 +43,7 @@ impl Integration for Linear {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let api_key = require_str(creds, "api_key")?.trim();let resp = client.post("https://api.linear.app/graphql")diff --git a/crates/screenpipe-connect/src/connections/logseq.rs b/crates/screenpipe-connect/src/connections/logseq.rsindex cd2a753fd..dce255aba 100644--- a/crates/screenpipe-connect/src/connections/logseq.rs+++ b/crates/screenpipe-connect/src/connections/logseq.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -30,7 +31,7 @@ impl Integration for Logseq {&DEF}- async fn test(&self, _client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, _client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let graph_path = require_str(creds, "graph_path")?;let p = std::path::Path::new(graph_path);if !p.exists() {diff --git a/crates/screenpipe-connect/src/connections/make.rs b/crates/screenpipe-connect/src/connections/make.rsindex 7ebba3fd8..188f1fb74 100644--- a/crates/screenpipe-connect/src/connections/make.rs+++ b/crates/screenpipe-connect/src/connections/make.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{json, Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -30,7 +31,7 @@ impl Integration for Make {&DEF}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let url = require_str(creds, "webhook_url")?;client.post(url)diff --git a/crates/screenpipe-connect/src/connections/microsoft365.rs b/crates/screenpipe-connect/src/connections/microsoft365.rsindex c0decb53d..38c16e986 100644--- a/crates/screenpipe-connect/src/connections/microsoft365.rs+++ b/crates/screenpipe-connect/src/connections/microsoft365.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -41,7 +42,7 @@ impl Integration for Microsoft365 {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let token = require_str(creds, "access_token")?;let resp: Value = client.get("https://graph.microsoft.com/v1.0/me")diff --git a/crates/screenpipe-connect/src/connections/mod.rs b/crates/screenpipe-connect/src/connections/mod.rsindex 359bec33f..d528495c7 100644--- a/crates/screenpipe-connect/src/connections/mod.rs+++ b/crates/screenpipe-connect/src/connections/mod.rs@@ -54,10 +54,12 @@ pub mod zendesk;use crate::oauth;use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde::{Deserialize, Serialize};use serde_json::{Map, Value};use std::collections::HashMap;use std::path::{Path, PathBuf};+use std::sync::Arc;// ---------------------------------------------------------------------------// Static definition types (used by UI + Pi context)@@ -130,7 +132,12 @@ pub trait Integration: Send + Sync {fn def(&self) -> &'static IntegrationDef;/// Verify credentials work. Returns a human-readable success message.- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String>;+ async fn test(+ &self,+ client: &reqwest::Client,+ creds: &Map<String, Value>,+ secret_store: Option<&SecretStore>,+ ) -> Result<String>;/// Return OAuth config if this integration uses OAuth instead of manual fields./// Default is `None` (manual credential entry).@@ -226,6 +233,69 @@ pub fn save_store(screenpipe_dir: &Path, data: &HashMap<String, SavedConnection>Ok(())}+// ---------------------------------------------------------------------------+// SecretStore credential helpers+// ---------------------------------------------------------------------------++/// Load a `SavedConnection` from SecretStore (if available), falling back to+/// the legacy `connections.json` file on disk.+pub async fn load_connection(+ secret_store: Option<&SecretStore>,+ screenpipe_dir: &Path,+ key: &str,+) -> Option<SavedConnection> {+ // Try SecretStore first+ if let Some(ss) = secret_store {+ let store_key = format!("cred:{}", key);+ if let Ok(Some(conn)) = ss.get_json::<SavedConnection>(&store_key).await {+ return Some(conn);+ }+ }++ // Fall back to legacy file+ let file_store = load_store(screenpipe_dir);+ file_store.get(key).cloned()+}++/// Write a `SavedConnection` to SecretStore. Falls back to the legacy+/// `connections.json` file only when no SecretStore is available.+async fn save_connection(+ secret_store: Option<&SecretStore>,+ screenpipe_dir: &Path,+ key: &str,+ conn: &SavedConnection,+) -> Result<()> {+ if let Some(ss) = secret_store {+ let store_key = format!("cred:{}", key);+ ss.set_json(&store_key, conn).await?;+ return Ok(());+ }++ // No SecretStore (CLI without DB) — fall back to file+ let mut file_store = load_store(screenpipe_dir);+ file_store.insert(key.to_string(), conn.clone());+ save_store(screenpipe_dir, &file_store)+}++/// Remove a connection from SecretStore. Falls back to the legacy file+/// only when no SecretStore is available.+async fn remove_connection(+ secret_store: Option<&SecretStore>,+ screenpipe_dir: &Path,+ key: &str,+) -> Result<()> {+ if let Some(ss) = secret_store {+ let store_key = format!("cred:{}", key);+ ss.delete(&store_key).await?;+ return Ok(());+ }++ // No SecretStore — fall back to file+ let mut file_store = load_store(screenpipe_dir);+ file_store.remove(key);+ save_store(screenpipe_dir, &file_store)+}+// ---------------------------------------------------------------------------// Connection manager// ---------------------------------------------------------------------------@@ -234,36 +304,38 @@ pub struct ConnectionManager {integrations: Vec<Box<dyn Integration>>,screenpipe_dir: PathBuf,client: reqwest::Client,+ secret_store: Option<Arc<SecretStore>>,}impl ConnectionManager {- pub fn new(screenpipe_dir: PathBuf) -> Self {+ pub fn new(screenpipe_dir: PathBuf, secret_store: Option<Arc<SecretStore>>) -> Self {Self {integrations: all_integrations(),screenpipe_dir,client: reqwest::Client::new(),+ secret_store,}}pub async fn list(&self) -> Vec<ConnectionInfo> {- let store = load_store(&self.screenpipe_dir);+ let ss = self.secret_store.as_deref();let mut result = Vec::new();for i in &self.integrations {let def = i.def();let is_oauth = i.oauth_config().is_some();let connected = if is_oauth {- let instances = oauth::list_oauth_instances(None, def.id).await;+ let instances = oauth::list_oauth_instances(ss, def.id).await;let mut any_connected = false;for inst in &instances {- if oauth::is_oauth_instance_connected(None, def.id, inst.as_deref()).await {+ if oauth::is_oauth_instance_connected(ss, def.id, inst.as_deref()).await {any_connected = true;break;}}any_connected} else {- store- .get(def.id)+ load_connection(ss, &self.screenpipe_dir, def.id)+ .await.map(|c| c.enabled && !c.credentials.is_empty()).unwrap_or(false)};@@ -276,23 +348,28 @@ impl ConnectionManager {result}- pub fn connect(&self, id: &str, creds: Map<String, Value>) -> Result<()> {+ pub async fn connect(&self, id: &str, creds: Map<String, Value>) -> Result<()> {self.find(id)?;- let mut store = load_store(&self.screenpipe_dir);- store.insert(- id.to_string(),- SavedConnection {- enabled: true,- credentials: creds,- },- );- save_store(&self.screenpipe_dir, &store)+ let conn = SavedConnection {+ enabled: true,+ credentials: creds,+ };+ save_connection(+ self.secret_store.as_deref(),+ &self.screenpipe_dir,+ id,+ &conn,+ )+ .await}- pub fn get_credentials(&self, id: &str) -> Result<Option<Map<String, Value>>> {+ pub async fn get_credentials(&self, id: &str) -> Result<Option<Map<String, Value>>> {self.find(id)?;- let store = load_store(&self.screenpipe_dir);- Ok(store.get(id).map(|c| c.credentials.clone()))+ Ok(+ load_connection(self.secret_store.as_deref(), &self.screenpipe_dir, id)+ .await+ .map(|c| c.credentials),+ )}/// Look up the proxy config for a connection by ID.@@ -311,19 +388,19 @@ impl ConnectionManager {.map(|i| i.def())}- pub fn disconnect(&self, id: &str) -> Result<()> {- let mut store = load_store(&self.screenpipe_dir);- store.remove(id);- save_store(&self.screenpipe_dir, &store)+ pub async fn disconnect(&self, id: &str) -> Result<()> {+ remove_connection(self.secret_store.as_deref(), &self.screenpipe_dir, id).await}pub async fn test(&self, id: &str, creds: &Map<String, Value>) -> Result<String> {let integration = self.find(id)?;- integration.test(&self.client, creds).await+ integration+ .test(&self.client, creds, self.secret_store.as_deref())+ .await}/// Store credentials under `id` or `id:instance`.- pub fn connect_instance(+ pub async fn connect_instance(&self,id: &str,instance: Option<&str>,@@ -331,15 +408,17 @@ impl ConnectionManager {) -> Result<()> {self.find(id)?;let key = make_key(id, instance);- let mut store = load_store(&self.screenpipe_dir);- store.insert(- key,- SavedConnection {- enabled: true,- credentials: creds,- },- );- save_store(&self.screenpipe_dir, &store)+ let conn = SavedConnection {+ enabled: true,+ credentials: creds,+ };+ save_connection(+ self.secret_store.as_deref(),+ &self.screenpipe_dir,+ &key,+ &conn,+ )+ .await}/// Return all saved instances for the given integration id.@@ -347,27 +426,58 @@ impl ConnectionManager {/// Matches keys that are exactly `id` (the default instance) or start with/// `id:` (named instances). Each entry is returned as/// `(instance_name_or_none, connection)`.- pub fn get_all_instances(&self, id: &str) -> Result<Vec<(Option<String>, SavedConnection)>> {+ pub async fn get_all_instances(+ &self,+ id: &str,+ ) -> Result<Vec<(Option<String>, SavedConnection)>> {self.find(id)?;- let store = load_store(&self.screenpipe_dir);- let prefix = format!("{}:", id);let mut results = Vec::new();- for (key, conn) in &store {+ let mut seen = std::collections::HashSet::new();++ // Check SecretStore first+ if let Some(ss) = self.secret_store.as_deref() {+ let prefix = format!("cred:{}", id);+ if let Ok(keys) = ss.list(&prefix).await {+ for key in keys {+ if key == prefix {+ if let Ok(Some(conn)) = ss.get_json::<SavedConnection>(&key).await {+ seen.insert(None::<String>);+ results.push((None, conn));+ }+ } else if let Some(inst) = key.strip_prefix(&format!("{}:", prefix)) {+ let inst = inst.to_string();+ if let Ok(Some(conn)) = ss.get_json::<SavedConnection>(&key).await {+ seen.insert(Some(inst.clone()));+ results.push((Some(inst), conn));+ }+ }+ }+ }+ }++ // Fall back to file for any not found in store+ let file_store = load_store(&self.screenpipe_dir);+ let prefix = format!("{}:", id);+ for (key, conn) in &file_store {if key == id {- results.push((None, conn.clone()));+ if seen.insert(None::<String>) {+ results.push((None, conn.clone()));+ }} else if let Some(inst) = key.strip_prefix(&prefix) {- results.push((Some(inst.to_string()), conn.clone()));+ let inst = inst.to_string();+ if seen.insert(Some(inst.clone())) {+ results.push((Some(inst), conn.clone()));+ }}}+Ok(results)}/// Remove a specific instance (or the default) for the given integration.- pub fn disconnect_instance(&self, id: &str, instance: Option<&str>) -> Result<()> {+ pub async fn disconnect_instance(&self, id: &str, instance: Option<&str>) -> Result<()> {let key = make_key(id, instance);- let mut store = load_store(&self.screenpipe_dir);- store.remove(&key);- save_store(&self.screenpipe_dir, &store)+ remove_connection(self.secret_store.as_deref(), &self.screenpipe_dir, &key).await}fn find(&self, id: &str) -> Result<&dyn Integration> {@@ -392,28 +502,33 @@ pub struct ConnectionInfo {// Pi context rendering — uses proxy URLs instead of raw credentials// ----------------------------------------------------------------------------pub async fn render_context(screenpipe_dir: &Path, api_port: u16) -> String {- let store = load_store(screenpipe_dir);+pub async fn render_context(+ screenpipe_dir: &Path,+ api_port: u16,+ secret_store: Option<&SecretStore>,+) -> String {let integrations = all_integrations();// Credential-based integrations- let cred_connected: Vec<_> = integrations- .iter()- .filter(|i| i.oauth_config().is_none())- .filter_map(|i| {- let def = i.def();- store- .get(def.id)- .filter(|c| c.enabled && !c.credentials.is_empty())- .map(|c| (i.as_ref(), def, &c.credentials))- })- .collect();+ let mut cred_connected: Vec<(&dyn Integration, &'static IntegrationDef, Map<String, Value>)> =+ Vec::new();+ for i in integrations.iter().filter(|i| i.oauth_config().is_none()) {+ let def = i.def();+ if let Some(conn) = load_connection(secret_store, screenpipe_dir, def.id).await {+ if conn.enabled && !conn.credentials.is_empty() {+ cred_connected.push((i.as_ref(), def, conn.credentials));+ }+ }+ }// OAuth integrations with a stored tokenlet mut oauth_connected: Vec<(&dyn Integration, &'static IntegrationDef)> = Vec::new();for i in integrations.iter().filter(|i| i.oauth_config().is_some()) {let def = i.def();- if oauth::read_oauth_token(def.id).await.is_some() {+ if oauth::read_oauth_token_instance(secret_store, def.id, None)+ .await+ .is_some()+ {oauth_connected.push((i.as_ref(), def));}}@@ -444,7 +559,7 @@ pub async fn render_context(screenpipe_dir: &Path, api_port: u16) -> String {));} else {// No proxy config — fall back to raw credentials (webhook-style integrations)- for (key, value) in *creds {+ for (key, value) in creds {if let Some(s) = value.as_str() {out.push_str(&format!(" {}: {}\n", key, s));}diff --git a/crates/screenpipe-connect/src/connections/monday.rs b/crates/screenpipe-connect/src/connections/monday.rsindex f5feac3df..85ef36622 100644--- a/crates/screenpipe-connect/src/connections/monday.rs+++ b/crates/screenpipe-connect/src/connections/monday.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -42,7 +43,7 @@ impl Integration for Monday {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let token = require_str(creds, "api_token")?;let resp: Value = client.post("https://api.monday.com/v2")diff --git a/crates/screenpipe-connect/src/connections/n8n.rs b/crates/screenpipe-connect/src/connections/n8n.rsindex d7bf01cbb..efe8c6bb1 100644--- a/crates/screenpipe-connect/src/connections/n8n.rs+++ b/crates/screenpipe-connect/src/connections/n8n.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{json, Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -31,7 +32,7 @@ impl Integration for N8n {&DEF}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let url = require_str(creds, "webhook_url")?;client.post(url)diff --git a/crates/screenpipe-connect/src/connections/notion.rs b/crates/screenpipe-connect/src/connections/notion.rsindex 4d8886902..b02fc4fc7 100644--- a/crates/screenpipe-connect/src/connections/notion.rs+++ b/crates/screenpipe-connect/src/connections/notion.rs@@ -6,6 +6,7 @@ use super::{Category, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use crate::oauth::{self, OAuthConfig};use anyhow::{anyhow, Result};use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static OAUTH: OAuthConfig = OAuthConfig {@@ -47,8 +48,8 @@ impl Integration for Notion {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, _creds: &Map<String, Value>) -> Result<String> {- let token = oauth::read_oauth_token("notion")+ async fn test(&self, client: &reqwest::Client, _creds: &Map<String, Value>, secret_store: Option<&SecretStore>) -> Result<String> {+ let token = oauth::read_oauth_token_instance(secret_store, "notion", None).await.ok_or_else(|| anyhow!("not connected — use 'Connect with Notion' button"))?;let resp: Value = clientdiff --git a/crates/screenpipe-connect/src/connections/ntfy.rs b/crates/screenpipe-connect/src/connections/ntfy.rsindex 132e9c49b..101cf8a15 100644--- a/crates/screenpipe-connect/src/connections/ntfy.rs+++ b/crates/screenpipe-connect/src/connections/ntfy.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -30,7 +31,7 @@ impl Integration for Ntfy {&DEF}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let topic_url = require_str(creds, "topic_url")?;client.post(topic_url)diff --git a/crates/screenpipe-connect/src/connections/obsidian.rs b/crates/screenpipe-connect/src/connections/obsidian.rsindex e80eb280b..bfe353046 100644--- a/crates/screenpipe-connect/src/connections/obsidian.rs+++ b/crates/screenpipe-connect/src/connections/obsidian.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -39,7 +40,7 @@ impl Integration for Obsidian {&DEF}- async fn test(&self, _client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, _client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let vault_path = require_str(creds, "vault_path")?;let path = std::path::Path::new(vault_path);diff --git a/crates/screenpipe-connect/src/connections/perplexity.rs b/crates/screenpipe-connect/src/connections/perplexity.rsindex f24b9cf12..5ebd56767 100644--- a/crates/screenpipe-connect/src/connections/perplexity.rs+++ b/crates/screenpipe-connect/src/connections/perplexity.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{json, Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -41,7 +42,7 @@ impl Integration for Perplexity {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let api_key = require_str(creds, "api_key")?;client.post("https://api.perplexity.ai/chat/completions")diff --git a/crates/screenpipe-connect/src/connections/pipedrive.rs b/crates/screenpipe-connect/src/connections/pipedrive.rsindex 0f6faed6f..3fbfe05b5 100644--- a/crates/screenpipe-connect/src/connections/pipedrive.rs+++ b/crates/screenpipe-connect/src/connections/pipedrive.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -50,7 +51,7 @@ impl Integration for Pipedrive {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let api_token = require_str(creds, "api_token")?;let domain = require_str(creds, "domain")?;let resp: Value = clientdiff --git a/crates/screenpipe-connect/src/connections/pushover.rs b/crates/screenpipe-connect/src/connections/pushover.rsindex d0b344faf..f3acce0a6 100644--- a/crates/screenpipe-connect/src/connections/pushover.rs+++ b/crates/screenpipe-connect/src/connections/pushover.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -39,7 +40,7 @@ impl Integration for Pushover {&DEF}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let token = require_str(creds, "api_token")?;let user_key = require_str(creds, "user_key")?;clientdiff --git a/crates/screenpipe-connect/src/connections/salesforce.rs b/crates/screenpipe-connect/src/connections/salesforce.rsindex 5a963eb13..e443b8b86 100644--- a/crates/screenpipe-connect/src/connections/salesforce.rs+++ b/crates/screenpipe-connect/src/connections/salesforce.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -50,7 +51,7 @@ impl Integration for Salesforce {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let instance_url = require_str(creds, "instance_url")?.trim_end_matches('/');let token = require_str(creds, "access_token")?;let resp: Value = clientdiff --git a/crates/screenpipe-connect/src/connections/sentry.rs b/crates/screenpipe-connect/src/connections/sentry.rsindex 7f5f6824d..6cffc8e42 100644--- a/crates/screenpipe-connect/src/connections/sentry.rs+++ b/crates/screenpipe-connect/src/connections/sentry.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -50,7 +51,7 @@ impl Integration for Sentry {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let auth_token = require_str(creds, "auth_token")?;let org = require_str(creds, "organization")?;let resp: Value = clientdiff --git a/crates/screenpipe-connect/src/connections/slack.rs b/crates/screenpipe-connect/src/connections/slack.rsindex 1d236c7b1..29ee62f3a 100644--- a/crates/screenpipe-connect/src/connections/slack.rs+++ b/crates/screenpipe-connect/src/connections/slack.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{json, Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -30,7 +31,7 @@ impl Integration for Slack {&DEF}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let url = require_str(creds, "webhook_url")?;client.post(url)diff --git a/crates/screenpipe-connect/src/connections/stripe.rs b/crates/screenpipe-connect/src/connections/stripe.rsindex 0c50f9929..e0976b3e3 100644--- a/crates/screenpipe-connect/src/connections/stripe.rs+++ b/crates/screenpipe-connect/src/connections/stripe.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -41,7 +42,7 @@ impl Integration for Stripe {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let api_key = require_str(creds, "api_key")?;let resp: Value = client.get("https://api.stripe.com/v1/balance")diff --git a/crates/screenpipe-connect/src/connections/teams.rs b/crates/screenpipe-connect/src/connections/teams.rsindex 438e2a00c..f35940906 100644--- a/crates/screenpipe-connect/src/connections/teams.rs+++ b/crates/screenpipe-connect/src/connections/teams.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{json, Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -30,7 +31,7 @@ impl Integration for Teams {&DEF}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let url = require_str(creds, "webhook_url")?;client.post(url)diff --git a/crates/screenpipe-connect/src/connections/telegram.rs b/crates/screenpipe-connect/src/connections/telegram.rsindex 967ce5eef..faf6a4d29 100644--- a/crates/screenpipe-connect/src/connections/telegram.rs+++ b/crates/screenpipe-connect/src/connections/telegram.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{json, Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -39,7 +40,7 @@ impl Integration for Telegram {&DEF}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let token = require_str(creds, "bot_token")?;let chat_id = require_str(creds, "chat_id")?;let url = format!("https://api.telegram.org/bot{}/sendMessage", token);diff --git a/crates/screenpipe-connect/src/connections/todoist.rs b/crates/screenpipe-connect/src/connections/todoist.rsindex b3af5c927..fa1e3b71c 100644--- a/crates/screenpipe-connect/src/connections/todoist.rs+++ b/crates/screenpipe-connect/src/connections/todoist.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -41,7 +42,7 @@ impl Integration for Todoist {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let token = require_str(creds, "api_token")?;let resp = client.get("https://api.todoist.com/api/v1/projects")diff --git a/crates/screenpipe-connect/src/connections/toggl.rs b/crates/screenpipe-connect/src/connections/toggl.rsindex a5c035bb6..fdc071e64 100644--- a/crates/screenpipe-connect/src/connections/toggl.rs+++ b/crates/screenpipe-connect/src/connections/toggl.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -42,7 +43,7 @@ impl Integration for Toggl {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let token = require_str(creds, "api_token")?;let resp: Value = client.get("https://api.track.toggl.com/api/v9/me")diff --git a/crates/screenpipe-connect/src/connections/trello.rs b/crates/screenpipe-connect/src/connections/trello.rsindex 0cf333061..85d60b46b 100644--- a/crates/screenpipe-connect/src/connections/trello.rs+++ b/crates/screenpipe-connect/src/connections/trello.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -39,7 +40,7 @@ impl Integration for Trello {&DEF}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let api_key = require_str(creds, "api_key")?;let api_token = require_str(creds, "api_token")?;let resp: Value = clientdiff --git a/crates/screenpipe-connect/src/connections/vercel.rs b/crates/screenpipe-connect/src/connections/vercel.rsindex 950a6a8f3..19ed18a74 100644--- a/crates/screenpipe-connect/src/connections/vercel.rs+++ b/crates/screenpipe-connect/src/connections/vercel.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -41,7 +42,7 @@ impl Integration for Vercel {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let api_token = require_str(creds, "api_token")?;let resp: Value = client.get("https://api.vercel.com/v9/projects")diff --git a/crates/screenpipe-connect/src/connections/whatsapp.rs b/crates/screenpipe-connect/src/connections/whatsapp.rsindex e284048c8..c3ba3f941 100644--- a/crates/screenpipe-connect/src/connections/whatsapp.rs+++ b/crates/screenpipe-connect/src/connections/whatsapp.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -50,7 +51,7 @@ impl Integration for WhatsApp {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let phone_number_id = require_str(creds, "phone_number_id")?;let access_token = require_str(creds, "access_token")?;let url = format!("https://graph.facebook.com/v21.0/{}", phone_number_id);diff --git a/crates/screenpipe-connect/src/connections/zapier.rs b/crates/screenpipe-connect/src/connections/zapier.rsindex 30a4504c8..7ab6c6033 100644--- a/crates/screenpipe-connect/src/connections/zapier.rs+++ b/crates/screenpipe-connect/src/connections/zapier.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{json, Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -31,7 +32,7 @@ impl Integration for Zapier {&DEF}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let url = require_str(creds, "webhook_url")?;client.post(url)diff --git a/crates/screenpipe-connect/src/connections/zendesk.rs b/crates/screenpipe-connect/src/connections/zendesk.rsindex 8b90ad0d7..f2f2c928b 100644--- a/crates/screenpipe-connect/src/connections/zendesk.rs+++ b/crates/screenpipe-connect/src/connections/zendesk.rs@@ -5,6 +5,7 @@use super::{require_str, Category, FieldDef, Integration, IntegrationDef, ProxyAuth, ProxyConfig};use anyhow::Result;use async_trait::async_trait;+use screenpipe_secrets::SecretStore;use serde_json::{Map, Value};static DEF: IntegrationDef = IntegrationDef {@@ -58,7 +59,7 @@ impl Integration for Zendesk {Some(&CFG)}- async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {+ async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>, _secret_store: Option<&SecretStore>) -> Result<String> {let subdomain = require_str(creds, "subdomain")?;let email = require_str(creds, "email")?;let api_token = require_str(creds, "api_token")?;diff --git a/crates/screenpipe-engine/src/cli/connection.rs b/crates/screenpipe-engine/src/cli/connection.rsindex 2f753530a..d174830f6 100644--- a/crates/screenpipe-engine/src/cli/connection.rs+++ b/crates/screenpipe-engine/src/cli/connection.rs@@ -6,12 +6,36 @@ use super::ConnectionCommand;use screenpipe_connect::connections::ConnectionManager;use screenpipe_connect::oauth;use serde_json::{json, Map, Value};+use std::sync::Arc;/// Handle connection subcommands (standalone — does NOT require a running server).pub async fn handle_connection_command(command: &ConnectionCommand) -> anyhow::Result<()> {let screenpipe_dir = screenpipe_core::paths::default_screenpipe_data_dir();- let cm = ConnectionManager::new(screenpipe_dir.clone());+ // Open SecretStore in CLI mode (no encryption key — reads plaintext entries+ // from the DB, encrypted entries written by the desktop app won't be readable+ // but the file fallback still works for those).+ let db_path = screenpipe_dir.join("db.sqlite");+ let secret_store = if db_path.exists() {+ let db_url = format!("sqlite:{}", db_path.display());+ match sqlx::SqlitePool::connect(&db_url).await {+ Ok(pool) => match screenpipe_secrets::SecretStore::new(pool, None).await {+ Ok(store) => Some(Arc::new(store)),+ Err(e) => {+ tracing::debug!("failed to open SecretStore: {e:#}");+ None+ }+ },+ Err(e) => {+ tracing::debug!("failed to connect to db for SecretStore: {e:#}");+ None+ }+ }+ } else {+ None+ };++ let cm = ConnectionManager::new(screenpipe_dir.clone(), secret_store);match command {ConnectionCommand::List { json: use_json } => {@@ -122,7 +146,7 @@ pub async fn handle_connection_command(command: &ConnectionCommand) -> anyhow::R}// Check credential store first, then fall back to OAuth token- let has_creds = cm.get_credentials(id)?;+ let has_creds = cm.get_credentials(id).await?;let has_oauth = oauth::read_oauth_token(id).await;if let Some(creds) = has_creds {@@ -166,14 +190,14 @@ pub async fn handle_connection_command(command: &ConnectionCommand) -> anyhow::R.ok_or_else(|| anyhow::anyhow!("invalid format '{}' — use key=value", pair))?;creds.insert(key.to_string(), Value::String(value.to_string()));}- cm.connect(id, creds)?;+ cm.connect(id, creds).await?;println!("saved credentials for {}", id);}ConnectionCommand::Test { id } => {// For OAuth integrations, test with empty creds — the test()// implementation reads the token from the OAuth file itself.- let creds = cm.get_credentials(id)?.unwrap_or_default();+ let creds = cm.get_credentials(id).await?.unwrap_or_default();let has_oauth = oauth::read_oauth_token(id).await.is_some();if creds.is_empty() && !has_oauth {@@ -192,7 +216,7 @@ pub async fn handle_connection_command(command: &ConnectionCommand) -> anyhow::R}ConnectionCommand::Remove { id } => {- cm.disconnect(id)?;+ cm.disconnect(id).await?;println!("disconnected {}", id);}}diff --git a/crates/screenpipe-engine/src/connections_api.rs b/crates/screenpipe-engine/src/connections_api.rsindex 02ec50867..664c29411 100644--- a/crates/screenpipe-engine/src/connections_api.rs+++ b/crates/screenpipe-engine/src/connections_api.rs@@ -122,7 +122,7 @@ async fn get_connection(let mgr = state.cm.lock().await;let has_proxy = mgr.find_proxy_config(&id).is_some();- let (status, body) = match mgr.get_credentials(&id) {+ let (status, body) = match mgr.get_credentials(&id).await {Ok(Some(creds)) => (StatusCode::OK, json!({ "credentials": creds })),Ok(None) => (StatusCode::OK, json!({ "credentials": {} })),Err(e) => (StatusCode::BAD_REQUEST, json!({ "error": e.to_string() })),@@ -157,7 +157,7 @@ async fn connect_integration(Json(body): Json<ConnectRequest>,) -> (StatusCode, Json<Value>) {let mgr = state.cm.lock().await;- match mgr.connect(&id, body.credentials) {+ match mgr.connect(&id, body.credentials).await {Ok(()) => (StatusCode::OK, Json(json!({ "success": true }))),Err(e) => (StatusCode::BAD_REQUEST,@@ -172,7 +172,7 @@ async fn disconnect_integration(Path(id): Path<String>,) -> (StatusCode, Json<Value>) {let mgr = state.cm.lock().await;- match mgr.disconnect(&id) {+ match mgr.disconnect(&id).await {Ok(()) => (StatusCode::OK, Json(json!({ "success": true }))),Err(e) => (StatusCode::BAD_REQUEST,@@ -210,7 +210,7 @@ async fn list_instances(Path(id): Path<String>,) -> (StatusCode, Json<Value>) {let mgr = state.cm.lock().await;- match mgr.get_all_instances(&id) {+ match mgr.get_all_instances(&id).await {Ok(instances) => {let items: Vec<Value> = instances.into_iter()@@ -238,7 +238,7 @@ async fn connect_instance(Json(body): Json<ConnectRequest>,) -> (StatusCode, Json<Value>) {let mgr = state.cm.lock().await;- match mgr.connect_instance(&id, Some(&instance), body.credentials) {+ match mgr.connect_instance(&id, Some(&instance), body.credentials).await {Ok(()) => (StatusCode::OK, Json(json!({ "success": true }))),Err(e) => (StatusCode::BAD_REQUEST,@@ -253,7 +253,7 @@ async fn disconnect_instance_route(Path((id, instance)): Path<(String, String)>,) -> (StatusCode, Json<Value>) {let mgr = state.cm.lock().await;- match mgr.disconnect_instance(&id, Some(&instance)) {+ match mgr.disconnect_instance(&id, Some(&instance)).await {Ok(()) => (StatusCode::OK, Json(json!({ "success": true }))),Err(e) => (StatusCode::BAD_REQUEST,@@ -1076,8 +1076,12 @@ async fn connection_proxy(};// Load credentials- let creds = mgr.get_credentials(&id).ok().flatten();- let oauth_token = screenpipe_connect::oauth::read_oauth_token(&id);+ let creds = mgr.get_credentials(&id).await.ok().flatten();+ let oauth_token = screenpipe_connect::oauth::read_oauth_token_instance(+ state.secret_store.as_deref(),+ &id,+ None,+ );// Resolve authlet auth = resolve_auth(@@ -1212,7 +1216,7 @@ async fn connection_config(Path(id): Path<String>,) -> (StatusCode, Json<Value>) {let mgr = state.cm.lock().await;- match mgr.get_credentials(&id) {+ match mgr.get_credentials(&id).await {Ok(Some(creds)) => {// Filter out secret fieldslet def = mgr.find_def(&id);diff --git a/crates/screenpipe-engine/src/pipes_api.rs b/crates/screenpipe-engine/src/pipes_api.rsindex 968689023..8744cede2 100644--- a/crates/screenpipe-engine/src/pipes_api.rs+++ b/crates/screenpipe-engine/src/pipes_api.rs@@ -10,6 +10,7 @@ use axum::extract::{Path, Query, State};use axum::http::StatusCode;use axum::Json;use screenpipe_core::pipes::PipeManager;+use screenpipe_secrets::SecretStore;use serde::Deserialize;use serde_json::{json, Value};use std::collections::HashMap;@@ -125,6 +126,7 @@ pub struct RunPipeBody {/// Accepts an optional JSON body with `notification_context` to inject into the pipe prompt.pub async fn run_pipe_now(State(pm): State<SharedPipeManager>,+ secret_store: Option<axum::Extension<Arc<SecretStore>>>,Path(id): Path<String>,body: Option<Json<RunPipeBody>>,) -> Json<Value> {@@ -165,17 +167,21 @@ pub async fn run_pipe_now(.parent().unwrap_or(mgr.pipes_dir()).to_path_buf();- let store = screenpipe_connect::connections::load_store(&screenpipe_dir);- let missing: Vec<&str> = required- .iter()- .filter(|conn_id| {- !store- .get(conn_id.as_str())- .map(|c| c.enabled && !c.credentials.is_empty())- .unwrap_or(false)- })- .map(|s| s.as_str())- .collect();+ let ss = secret_store.as_ref().map(|e| e.0.as_ref());+ let mut missing = Vec::new();+ for conn_id in required {+ let configured = screenpipe_connect::connections::load_connection(+ ss,+ &screenpipe_dir,+ conn_id,+ )+ .await+ .map(|c| c.enabled && !c.credentials.is_empty())+ .unwrap_or(false);+ if !configured {+ missing.push(conn_id.as_str());+ }+ }if !missing.is_empty() {return Json(json!({"error": format!(diff --git a/crates/screenpipe-engine/src/server.rs b/crates/screenpipe-engine/src/server.rsindex b23523998..9d591527e 100644--- a/crates/screenpipe-engine/src/server.rs+++ b/crates/screenpipe-engine/src/server.rs@@ -700,6 +700,12 @@ impl SCServer {axum::routing::post(crate::routes::pipe_store::pipe_store_review),).with_state(pm.clone());+ // Inject SecretStore as an Extension so pipe handlers can access it+ let pipe_routes = if let Some(ref ss) = self.secret_store {+ pipe_routes.layer(axum::Extension(ss.clone()))+ } else {+ pipe_routes+ };router.nest("/pipes", pipe_routes)} else {router@@ -707,7 +713,10 @@ impl SCServer {// Connections routes (pipe-facing integrations: Telegram, Slack, etc.)let cm: crate::connections_api::SharedConnectionManager = Arc::new(Mutex::new(- screenpipe_connect::connections::ConnectionManager::new(self.screenpipe_dir.clone()),+ screenpipe_connect::connections::ConnectionManager::new(+ self.screenpipe_dir.clone(),+ self.secret_store.clone(),+ ),));let wa: crate::connections_api::SharedWhatsAppGateway = Arc::new(Mutex::new(screenpipe_connect::whatsapp::WhatsAppGateway::new(self.screenpipe_dir.clone()),diff --git a/crates/screenpipe-secrets/src/migration.rs b/crates/screenpipe-secrets/src/migration.rsindex 9c8cfa9d9..dc8e4560e 100644--- a/crates/screenpipe-secrets/src/migration.rs+++ b/crates/screenpipe-secrets/src/migration.rs@@ -114,7 +114,8 @@ pub async fn migrate_legacy_secrets(}}- // Migrate connections.json tokens+ // Migrate connections.json — store each full connection entry under `cred:{name}`+ // so ConnectionManager can read credentials from SecretStore (encrypted).let connections_path = screenpipe_dir.join("connections.json");if connections_path.is_file() {match std::fs::read_to_string(&connections_path) {@@ -123,63 +124,60 @@ pub async fn migrate_legacy_secrets(Ok(json) => {if let Some(obj) = json.as_object() {for (name, value) in obj {- // Extract token-like fields from each connection- if let Some(conn_obj) = value.as_object() {- for (field, field_value) in conn_obj {- let field_lower = field.to_lowercase();- if field_lower.contains("token")- || field_lower.contains("secret")- || field_lower.contains("key")- || field_lower.contains("password")- || field_lower.contains("refresh")- {- if let Some(token_str) = field_value.as_str() {- if token_str.is_empty() {- continue;- }- let store_key =- format!("connection:{}:{}", name, field);-- // Check if already migrated and readable- match store.get(&store_key).await {- Ok(Some(_)) => {- report.skipped.push(format!(- "connections.json/{}/{} (already migrated)",- name, field- ));- continue;- }- Ok(None) => {}- Err(_) => {- // Key change — re-migrate- info!(- "re-migrating connections.json/{}/{} (key change)",- name, field- );- }- }-- if let Err(e) = store- .set(&store_key, token_str.as_bytes())- .await- {- report.errors.push(format!(- "connections.json/{}/{}: {}",- name, field, e- ));- } else {- report.migrated.push(format!(- "connections.json/{}/{} -> {}",- name, field, store_key- ));- info!(- "migrated connections.json/{}/{} -> {}",- name, field, store_key- );- }+ // Migrate the full connection entry under cred:{name}+ let cred_key = format!("cred:{}", name);+ let value_bytes =+ serde_json::to_vec(value).unwrap_or_default();++ let should_import = match store.get(&cred_key).await {+ Ok(Some(_)) => {+ // Check if file is newer+ let file_mtime = std::fs::metadata(&connections_path)+ .ok()+ .and_then(|m| m.modified().ok());+ let store_time = store+ .get_updated_at(&cred_key)+ .await+ .ok()+ .flatten()+ .and_then(|t| {+ chrono::DateTime::parse_from_rfc3339(&t).ok()+ })+ .map(std::time::SystemTime::from);++ match (file_mtime, store_time) {+ (Some(fm), Some(st)) if fm > st => true,+ _ => {+ report.skipped.push(format!(+ "connections.json/{} (already migrated)",+ name+ ));+ false}}}+ Ok(None) => true,+ Err(_) => true,+ };++ if should_import && !value_bytes.is_empty() {+ if let Err(e) =+ store.set(&cred_key, &value_bytes).await+ {+ report.errors.push(format!(+ "connections.json/{}: {}",+ name, e+ ));+ } else {+ report.migrated.push(format!(+ "connections.json/{} -> {}",+ name, cred_key+ ));+ info!(+ "migrated connections.json/{} -> {}",+ name, cred_key+ );+ }}}}@@ -337,25 +335,29 @@ mod tests {fs::write(dir_path.join("connections.json"),- r#"{"slack":{"token":"xoxb-123","name":"my-workspace"},"github":{"access_token":"ghp_abc","repo":"test"}}"#,+ r#"{"slack":{"enabled":true,"credentials":{"token":"xoxb-123","name":"my-workspace"}},"github":{"enabled":true,"credentials":{"access_token":"ghp_abc","repo":"test"}}}"#,).unwrap();let store = make_store().await;let report = migrate_legacy_secrets(&store, dir_path).await.unwrap();- // Should migrate token fields but not non-secret fields like "name" and "repo"+ // Should migrate full connection entries under cred:{name}assert!(report.migrated.iter()- .any(|m| m.contains("slack") && m.contains("token")));+ .any(|m| m.contains("slack") && m.contains("cred:")));assert!(report.migrated.iter()- .any(|m| m.contains("github") && m.contains("access_token")));- assert!(!report.migrated.iter().any(|m| m.contains("name")));- assert!(!report.migrated.iter().any(|m| m.contains("repo")));+ .any(|m| m.contains("github") && m.contains("cred:")));assert!(report.errors.is_empty());++ // Verify the values were stored+ let slack_val = store.get("cred:slack").await.unwrap().unwrap();+ let slack_json: serde_json::Value =+ serde_json::from_slice(&slack_val).unwrap();+ assert_eq!(slack_json["credentials"]["token"], "xoxb-123");}#[tokio::test]@@ -371,14 +373,15 @@ mod tests {let store = make_store().await;- // First migration — file migrated and deleted+ // First migration — file migrated (kept for legacy readers)let report1 = migrate_legacy_secrets(&store, dir_path).await.unwrap();assert_eq!(report1.migrated.len(), 1);- assert!(!dir_path.join("gmail-oauth.json").exists());+ assert!(dir_path.join("gmail-oauth.json").exists()); // file kept- // Second migration — file gone, nothing to do+ // Second migration — already in store, skippedlet report2 = migrate_legacy_secrets(&store, dir_path).await.unwrap();assert_eq!(report2.migrated.len(), 0);+ assert!(report2.skipped.iter().any(|s| s.contains("gmail")));// Value still in storeassert!(store.get("oauth:gmail").await.unwrap().is_some());